tree-less merges
Aaron Bentley
aaron.bentley at utoronto.ca
Tue Nov 27 16:39:52 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Hudson wrote:
> Oh, OK. It looked to me like they were always the same, but I
> probably didn't look hard enough.
I think they're not the same for WeaveMerger, which is derived from
Merge3Merger.
>> You're going to update this to set the conflicts, right?
>
> Well, I'm going to find out how conflicts are handled at some
> point... it's just something I haven't wrapped my brain around yet.
In terms of supporting them on PreviewTree, you just need to implement
Tree.set_conflicts, Tree.add_conflicts and Tree.conflicts.
Individual conflicts will all give you a reasonable message if you
convert them to strings.
>>> @@ -458,7 +459,6 @@
>>> file.close()
>>> mary_tree.commit("change file2")
>>> # john should be able to merge with no conflicts.
>>> - merge_type = Merge3Merger
>>
>> I don't understand why you removed this.
>
> It's an entirely pointless line, isn't it?
Well, only as long as Merge3Merger is the default.
>>> +
>>> + def iter_tree_children(self, parent_id):
>>> + """Iterate through the entry's tree children, if any"""
>>> + # This can't possibly be right :) It's only called from
>>> + # _add_tree_children (where the comment is "") which is called
>>> + # from find_conflicts.
>>
>> Actually, it's used in several places.
>
> Uh, right. But in the cases where a transformpreview is being used, I
> think that this is the only callsite (except possibly
> adjust_tree_root, I'm not sure when that is used).
I guess it's not currently used, but will be when merges support moving
the tree root.
>> This function is essentially listdir, except that it returns paths
>> relative to the tree root. You need to return the paths of the children
>> of the specified directory in the original tree.
>
> Partly here I was confused over what parent_id is. A trans_id?
Right.
>> You ought to be able to reuse the original code, except for the
>> listdir.
>
> Sounds good.
>
>> I think you can replace the listdir with
>> wt.inventory['file_id'].children.keys()
>
> But doesn't iter_tree_children also have to return the files that the
> transform added?
All of the methods with tree in their name refer to self._tree, not the
pending transform. So this is explicitly a list of the children in
self._tree, not the children in the transformed result.
> (On a tangent, using listdir seems a little strange,
> isn't that going to pick up .pyc files and other ignored things?).
Yes. You want all that stuff. Because if you try to create foo.pyc,
and there's already a foo.pyc, you want to name the original to
foo.pyc.moved.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHTEhY0F+nu1YWqI0RApR6AJ9RAIbOdhureHLdFbohmrnA0Hgu1ACeLl2z
bEfbk3jFT0yIRDl0YadAZHk=
=ldrF
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list