Mercurial > hgsubversion
diff hgsubversion/editor.py @ 1232:ba8485b9fee0
editor: correctly import copies of directories from non-tracked or closed branches
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Sun, 17 Nov 2013 09:57:00 -0800 |
parents | c6f7a8cfeca9 |
children | 0d0132cba155 |
line wrap: on
line diff
--- a/hgsubversion/editor.py +++ b/hgsubversion/editor.py @@ -239,6 +239,13 @@ class HgEditor(svnwrap.Editor): else: # Resolve missing directories content immediately so the # missing files maybe processed by delete actions. + # we remove the missing directory entries to deal with the case + # where a directory is replaced from e.g. a closed branch + # this will show up as a delete and then a copy + # we process deletes after missing, so we can handle a directory + # copy plus delete of file in that directory. This means that we + # need to be sure that only things whose final disposition is + # deletion remain in self._deleted at the end of the editing process. rev = self.current.rev.revnum path = path + '/' parentdir = path[len(root):] @@ -248,6 +255,7 @@ class HgEditor(svnwrap.Editor): f = parentdir + f if not self.meta.is_path_valid(f, False): continue + self._deleted.discard(f) self._missing.add(f) @svnwrap.ieditor @@ -431,7 +439,7 @@ class HgEditor(svnwrap.Editor): source_rev = copyfrom_revision frompath, source_branch = self.meta.split_branch_path(copyfrom_path)[:2] new_hash = self.meta.get_parent_revision(source_rev + 1, source_branch, True) - if new_hash == node.nullid: + if frompath is None or new_hash == node.nullid: self.addmissing(path, isdir=True) return baton fromctx = self._getctx(new_hash)