[MERGE] make metadir-weaves the default format
Robert Collins
robertc at robertcollins.net
Tue Apr 18 23:03:00 BST 2006
On Tue, 2006-04-18 at 10:58 -0400, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> This patch breaks roundtripping of ConflictLists. I've attached a fix.
>
> Robert Collins wrote:
> > === modified file 'a/bzrlib/conflicts.py'
> > --- a/bzrlib/conflicts.py
> > +++ b/bzrlib/conflicts.py
> > @@ -176,10 +176,10 @@
> > @staticmethod
> > def from_stanzas(stanzas):
> > """Produce a new ConflictList from an iterable of stanzas"""
> > - conflicts = ConflictList()
> > + result_list = []
> > for stanza in stanzas:
> > - conflicts.append(Conflict.factory(**stanza.as_dict()))
> > - return conflicts
> > + result_list.append(Conflict.factory(**stanza.as_dict()))
> > + return ConflictList(sorted(result_list, key=lambda x:x.path))
>
> This is an ordered list, and sorting means that serialization is broken:
> what you write isn't what you read. It might be nice to have
> strongly-sorted ConflictList that could never be unsorted, but that's
> essentially unworkable, because ConflictList would need to detect
> changes to the paths of the Conflicts it holds.
>
> Also, planned future work is for conflicts to be updated as the
> conflicted files are moved. That is:
>
> $ bzr conflicts
> Text conflict in baz.
> Text conflict in foo.
> $ bzr mv foo bar
> $ bzr conflicts
> Text conflict in bar.
> Text conflict in baz.
>
> In my analysis, the fact that paths can be changed after deserialization
> means that sorting should be done after deserialization, and probably
> deferred as long as possible.
Thanks.
>
> > === modified file 'a/bzrlib/tests/blackbox/test_push.py'
> > --- a/bzrlib/tests/blackbox/test_push.py
> > +++ b/bzrlib/tests/blackbox/test_push.py
> > @@ -37,10 +37,10 @@
> > self.build_tree(['branch_a/a'])
> > tree_a.add('a')
> > tree_a.commit('commit a')
> > - branch_b = branch_a.bzrdir.sprout('branch_b').open_branch()
> > - tree_b = branch_b.bzrdir.open_workingtree()
> > - branch_c = branch_a.bzrdir.sprout('branch_c').open_branch()
> > - tree_c = branch_c.bzrdir.open_workingtree()
> > + tree_b = branch_a.bzrdir.sprout('branch_b').open_workingtree()
> > + branch_b = tree_b.branch
> > + tree_c = branch_a.bzrdir.sprout('branch_c').open_workingtree()
> > + branch_c = tree_c.branch
>
> Were changes like this actually necessary to get tests to pass?
Yes.
This code creates two branch objects:
branch_b = branch_a.bzrdir.sprout('branch_b').open_branch()
tree_b = branch_b.bzrdir.open_workingtree()
branch_b and tree_b.branch are different objects.
> With my patch applied, +1.
Thanks!
--
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/20060419/941cabce/attachment.pgp
More information about the bazaar
mailing list