[MERGE] reconcile patch to correct the ancestry graph.

Martin Pool mbp at sourcefrog.net
Wed May 3 03:51:55 BST 2006


On  2 May 2006, Robert Collins <robertc at robertcollins.net> wrote:
> this fixes bug 29674 by allowing a manual command to correct the
> ordering: we cannot correct it inside reweave because we dont know which
> of the difffering representations is correct.

+1, please merge

> @@ -105,7 +116,8 @@
>  
>      def _reconcile_steps(self):
>          """Perform the steps to reconcile this repository."""
> -        self._reweave_inventory()
> +        if self.thorough:
> +            self._reweave_inventory()
>  
>      def _reweave_inventory(self):
>          """Regenerate the inventory weave for the repository from scratch."""
> @@ -188,7 +200,9 @@
>              else:
>                  mutter('found ghost %s', parent)
>          self._rev_graph[rev_id] = parents   
> -        if set(self.inventory.get_parents(rev_id)) != set(parents):
> +        if (set(self.inventory.get_parents(rev_id)) != set(parents) or
> +            (len(self.inventory.get_parents(rev_id)) and len(parents) and
> +             parents[0] != self.inventory.get_parents(rev_id)[0])):
>              self.inconsistent_parents += 1
>              mutter('Inconsistent inventory parents: id {%s} '
>                     'inventory claims %r, '

Arguably it would be simpler to say 

        if (set(self.inventory.get_parents(rev_id)) != set(parents) or
            (self.inventory.get_parents(rev_id)[:1] != parents[:1]):

rather than testing the length.  

There's a new assumption here which is probably reasonable but might not
be expected: after reconciliation, the primary parent is guaranteed to
be correct but the others may be out of order.  (Or is there a stronger
guarantee?)  I think that should be written down somewhere - a docstring
on the reconcile function or class would do.


-- 
Martin




More information about the bazaar mailing list