Comments
Patch
@@ -1454,6 +1454,11 @@ def commit(ui, repo, *pats, **opts):
if not allowunstable and old.children():
raise util.Abort(_('cannot amend changeset with children'))
+ # 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.isenabled(repo, obsolete.createmarkersopt):
+ ui.username() # raise exception if username not set
+
# commitfunc is used only for temporary amend commit by cmdutil.amend
def commitfunc(ui, repo, message, match, opts):
return repo.commit(message,
@@ -753,3 +753,18 @@ Test that removing a local tag does not
$ hg tags
visible 0:193e9254ce7e
tip 0:193e9254ce7e
+
+Test that amend with no ui.username doesn't reset the parent to -1 (issue4211)
+ $ HGUSER=
+ $ hg -q up
+ $ hg ci --amend --config ui.username= -m "empty user"
+ abort: no username supplied
+ (use "hg config --edit" to set your username)
+ [255]
+ $ hg sum
+ parent: 0:193e9254ce7e tip visible
+ A
+ branch: default
+ commit: (clean)
+ update: (current)
+