[PATCH 1 of 2] amend: add noise in extra to avoid creating obsolescence cycle (issue3664)
Kevin Bullock
kbullock+mercurial at ringworld.org
Thu Oct 18 16:13:22 UTC 2012
On Oct 18, 2012, at 11:03 AM, 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()
Consistency with graft, transplant, and rebase would dictate that this key should be named 'amend_source'. At least switching to an underscore would be nice.
Other than that, LGTM.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list