[PATCH 1 of 7 V2] obsolete: cheap detection of nullid as successors

Patrick Mézard patrick at mezard.eu
Sun Oct 14 10:31:19 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 1349257585 -7200
> # Node ID af731e6a342308e9111c11287bd73a1a0fcbbd47
> # Parent  57fe5aca86af8d82b9c932bf68ae536a99365c86
> obsolete: cheap detection of nullid as successors
> 
> Nullid as successors create multiple issues:
> 
> - Nullid revnum is -1, confusing algorithm that use revnum unless you add
>   special handling in all of them.
> - Nullid confuse "divergent" changeset detection and resolution. As you can't
           confuses

>   add any successors to Nullid without being in even more troubles
> 
> Fortunately, there is not good reason to use nullid as a successor. The only
                        no

> sensible meaning of "succeed by nullid" is "drooped" and this meaning is already
                                              dropped

> covered by obsolescence marker with empty successors set.
> 
> However, letting some nullid successors to slip in may cause terrible damage in
> such algorithm difficult to debug. So I prefer to performs and clear detection
                                                    perform      ?

> of of such pathological changeset. We could be much smarter by cleaning up
> nullid successors on the fly but it would be much for expensive. As core
> Mercurial does not create any such changeset, I think its fine to just abort
                                                        it is

> when suspicious situation is detected.
> 
> Earlier experimental version created such changeset, so there is some out there.
                                            changesets          are

> The evolve extension added the necessary logic to clean up its mess.
> 
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -52,7 +52,7 @@
>    cannot contain '\0'.
>  """
>  import struct
> -import util, base85
> +import util, base85, node
>  from i18n import _
>  
>  _pack = struct.pack
> @@ -237,6 +237,9 @@
>              self.precursors.setdefault(pre, set()).add(mark)
>              for suc in sucs:
>                  self.successors.setdefault(suc, set()).add(mark)
> +        if node.nullid in self.successors:
> +            raise util.Abort('Bad obsolescence marker detected: '
> +                             'invalid successors nullid')

Please wrap the string in _(). There are others missing it in obsolete.py.
We avoid messages starting with capital letters.

--
Patrick Mézard



More information about the Mercurial-devel mailing list