summaryrefslogtreecommitdiff
path: root/bzr_commit_handler.py
diff options
context:
space:
mode:
authorIan Clatworthy <ian.clatworthy@canonical.com>2009-03-08 17:28:18 +1000
committerIan Clatworthy <ian.clatworthy@canonical.com>2009-03-08 17:28:18 +1000
commit3ec517966d756ca793cb98d04d552afcec561ddb (patch)
tree9ced0d9471da04a34535c3d47d3c67d272a9a55c /bzr_commit_handler.py
parent5ac4324a68f9fbf83935c434b525d9bc39961e6f (diff)
downloadbzr-fastimport-3ec517966d756ca793cb98d04d552afcec561ddb.tar.gz
handle delete of missing files for chk formats
Diffstat (limited to 'bzr_commit_handler.py')
-rw-r--r--bzr_commit_handler.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/bzr_commit_handler.py b/bzr_commit_handler.py
index 093bc98..1207a29 100644
--- a/bzr_commit_handler.py
+++ b/bzr_commit_handler.py
@@ -257,9 +257,12 @@ class GenericCommitHandler(processor.CommitHandler):
def _delete_item(self, path, inv):
file_id = inv.path2id(path)
- #print "**** deleting %s with file-id %s" % (path, file_id)
- ie = inv[file_id]
- self.record_delete(path, ie)
+ try:
+ ie = inv[file_id]
+ except errors.NoSuchId:
+ self.warning("ignoring delete of %s as not in inventory", path)
+ else:
+ self.record_delete(path, ie)
def _copy_item(self, src_path, dest_path, inv):
if not self.parents:
@@ -302,6 +305,14 @@ class GenericCommitHandler(processor.CommitHandler):
for name, root_item in inv.root.children.iteritems():
inv.remove_recursive_id(root_item.file_id)
+ def _warn_unless_in_merges(self, fileid, path):
+ if len(self.parents) <= 1:
+ return
+ for parent in self.parents[1:]:
+ if fileid in self.get_inventory(parent):
+ return
+ self.warning("ignoring delete of %s as not in parent inventories", path)
+
class InventoryCommitHandler(GenericCommitHandler):
"""A CommitHandler that builds and saves Inventory objects."""
@@ -396,14 +407,6 @@ class InventoryCommitHandler(GenericCommitHandler):
except KeyError:
pass
- def _warn_unless_in_merges(self, fileid, path):
- if len(self.parents) <= 1:
- return
- for parent in self.parents[1:]:
- if fileid in self.get_inventory(parent):
- return
- self.warning("ignoring delete of %s as not in parent inventories", path)
-
def modify_handler(self, filecmd):
if filecmd.dataref is not None:
data = self.cache_mgr.fetch_blob(filecmd.dataref)