[PATCH 2 of 5] obsolete: drop successors sets which are subset of another one

Augie Fackler raf at durin42.com
Sun Nov 11 15:40:15 CST 2012


This and the rest of the series look pretty clear to me.

I'll let mpm look at the series though, since I'm not sure how to react to the first one.

On Nov 9, 2012, at 7:23 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1352509019 -3600
> # Node ID 929a4dc33ad3401ced4b099bdbf29d714115d2df
> # Parent  c9b7c8ba13c0904afea4ecf035db2c02befab070
> obsolete: drop successors sets which are subset of another one
> 
> If both "(B,)" and "(B, C)" are successors set of "A", "(B,)" is dropped.
> We won't be interrested in detection such divergence scenario.
> 
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -518,7 +518,24 @@
>                 # computation was succesful for *all* marker.
>                 # Add computed successors set to the cache
>                 # (will be poped from to proceeed on the next iteration)
> -                cache[node] = list(set(tuple(r) for r in lss if r))
> +                #
> +                # We remove successors set that are subset of another one
> +                # this fil
> +                candsucset = sorted(((len(ss), set(ss), ss) for ss in lss),
> +                                    reverse=True)
> +                finalsucset = []
> +                for cl, cs, css in candsucset:
> +                    if not css:
> +                        # remove empty successors set
> +                        continue
> +                    for fs, fss in finalsucset:
> +                        if cs.issubset(fs):
> +                            break
> +                    else:
> +                        finalsucset.append((cs, css))
> +                finalsucset = [s[1] for s in finalsucset]
> +                finalsucset.reverse() # put small successors set first
> +                cache[node] = finalsucset
>     return cache[initialnode]
> 
> def _knownrevs(repo, nodes):
> diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t
> --- a/tests/test-obsolete-divergent.t
> +++ b/tests/test-obsolete-divergent.t
> @@ -75,8 +75,8 @@
>   d20a80d4def3
>       d20a80d4def3
>   007dc284c1f8
> +      392fd25390da
>       82623d38b9ba
> -      392fd25390da
>   82623d38b9ba
>       82623d38b9ba
>   392fd25390da
> @@ -139,8 +139,8 @@
>   d20a80d4def3
>       d20a80d4def3
>   007dc284c1f8
> +      392fd25390da
>       82623d38b9ba
> -      392fd25390da
>   82623d38b9ba
>       82623d38b9ba
>   392fd25390da
> @@ -396,3 +396,18 @@
> 
>   $ cd ..
> 
> +
> +Subset does not diverge
> +------------------------------
> +
> +Do not report divergent successors-set if it is a subset of another
> +successors-set. (report [A,B] not [A] + [A,B])
> +
> +  $ newcase subset
> +  $ hg debugobsolete `getid A_0` `getid A_2`
> +  $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2`
> +  $ hg debugsuccessorssets 'desc('A_0')'
> +  007dc284c1f8
> +      82623d38b9ba 392fd25390da
> +
> +  $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list