[PATCH 1 of 2] amend: add noise in extra to avoid creating obsolescence cycle (issue3664)
Idan Kamara
idankk86 at gmail.com
Thu Oct 18 16:23:03 UTC 2012
On Thu, Oct 18, 2012 at 6:03 PM, <pierre-yves.david at logilab.fr> wrote:
>
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1350575482 -7200
> # Node ID 122ab0793ce25a8ada0895fca25d05dbde7326a3
> # Parent a1c4b21fc1b206f5cf386a8d9d5b5882aaa6807f
> amend: add noise in extra to avoid creating obsolescence cycle (issue3664)
>
> Obsolescence cycle are bad and should be avoided as much as possible. The
> current amend implemented touch changeset meta data as few as possible.
> This
> make is easy for amend to result in the same node than a precursors. We
> add some
> deterministic noise in extra to avoid this. In practice, the hex of the
> amended
> changeset is stored in 'amend-from' extra key.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1694,10 +1694,12 @@ def amend(ui, repo, commitfunc, old, ext
> user = opts.get('user') or old.user()
> date = opts.get('date') or old.date()
> if not message:
> message = old.description()
>
> + extra['amend-from'] = old.hex()
> +
> new = context.memctx(repo,
> parents=[base.node(), nullid],
> text=message,
> files=files,
> filectxfn=filectxfn,
> diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
> --- a/tests/test-commit-amend.t
> +++ b/tests/test-commit-amend.t
> @@ -18,36 +18,35 @@ Refuse to amend public csets:
> $ hg ci -Am 'base1'
>
> Nothing to amend:
>
> $ hg ci --amend
> - nothing changed
> - [1]
It's a pity that we can't preserve the behavior that when
nothing changed amend is a no-op. It's useful for a user to
know that it did what you wanted.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20121018/becd5a3d/attachment-0002.html>
More information about the Mercurial-devel
mailing list