Rev 5858: Update some documentation, also fix a serious bug in the old code. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
John Arbash Meinel
john at arbash-meinel.com
Wed May 18 10:45:06 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-set-parent-trees-delta-282941
------------------------------------------------------------
revno: 5858
revision-id: john at arbash-meinel.com-20110518104503-d571kyyo148b364b
parent: john at arbash-meinel.com-20110518095244-og67674lnpf6djxo
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-set-parent-trees-delta-282941
timestamp: Wed 2011-05-18 12:45:03 +0200
message:
Update some documentation, also fix a serious bug in the old code.
Specifically, any real_add is going to fail with _get_entry(1,) because the
_get_entry code notices that the entry is 'a' on the basis tree. So we fall
back to _get_entry(0). Another option comes to mind, though, which is to
always call _get_entry(0,) without a file_id, then check the file_id, and
only call _get_entry(1, ) if the [0] file_id doesn't match.
That might save some bisection lookups in common cases.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2011-05-18 09:52:44 +0000
+++ b/bzrlib/dirstate.py 2011-05-18 10:45:03 +0000
@@ -1654,6 +1654,16 @@
for old_path, new_path, file_id, new_details, real_add in adds:
entry = self._get_entry(1, file_id, new_path)
if entry[0] is None:
+ # This entry doesn't exist in tree 1, but it might just be an
+ # 'absent' record which we are filling in. Check in tree 0
+ # Note: we never have to check old_path, because by now
+ # old_path is always None.
+ entry = self._get_entry(0, path_utf8=new_path)
+ if entry[0] is not None and entry[0][2] != file_id:
+ # Something does exist at that path in tree0, but it is
+ # with a different file_id
+ entry = (None, None)
+ if entry[0] is None:
# entry_key (dirname, basename, file_id) doesn't exist in any
# tree yet, so we need to create a new record.
dirname, basename = osutils.split(new_path)
More information about the bazaar-commits
mailing list