Due to gerrit bug regeneration of Change-Id must be nessecary
Simultaneously dirrect push to master and uploading a gerrit patch for review to some branches is currently not supported. To circumvent it a new option --new-changeid is provided. git-review --dry-run also supported now: only the command is written without actually execute it. Special thank goes to Roan Kattouw for helping out with GIT_EDITOR command. Bug #1032675 Change-Id: Id1433c11ce9f0a2ad51b3bdfa581fdb86cff8f0e
This commit is contained in:
parent
976f4e4485
commit
d06c95de55
14
git-review
14
git-review
|
@ -655,6 +655,9 @@ def main():
|
||||||
"-D/--draft is used.")
|
"-D/--draft is used.")
|
||||||
parser.add_argument("-n", "--dry-run", dest="dry", action="store_true",
|
parser.add_argument("-n", "--dry-run", dest="dry", action="store_true",
|
||||||
help="Don't actually submit the branch for review")
|
help="Don't actually submit the branch for review")
|
||||||
|
parser.add_argument("-i", "--new-changeid", dest="regenerate",
|
||||||
|
action="store_true",
|
||||||
|
help="Regenerate Change-id before submitting")
|
||||||
parser.add_argument("-r", "--remote", dest="remote",
|
parser.add_argument("-r", "--remote", dest="remote",
|
||||||
help="git remote to use for gerrit")
|
help="git remote to use for gerrit")
|
||||||
parser.add_argument("-R", "--no-rebase", dest="rebase",
|
parser.add_argument("-R", "--no-rebase", dest="rebase",
|
||||||
|
@ -753,6 +756,17 @@ def main():
|
||||||
|
|
||||||
cmd = "git push %s HEAD:refs/%s/%s/%s" % (remote, ref, branch,
|
cmd = "git push %s HEAD:refs/%s/%s/%s" % (remote, ref, branch,
|
||||||
topic)
|
topic)
|
||||||
|
if options.regenerate:
|
||||||
|
print("Amending the commit to regenerate the change id\n")
|
||||||
|
regenerate_cmd = "git commit --amend"
|
||||||
|
if options.dry:
|
||||||
|
print("\tGIT_EDITOR=\"sed -i -e '/^Change-Id:/d'\" %s\n" %
|
||||||
|
regenerate_cmd)
|
||||||
|
else:
|
||||||
|
run_command(regenerate_cmd,
|
||||||
|
env=dict(GIT_EDITOR="sed -i -e "
|
||||||
|
"'/^Change-Id:/d'"))
|
||||||
|
|
||||||
if options.dry:
|
if options.dry:
|
||||||
print("Please use the following command "
|
print("Please use the following command "
|
||||||
"to send your commits to review:\n")
|
"to send your commits to review:\n")
|
||||||
|
|
Loading…
Reference in New Issue