[PATCH 6 of 6] bookmark: take successors into account when updating (issue 3561)
Adrian Buehlmann
adrian at cadifra.com
Fri Aug 24 10:56:58 CDT 2012
On 2012-08-24 17:15, pierre-yves.david at logilab.fr wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1343843300 -7200
> # Node ID db9ca5b3a1e09c43e71e70b82ce615cde29e24b5
> # Parent bb4f46cc1c046702a735ae9ab352302d48614f03
> bookmark: take successors into account when updating (issue 3561)
^ extra space
>
> When we rewrite a bookmarked changeset, we want to update the bookmark on it's
> successors. But the successors is not a descendant of it's precursor (kind of by
are not ... its ..
> definition). This changeset alter the bookmarks logic to update bookmark
alters the bookmark ...
> location is the newer location is a successors of the old one[1].
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (grammar parsing error)
(what is that "[1]" referring to?)
> note: that valid destination are in fact any kind of successors of any kind
> of descendants (recursively.)
This probably requires an obselence expert to understand that. I fail to understand
it.
> This changeset required the enabling of the obsolete feature in some bookmark
> test.
tests.
> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -5,11 +5,11 @@
> # This software may be used and distributed according to the terms of the
> # GNU General Public License version 2 or any later version.
>
> from mercurial.i18n import _
> from mercurial.node import hex
> -from mercurial import encoding, error, util
> +from mercurial import encoding, error, util, obsolete
> import errno, os
>
> def valid(mark):
> for c in (':', '\0', '\n', '\r'):
> if c in mark:
> @@ -253,6 +253,21 @@ def diff(ui, repo, remote):
> return 1
> return 0
>
> def validdest(repo, old, new):
> """Is the new bookmark destination a valid update from the old one"""
> - return new in old.descendants()
> + if repo.obsstore and old and old.phase(): # don't apply for public old
??? (grammar)
(I can't say how to fix the grammar of this comment, as I don't know what the
correct meaning is. So this comment does more harm than it helps. Perhaps
just remove it?)
> + # XXX will probably deserve and optimised rset.
??? (grammar parse error ["x and y?"])
> + validdests = set([old])
> + plen = -1
> + # compute the whole set of successors or descendants
> + while len(validdests) != plen:
> + plen = len(validdests)
> + succs = set(c.node() for c in validdests)
> + for c in validdests:
> + succs.update(obsolete.anysuccessors(repo.obsstore, c.node()))
> + validdests = set(repo.set('%ln::', succs))
> + if old: # not nullrev
> + validdests.remove(old)
> + else:
> + validdests = old.descendants()
> + return new in validdests
More information about the Mercurial-devel
mailing list