[PATCH 5 of 7 V2] obsolete: add a flag that allows fix for "bumped" changeset

Patrick Mézard patrick at mezard.eu
Sun Oct 14 11:25:29 CDT 2012


Le 03/10/12 23:21, Pierre-Yves David a écrit :
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1349298229 -7200
> # Node ID 6f36fcc8f5315fa54d6104348c8d175838f15825
> # Parent  d3d9bf88c71542eb5f34e4c9970a66adc536fa83
> obsolete: add a flag that allows fix for "bumped" changeset
                                   fixing "bumped" changeset

Could you elaborate on the problem being solved here? I have bumped changeset, I amend it somehow and it is no longer considered bumped because the flag cuts the successor to public changeset relation?

> The first obsolescence marker is introduce to allows for fixing the "bumped"
                         flag?     introduced to allow fixing the "bumped"

> changeset situation.  For allow fixing this situation, the first flag for
                        To fix it,

> obsolescence marker is introduced.

The second sentence says the same thing than the first one.

> 
>     bumpedfix == 1.
> 
> Creator of new changesets intended to fix "bumped" situation should not forget
                                                     situations

> to add this flag to the marker. Otherwise the newly created changeset will be
> bumped too.
> 
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -71,6 +71,9 @@
>  _fmfsize = struct.calcsize(_fmfixed)
>  _fnodesize = struct.calcsize(_fmnode)
>  
> +# obsolescence marker flag
> +bumpedfix = 1
> +
>  def _readmarkers(data):
>      """Read and enumerate markers from raw data"""
>      off = 0
> @@ -403,13 +406,16 @@
>  def _computebumpedset(repo):
>      """the set of rev trying to obsolete public revision"""
>      # get all possible bumped changeset
> -    candidates = _anysuccessors(repo, repo.revs('public()'))
> +    candidates = _anysuccessors(repo, repo.revs('public()'),
> +                                ignoreflags=bumpedfix)
>      # revision public or already obsolete don't account as bumped
>      query = '%ld - obsolete() - public()'
>      return set(repo.revs(query, candidates))
>  
> -def _anysuccessors(repo, revs):
> +def _anysuccessors(repo, revs, ignoreflags=0):
>      """return revid of all successors of a set of revs
> +
> +    Marker with any flags present in the `ignoreflags` bitfield are ignored.
       Markers

>      """
>      toproceed = [repo[r].node() for r in revs]
>      # prevent extra processing and cycle
> @@ -422,6 +428,9 @@
>          nc = toproceed.pop()
>          # for all markers that make this node obsolete
>          for mark in markersfor.get(nc, ()):
> +            # ignore marker with flaged with specified flag
                               flagged with    

> +            if mark[2] & ignoreflags:
> +                continue
>              # for all successors
>              for suc in mark[1]:
>                  # record this as a successors

--
Patrick Mézard



More information about the Mercurial-devel mailing list