`work-in-progress` and `private` workflow in Gerrit 2.15

In Gerrit 2.15 two new workflow states(`work-in-progress` and
`private`) are introduced. This patch tries to implement them.

Gerrit documentation says:

To push a private change or to turn a change private on push the private
 option can be specified:

  git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/master%private

Omitting the private option when pushing updates to a private change
doesn’t make change non-private again. To remove the private flag from a
 change on push, explicitly specify the remove-private option:

  git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/master%remove-private

To push a wip change or to turn a change to wip the work-in-progress
(or wip) option can be specified:

  git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/master%wip

Omitting the wip option when pushing updates to a wip change doesn’t
make change ready again. To remove the wip flag from a change on push,
 explicitly specify the ready option:

  git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/master%ready

https://gerrit-documentation.storage.googleapis.com/Documentation/2.15/intro-user.html#private-changes
https://gerrit-documentation.storage.googleapis.com/Documentation/2.15/intro-user.html#wip

Change-Id: Ia093e4a691fa8eb17c798473a79a97694202fd03
This commit is contained in:
Abbas Yazdanpanah 2018-04-07 15:59:12 +04:30
parent b07a524a29
commit 6f50b591db
1 changed files with 40 additions and 1 deletions

View File

@ -1486,6 +1486,28 @@ def _main():
"you are submitting more than one patch")
parser.add_argument("-v", "--verbose", dest="verbose", action="store_true",
help="Output more information about what's going on")
wip_group = parser.add_mutually_exclusive_group()
wip_group.add_argument("-w", "--work-in-progress", dest="wip",
action="store_true",
help="Send patch as work in progress for Gerrit "
"versions >= 2.15")
wip_group.add_argument("-W", "--ready", dest="ready", action="store_true",
help="Send patch that is already work in progress"
" as ready for review. Gerrit versions >="
" 2.15")
private_group = parser.add_mutually_exclusive_group()
private_group.add_argument("-p", "--private", dest="private",
action="store_true",
help="Send patch as a private patch ready for "
"review. Gerrit versions >= 2.15")
private_group.add_argument("-P", "--remove-private", dest="remove_private",
action="store_true",
help="Send patch which already in private state"
" to normal patch."" Gerrit versions >= "
"2.15")
parser.add_argument("--no-custom-script", dest="custom_script",
action="store_false", default=True,
help="Do not run custom scripts.")
@ -1514,7 +1536,12 @@ def _main():
update=False,
setup=False,
list=False,
yes=False)
yes=False,
wip=False,
ready=False,
private=False,
remove_private=False)
try:
(top_dir, git_dir) = git_directories()
except GitDirectoriesException as _no_git_dir:
@ -1641,6 +1668,18 @@ def _main():
GIT_EDITOR="sed -i -e "
"'/^Change-Id:/d'")
if options.wip:
cmd += '\%wip'
if options.ready:
cmd += '\%ready'
if options.private:
cmd += '\%private'
if options.remove_private:
cmd += '\%remove-private'
if options.dry:
print("Please use the following command "
"to send your commits to review:\n")