[PATCH 2 of 7 V3] obsolete: add the detection of bumped changeset

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Oct 16 16:57:43 CDT 2012


On Oct 16, 2012, at 3:48 PM, Pierre-Yves David wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1350419877 -7200
> # Node ID 8192b7575461b04cd4797d59315a231f426aea77
> # Parent  cf9539941c46582f731f82c8642539e9584bcf40
> obsolete: add the detection of bumped changeset.
> 
> Bumped changeset are non-public changeset that tries to succeed to a public()

         changesets               changesets           to succeed a
[or s/are/is/, and start with 'A bumped changeset...']

> changeset.
> 
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -366,6 +366,16 @@
>                     seen.add(suc)
>                     remaining.add(suc)
> 
> +def _knownrevs(repo, nodes):
> +    """yield revision number of known nodes passed in parameters
                         numbers
> +
> +    Unknown revision are silently ignore."""
               revisions             ignored

> +    torev = repo.changelog.nodemap.get
> +    for n in nodes:
> +        rev = torev(n)
> +        if rev is not None:
> +            yield rev
> +
> # mapping of 'set-name' -> <function to computer this set>
                                          compute

> cachefuncs = {}
> def cachefor(name):
> @@ -430,6 +440,18 @@
>     """the set of obsolete parents without non obsolete descendants"""
>     return set(repo.revs('obsolete() - obsolete()::unstable()'))
> 
> +
> + at cachefor('bumped')
> +def _computebumpedset(repo):
> +    """the set of rev trying to obsolete public revision"""
                     revs                          revisions [or revs, or changes]
> +    # get all possible bumped changesets
> +    tonode = repo.changelog.node
> +    publicnodes = (tonode(r) for r in repo.revs('public()'))
> +    successors = anysuccessors(repo.obsstore, publicnodes)
> +    # revision public or already obsolete don't count as bumped
> +    query = '%ld - obsolete() - public()'
> +    return set(repo.revs(query, _knownrevs(repo, successors)))
> +
> def createmarkers(repo, relations, flag=0, metadata=None):
>     """Add obsolete markers between changesets in a repo
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

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



More information about the Mercurial-devel mailing list