[MERGE] make metadir-weaves the default format

Aaron Bentley aaron.bentley at utoronto.ca
Tue Apr 18 15:58:50 BST 2006


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


> === 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?

With my patch applied, +1.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD4DBQFERP6q0F+nu1YWqI0RAsmGAJdpoZbOnYuNyGRdErNfPHruHBxGAKCCGmbl
Vv4VhmnVCKiBWj+QGmGMSg==
=vkVq
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: roundtrip.patch
Type: text/x-patch
Size: 4478 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060418/bb57d920/attachment.bin 


More information about the bazaar mailing list