diff options
| author | Ian Clatworthy <ian.clatworthy@canonical.com> | 2009-09-28 01:16:06 +1000 |
|---|---|---|
| committer | Ian Clatworthy <ian.clatworthy@canonical.com> | 2009-09-28 01:16:06 +1000 |
| commit | 9f45aed8065bcfbafca0bb818fabd85b83358d14 (patch) | |
| tree | 7d5fae50b78e292ce843f05a56f1954599190e07 | |
| parent | 3961b0b3b7d08bde1ca3bb1bc6de26d8db647f7c (diff) | |
| parent | 1c848847dc246d58c9c6c43a79782a8960ef828c (diff) | |
| download | python-fastimport-git-9f45aed8065bcfbafca0bb818fabd85b83358d14.tar.gz | |
merge Harry's fix so directories aren't output in plain format
| -rwxr-xr-x | bzr_exporter.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bzr_exporter.py b/bzr_exporter.py index 9628d96..8cff2ab 100755 --- a/bzr_exporter.py +++ b/bzr_exporter.py @@ -378,8 +378,9 @@ class BzrFastExporter(object): file_cmds.append(commands.FileModifyCommand(path, 'symlink', False, None, tree_new.get_symlink_target(id_))) elif kind == 'directory': - file_cmds.append(commands.FileModifyCommand(path, 'directory', - False, None, None)) + if not self.plain_format: + file_cmds.append(commands.FileModifyCommand(path, 'directory', + False, None, None)) else: self.warning("cannot export '%s' of kind %s yet - ignoring" % (path, kind)) @@ -416,8 +417,10 @@ class BzrFastExporter(object): deleted_paths = set([p for p, _, _ in deletes]) for (oldpath, newpath, id_, kind, text_modified, meta_modified) in renames: + emit = kind != 'directory' or not self.plain_format if newpath in deleted_paths: - file_cmds.append(commands.FileDeleteCommand(newpath)) + if emit: + file_cmds.append(commands.FileDeleteCommand(newpath)) deleted_paths.remove(newpath) if (self.is_empty_dir(tree_old, oldpath)): self.note("Skipping empty dir %s in rev %s" % (oldpath, @@ -427,7 +430,8 @@ class BzrFastExporter(object): # revision_id) renamed.append([oldpath, newpath]) old_to_new[oldpath] = newpath - file_cmds.append(commands.FileRenameCommand(oldpath, newpath)) + if emit: + file_cmds.append(commands.FileRenameCommand(oldpath, newpath)) if text_modified or meta_modified: modifies.append((newpath, id_, kind)) @@ -435,6 +439,8 @@ class BzrFastExporter(object): # Note: changes_from() doesn't handle this if kind == 'directory': for p, e in tree_old.inventory.iter_entries_by_dir(from_dir=id_): + if e.kind == 'directory' and self.plain_format: + continue old_child_path = osutils.pathjoin(oldpath, p) new_child_path = osutils.pathjoin(newpath, p) must_be_renamed[old_child_path] = new_child_path @@ -455,6 +461,8 @@ class BzrFastExporter(object): for path, id_, kind in deletes: if path not in deleted_paths: continue + if kind == 'directory' and self.plain_format: + continue #path = self._adjust_path_for_renames(path, renamed, revision_id) file_cmds.append(commands.FileDeleteCommand(path)) return file_cmds, modifies, renamed |
