summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2008-12-12 08:01:12 -0800
committerShawn O. Pearce <sop@google.com>2008-12-12 08:01:12 -0800
commit67092448c290ce6bd3f05abc17f4f4d53e4c91bb (patch)
treebcb2fc65b934d3e6904286bf69fb0b8e2f52b9ea
parente92ceebde0034ad045e12b8241045d701383e681 (diff)
downloadgit-repo-67092448c290ce6bd3f05abc17f4f4d53e4c91bb.tar.gz
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>
-rw-r--r--subcmds/upload.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 5e36db61..4e4bdbe0 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -178,6 +178,7 @@ with the code review system, or the upload will fail.
178 for line in script: 178 for line in script:
179 m = change_re.match(line) 179 m = change_re.match(line)
180 if m: 180 if m:
181 c = m.group(1)
181 f = m.group(2) 182 f = m.group(2)
182 try: 183 try:
183 f = full_hashes[f] 184 f = full_hashes[f]
@@ -185,7 +186,11 @@ with the code review system, or the upload will fail.
185 print 'fh = %s' % full_hashes 186 print 'fh = %s' % full_hashes
186 print >>sys.stderr, "error: commit %s not found" % f 187 print >>sys.stderr, "error: commit %s not found" % f
187 sys.exit(1) 188 sys.exit(1)
188 to_replace[m.group(1)] = f 189 if c in to_replace:
190 print >>sys.stderr,\
191 "error: change %s cannot accept multiple commits" % c
192 sys.exit(1)
193 to_replace[c] = f
189 194
190 if not to_replace: 195 if not to_replace:
191 print >>sys.stderr, "error: no replacements specified" 196 print >>sys.stderr, "error: no replacements specified"