Bug 4211 - `hg amend -e` without username sends nowhere
Summary: `hg amend -e` without username sends nowhere
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: evolution (show other bugs)
Version: 2.9
Hardware: PC Windows
: urgent bug
Assignee: Bugzilla
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2014-04-01 11:31 UTC by techtonik
Modified: 2015-01-22 15:04 UTC (History)
6 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description techtonik 2014-04-01 11:31 UTC
$ hg amend -e
  abort: cannot amend public changesets

  $ hg phase -d tip -f

  $ hg amend -e
  transaction abort!
  rollback completed
  abort: no username supplied (see "hg help config")

  $ hg amend -e
  warning: ignoring unknown working parent 5d40a9addebf!
  abort: cannot amend public changesets

  $ hg sum
  warning: ignoring unknown working parent 5d40a9addebf!
  parent: -1:000000000000  (no revision checked out)
  branch: default
  commit: 1221 unknown (clean)
  update: 48573 new changesets (update)

I have changeset evolution enabled.
Comment 1 techtonik 2014-07-05 09:55 UTC
I again shot myself in the foot with changeset evolution.

> hg ci
> hg out
> hg amend -e
> hg glog  # amendment didn't record anything
> hg amend -e
warning: ignoring unknown working parent 65a3d892ee2f!
abort: cannot amend public changesets

It seems that my amendment lost. How to restore it and my working copy?
Comment 2 Augie Fackler 2014-07-10 22:42 UTC
Pierre-Yves, looks like some dataloss bugs in evolution.
Comment 3 Matt Mackall 2014-07-11 14:47 UTC
We need to copy this pattern in the affected commands:

http://www.selenic.com/hg/rev/a765611e06dc
Comment 4 techtonik 2014-07-14 16:22 UTC
> --- Comment #3 from Matt Mackall <mpm@selenic.com> ---
> We need to copy this pattern in the affected commands:
>
> http://www.selenic.com/hg/rev/a765611e06dc

Do you mean this pattern?
http://www.selenic.com/hg/rev/3de04c07966a

Actually 3de04c07966a + a765611e06dc. Is it possible to
see merged diff of these two changes in HG? And in
web interface?
Comment 5 Matt Mackall 2014-07-14 16:50 UTC
The changeset you point to is old and only half-right. It refuses to allow record to proceed if you have no username set but have provided one on the commandline. So the code I point to is the pattern to use:

"fail early if no username is given or configured"

Adding Pierre-Yves.
Comment 6 techtonik 2014-07-14 21:38 UTC
That's clear. The question is: is it possible to see combined
diff from these two changes with Mercurial? It may be useful.
Comment 7 HG Bot 2014-10-30 18:01 UTC
Fixed by http://selenic.com/repo/hg/rev/b564330d4b1f
Matt Harbison <matt_harbison@yahoo.com>
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.

(please test the fix)
Comment 8 Matt Mackall 2015-01-22 15:04 UTC
Bulk testing -> fixed