# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1376058682 -7200 # Node ID e31c288e5059bebfdc133300d82af8a0f1419445 # Parent b95fa72c74aea83fafe956fd72e60b0f10b064a6 svnwrap: allow overwriting directories in one revision If replacing a directory at one path with a copy from somewhere else, we need to first delete the old, and then create the new. Otherwise, Subversion will bail with an error. This could happen when moving a tag; in that case, we need to delete the original tag and set the new one in the same revision. diff --git a/hgsubversion/svnwrap/subvertpy_wrapper.py b/hgsubversion/svnwrap/subvertpy_wrapper.py --- a/hgsubversion/svnwrap/subvertpy_wrapper.py +++ b/hgsubversion/svnwrap/subvertpy_wrapper.py @@ -464,15 +464,17 @@ class SubversionRepo(object): else: # visiting a directory + if path in deleteddirs: + direditor = editor.delete_entry(path, base_revision) + + if path not in addeddirs: + continue + if path in addeddirs: frompath, fromrev = copies.get(path, (None, -1)) if frompath: frompath = self.path2url(frompath) direditor = editor.add_directory(path, frompath, fromrev) - - elif path in deleteddirs: - direditor = editor.delete_entry(path, base_revision) - continue else: direditor = editor.open_directory(path) diff --git a/hgsubversion/svnwrap/svn_swig_wrapper.py b/hgsubversion/svnwrap/svn_swig_wrapper.py --- a/hgsubversion/svnwrap/svn_swig_wrapper.py +++ b/hgsubversion/svnwrap/svn_swig_wrapper.py @@ -417,7 +417,10 @@ class SubversionRepo(object): if path in deleteddirs: bat = editor.delete_entry(path, base_revision, parent, pool) batons.append(bat) - return bat + + if path not in addeddirs: + return bat + if path not in file_data: if path in addeddirs: frompath, fromrev = copies.get(path, (None, -1))