Patchwork [STABLE] amend: abort early if no username is configured with evolve enabled (issue4211)

login
register
mail settings
Submitter Matt Harbison
Date Oct. 29, 2014, 3:16 a.m.
Message ID <fd356daa520fe39f0014.1414552577@Envy>
Download mbox | patch
Permalink /patch/6491/
State Superseded
Headers show

Comments

Matt Harbison - Oct. 29, 2014, 3:16 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1414551919 14400
#      Tue Oct 28 23:05:19 2014 -0400
# Branch stable
# Node ID fd356daa520fe39f0014e5ef7f8f853e077ba98f
# Parent  675e415568af75fd2f803349d09aa2585a8ba735
amend: abort early if no username is configured with evolve enabled (issue4211)

Amend will reuse the original username if a new one is not provided with -U, but
obsolete.createmarkers() only considers ui.username() for the obsolete marker's
metadata.  Allowing the metadata field to be spoofed seems to defeat the point
of the field in the first place.  This covers 'evolve amend' and 'ci --amend'
with evolve enabled.

Without this, the transaction aborts but the parent changeset is set to -1.  The
corresponding test will be added to evolve separately.
Matt Mackall - Oct. 29, 2014, 7:42 p.m.
On Tue, 2014-10-28 at 23:16 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1414551919 14400
> #      Tue Oct 28 23:05:19 2014 -0400
> # Branch stable
> # Node ID fd356daa520fe39f0014e5ef7f8f853e077ba98f
> # Parent  675e415568af75fd2f803349d09aa2585a8ba735
> amend: abort early if no username is configured with evolve enabled (issue4211)

Queueud for stable, thanks.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2121,6 +2121,11 @@ 
                       scmutil.match(repo[None], pats, opts), opts)
 
 def amend(ui, repo, commitfunc, old, extra, pats, opts):
+    # amend will reuse the existing user if not specified, but the obsolete
+    # marker creation requires that the current user's name is specified.
+    if obsolete._enabled:
+        ui.username() # raise exception if username not set
+
     ui.note(_('amending changeset %s\n') % old)
     base = old.p1()