Compare commits

...

3 Commits
v1.4 ... v1.4.2

Author SHA1 Message Date
a6df7d284c Describe upload --replace in upload's help text
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 08:04:07 -08:00
67092448c2 Don't accept multiple commits for the same change in upload --replace
Gerrit won't permit more than one commit using the same change
number during a replacement request, so we should error out if
the user has asked for this in their upload edit script.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 08:01:12 -08:00
e92ceebde0 Fix upload --replace after it was broken when --review,--cc was added
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-24 15:51:25 -08:00

View File

@ -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
new users. Users passed to --reviewers must be already registered
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):
@ -151,7 +157,7 @@ with the code review system, or the upload will fail.
_die("nothing uncommented for upload")
self._UploadAndReport(todo, people)
def _ReplaceBranch(self, project):
def _ReplaceBranch(self, project, people):
branch = project.CurrentBranch
if not branch:
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:
m = change_re.match(line)
if m:
c = m.group(1)
f = m.group(2)
try:
f = full_hashes[f]
@ -185,7 +192,11 @@ with the code review system, or the upload will fail.
print 'fh = %s' % full_hashes
print >>sys.stderr, "error: commit %s not found" % f
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:
print >>sys.stderr, "error: no replacements specified"
@ -247,7 +258,7 @@ with the code review system, or the upload will fail.
print >>sys.stderr, \
'error: --replace requires exactly one project'
sys.exit(1)
self._ReplaceBranch(project_list[0])
self._ReplaceBranch(project_list[0], people)
return
for project in project_list: