diff options
author | Pieter de Bie <pdebie@ai.rug.nl> | 2008-10-24 13:19:59 +0200 |
---|---|---|
committer | Pieter de Bie <pdebie@ai.rug.nl> | 2008-10-24 13:19:59 +0200 |
commit | 74b9476f35e51a8837ad7eafe856f7c322976455 (patch) | |
tree | 56060fdde1189d38fa899fa36c2e5d4c260ec978 /exporters | |
parent | f9c1b3fb46222ae637ea8c864a939f7bc64f5292 (diff) | |
download | bzr-fastimport-74b9476f35e51a8837ad7eafe856f7c322976455.tar.gz |
Fix Renames + Deletions
In ian.clatworthy@canonical.com-20080923031328-cpwtfak2i4kw6cn7 a fix was
added for moves + renames. However, this fix was incorrect and broke renames
and deletions. This fixes the moves + renames in the correct so that the
deletions also work as they should.
Diffstat (limited to 'exporters')
-rwxr-xr-x | exporters/bzr-fast-export.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/exporters/bzr-fast-export.py b/exporters/bzr-fast-export.py index ee420d5..fd2753b 100755 --- a/exporters/bzr-fast-export.py +++ b/exporters/bzr-fast-export.py @@ -193,13 +193,6 @@ class BzrFastExporter: # make "modified" have 3-tuples, as added does my_modified = [ x[0:3] for x in changes.modified ] - for path, id_, kind in changes.removed: - sys.stdout.write('D %s\n' % (self.my_quote(path),)) - - for path, id_, kind1, kind2 in changes.kind_changed: - sys.stdout.write('D %s\n' % (self.my_quote(path),)) - my_modified.append((path, id_, kind2)) - # We have to keep track of previous renames in this commit renamed = [] for (oldpath, newpath, id_, kind, @@ -223,6 +216,17 @@ class BzrFastExporter: if text_modified or meta_modified: my_modified.append((newpath, id_, kind)) + for path, id_, kind in changes.removed: + for old, new in renamed: + path = path.replace(old + "/", new + "/") + sys.stdout.write('D %s\n' % (self.my_quote(path),)) + + for path, id_, kind1, kind2 in changes.kind_changed: + for old, new in renamed: + path = path.replace(old + "/", new + "/") + sys.stdout.write('D %s\n' % (self.my_quote(path),)) + my_modified.append((path, id_, kind2)) + for path, id_, kind in changes.added + my_modified: if kind in ('file', 'symlink'): entry = tree_new.inventory[id_] |