[MERGE] reconcile patch to correct the ancestry graph.

Robert Collins robertc at robertcollins.net
Wed May 3 03:58:46 BST 2006


On Wed, 2006-05-03 at 12:51 +1000, Martin Pool wrote:
> 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.  

That would test a different case :).

> 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.

Its currently written down in the tests for this patch. I think the
right place to write this down is Repository.get_graph and
get_graph_with_ghosts.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060503/beaf4b6f/attachment.pgp 


More information about the bazaar mailing list