[PATCH RFC] commit: add --amend option to amend the parent changeset
Idan Kamara
idankk86 at gmail.com
Tue Feb 21 10:27:13 UTC 2012
On Tue, Feb 21, 2012 at 10:22 AM, Arne Babenhauserheide <arne_bab at web.de>wrote:
> Am Montag, 20. Februar 2012, 15:42:21 schrieb Martin Geisler:
> > I don't think it's "semantically wrong" if your semantics is:
> >
> > hg commit --amend == hg rollback; hg commit
> >
> > That's how I've thought of that hypothetical flag from the beginning.
> >
> > I actually don't care much if it's a command or a flag, I'm just saying
> > that I find it natural that a flag on commit would behave as rollback
> > plus a new commit (with updated timestamp, of course).
>
> I think that this is the current usecase, because it is the only simple
> way to
> do it.
>
> But actually what I want is “make the last commit look like this”, while
> retaining the usual Mercurial promises (don’t break other peoples history,
> don’t lose work, don’t get too complicated, …).
>
> If the commit is in draft, I likely won’t need the old commit anymore.
> Possibly I actually don’t want it to ever propagate (because I committed a
> password or so).
>
> I might want it to be available to me, though, because I might make an
> error
> on the new commit which I might only catch by comparing it to the old one.
>
If Mercurial could mark changesets as eligible for garbage collection it
would probably be a good fit to mark the amended commit as such.
Since it doesn't (for now?), all we can do is keep a backup which strip
already does (I didn't think it was necessary, but others might disagree).
>
> If it is already public, I will have to keep the old commit around (for me
> it
> looks like obsolete actually could provide ways for safely rewriting public
> history, because the obsolete changesets stay available, so it is just
> like an
> abandoned branch with the additional info “please rebase over here to
> integrate with the latest changes”).
>
You shouldn't be able to amend public changesets. If you really want to
you could 'hg phase -f -d' it and then --amend will agree to do it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20120221/dd5e3a3e/attachment-0002.html>
More information about the Mercurial-devel
mailing list