summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-05-31 12:14:12 +0100
committerJelmer Vernooij <jelmer@samba.org>2011-05-31 12:14:12 +0100
commitaf26d9ac55f8ebb084a2f595927f0e367851df21 (patch)
tree29e8741342723cf0a73bdf4a6969c4aa9e4b31aa
parentc2c4d4aff42910e779855e755cff8e5f681de0d9 (diff)
downloadbzr-fastimport-af26d9ac55f8ebb084a2f595927f0e367851df21.tar.gz
Avoid Inventory.copy, which has disappeared in newer versions of Bazaar.
-rw-r--r--NEWS3
-rw-r--r--bzr_commit_handler.py13
2 files changed, 9 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 5c44938..2c21aef 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,9 @@ Bug fixes
* Setup.py no longer relies on bzrlib. (Jelmer Vernooij, #735201)
+* Avoid Inventory.copy, which has disappeared in newer versions of Bazaar.
+ (Jelmer Vernooij, #485788)
+
0.10 08-Mar-2011
Changes
diff --git a/bzr_commit_handler.py b/bzr_commit_handler.py
index da0fe26..b9b65de 100644
--- a/bzr_commit_handler.py
+++ b/bzr_commit_handler.py
@@ -44,14 +44,13 @@ from bzrlib.plugins.fastimport.helpers import (
_serializer_handles_escaping = hasattr(serializer.Serializer,
'squashes_xml_invalid_characters')
-def copy_inventory(inv):
- # This currently breaks revision-id matching
- #if hasattr(inv, "_get_mutable_inventory"):
- # # TODO: Make this a public API on inventory
- # return inv._get_mutable_inventory()
- # TODO: Shallow copy - deep inventory copying is expensive
- return inv.copy()
+def copy_inventory(inv):
+ entries = inv.iter_entries_by_dir()
+ inv = inventory.Inventory(None, inventory.revision_id)
+ for path, inv_entry in entries:
+ inv.add(inv_entry.copy())
+ return inv
class GenericCommitHandler(processor.CommitHandler):