mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-06-28 20:17:26 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a6df7d284c | |||
67092448c2 | |||
e92ceebde0 |
@ -55,6 +55,12 @@ If the --reviewers or --cc options are passed, those emails are
|
|||||||
added to the respective list of users, and emails are sent to any
|
added to the respective list of users, and emails are sent to any
|
||||||
new users. Users passed to --reviewers must be already registered
|
new users. Users passed to --reviewers must be already registered
|
||||||
with the code review system, or the upload will fail.
|
with the code review system, or the upload will fail.
|
||||||
|
|
||||||
|
If the --replace option is passed the user can designate which
|
||||||
|
existing change(s) in Gerrit match up to the commits in the branch
|
||||||
|
being uploaded. For each matched pair of change,commit the commit
|
||||||
|
will be added as a new patch set, completely replacing the set of
|
||||||
|
files and description associated with the change in Gerrit.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _Options(self, p):
|
def _Options(self, p):
|
||||||
@ -151,7 +157,7 @@ with the code review system, or the upload will fail.
|
|||||||
_die("nothing uncommented for upload")
|
_die("nothing uncommented for upload")
|
||||||
self._UploadAndReport(todo, people)
|
self._UploadAndReport(todo, people)
|
||||||
|
|
||||||
def _ReplaceBranch(self, project):
|
def _ReplaceBranch(self, project, people):
|
||||||
branch = project.CurrentBranch
|
branch = project.CurrentBranch
|
||||||
if not branch:
|
if not branch:
|
||||||
print >>sys.stdout, "no branches ready for upload"
|
print >>sys.stdout, "no branches ready for upload"
|
||||||
@ -178,6 +184,7 @@ with the code review system, or the upload will fail.
|
|||||||
for line in script:
|
for line in script:
|
||||||
m = change_re.match(line)
|
m = change_re.match(line)
|
||||||
if m:
|
if m:
|
||||||
|
c = m.group(1)
|
||||||
f = m.group(2)
|
f = m.group(2)
|
||||||
try:
|
try:
|
||||||
f = full_hashes[f]
|
f = full_hashes[f]
|
||||||
@ -185,7 +192,11 @@ with the code review system, or the upload will fail.
|
|||||||
print 'fh = %s' % full_hashes
|
print 'fh = %s' % full_hashes
|
||||||
print >>sys.stderr, "error: commit %s not found" % f
|
print >>sys.stderr, "error: commit %s not found" % f
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
to_replace[m.group(1)] = f
|
if c in to_replace:
|
||||||
|
print >>sys.stderr,\
|
||||||
|
"error: change %s cannot accept multiple commits" % c
|
||||||
|
sys.exit(1)
|
||||||
|
to_replace[c] = f
|
||||||
|
|
||||||
if not to_replace:
|
if not to_replace:
|
||||||
print >>sys.stderr, "error: no replacements specified"
|
print >>sys.stderr, "error: no replacements specified"
|
||||||
@ -247,7 +258,7 @@ with the code review system, or the upload will fail.
|
|||||||
print >>sys.stderr, \
|
print >>sys.stderr, \
|
||||||
'error: --replace requires exactly one project'
|
'error: --replace requires exactly one project'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self._ReplaceBranch(project_list[0])
|
self._ReplaceBranch(project_list[0], people)
|
||||||
return
|
return
|
||||||
|
|
||||||
for project in project_list:
|
for project in project_list:
|
||||||
|
Reference in New Issue
Block a user