[PATCH] obsolete: consider successors along with descendants when updating

Kevin Bullock kbullock+mercurial at ringworld.org
Sun Feb 10 21:04:06 CST 2013


On 10 Feb 2013, at 9:47 PM, Levi Bard wrote:

> # HG changeset patch
> # User Levi Bard <levi at unity3d.com>
> # Date 1360532614 -3600
> # Node ID 8d89080a98d69606ac264282e2ba3e33b056bcac
> # Parent  013fcd112f13f31a35ea6a40d8cd1c6923cdaf20
> obsolete: consider successors along with descendants when updating
> 
> Currently, if you pull --update a group of changesets that obsoletes
> the current changeset, mercurial refuses to update because the pulled tip
> is not a descendant. This change causes mercurial to consider successors
> as well as descendants when determining whether to update.
> 
> diff -r 013fcd112f13 -r 8d89080a98d6 mercurial/merge.py
> --- a/mercurial/merge.py	Sat Feb 09 11:00:42 2013 +0100
> +++ b/mercurial/merge.py	Sun Feb 10 22:43:34 2013 +0100
> @@ -7,6 +7,7 @@
> 
> from node import nullid, nullrev, hex, bin
> from i18n import _
> +from mercurial import obsolete
> import error, util, filemerge, copies, subrepo
> import errno, os, shutil
> 
> @@ -632,6 +633,9 @@
>         elif not overwrite:
>             if pa == p1 or pa == p2: # linear
>                 pass # all good
> +            elif repo.obsstore and \
> +             node in obsolete.allsuccessors(repo.obsstore, [p1.node()]):

Wrap condition in parens instead of continuing the line with \.

> +                pa = p1 # allow updating to successors of obsolete nodes

Huh, that's really all it takes?

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list