From 67092448c290ce6bd3f05abc17f4f4d53e4c91bb Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 12 Dec 2008 08:01:12 -0800 Subject: [PATCH] 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 --- subcmds/upload.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. 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 +186,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"