changeset 1460:e31c288e5059

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.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 09 Aug 2013 16:31:22 +0200
parents b95fa72c74ae
children cbc48ed3b56c
files hgsubversion/svnwrap/subvertpy_wrapper.py hgsubversion/svnwrap/svn_swig_wrapper.py
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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)
 
--- 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))