[MERGE] apply_inventory_delta
Aaron Bentley
aaron.bentley at utoronto.ca
Mon Apr 2 18:12:50 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
> John Arbash Meinel has voted +1.
> Status is now: Approved
> Comment:
> How does this handle changing the executable bit? Just that the new
> entry has ie.executable = True/False?
Yes.
>
> + :param changes: The list of tuples"""
>
> The """ should be on a line of their own.
Okay.
> Also, I find it more obvious if it was:
>
> :param changes: The list of changes [(old_path, new_path, file_id, ie)]
Okay.
> It looks like their might be a bug in your implementation if you rename
> a directory, and one of the children of that directory.
> (mv dir => dir2, mv dir/child => other)
>
> While you probably can't do this with a single command, I'm sure 'merge'
> can do it.
What happens is that we process moves in two steps, the same as
TreeTransform
http://mebentley.blogspot.com/2005/12/tree-transforms-on-posix-filesystems.html
1. removal, in child-to-parent order.
2. addition, in parent-to-child order.
So what should happen is:
1. remove dir/child
2. remove dir
3. add dir2
4. add other/child
I'm pretty sure this happens, but I'll add another test case, to be certain.
> I would guess there are ways to pass an illegal delta. Should this
> command trap for this case?
Yes.
> (I'm thinking that a first-pass dirstate
> implementation might just trust the caller, and DirState doesn't have
> the same built-in constraints that Inventory has)
I'm deferring to Inventory's sanity checks, but a pure-dirstate
implementation would need to provide its own.
The ones that come to mind are:
1. duplicate paths in output
2. duplicate file_ids in output
3. adding children to something that is not a directory in the output
(including tree-reference)
4. making an entry its own ancestor
5. making an etnry a child of an unversioned file
TreeTransform will never produce a delta that violates these
constraints, because it handles these situations as conflicts. But
since this is a public API, we should assume that some callers will
violate these constraints. In fact, avoiding calling
apply_inventory_delta in these situations would cause unnecessary code
duplication.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGETmS0F+nu1YWqI0RAhHjAJ9Im3q9jFAqbjlv9QsMn1AUwv6YBgCfckMa
RieclZ3Okp37qC41siWnEes=
=PXna
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list