[PATCH pushed in crew-stable] convert/svn: handle non-local svn destination paths (issue3142)

Patrick Mezard patrick at mezard.eu
Thu Jul 26 05:34:25 CDT 2012


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1343297275 -7200
# Branch stable
# Node ID 6d51a0c71d4e15a43dcdc123cddcc375b7105c5d
# Parent  bf5bb38bcc7c28f7a355fdfff323aba2018cbb17
convert/svn: handle non-local svn destination paths (issue3142)

test-convert-svn-sink.t still pass and I tested pushing to an svn+ssh
repository

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1020,26 +1020,25 @@
         self.wc = None
         self.cwd = os.getcwd()
 
-        path = os.path.realpath(path)
-
         created = False
         if os.path.isfile(os.path.join(path, '.svn', 'entries')):
-            self.wc = path
+            self.wc = os.path.realpath(path)
             self.run0('update')
         else:
+            if not re.search(r'^(file|http|https|svn|svn\+ssh)\://', path):
+                path = os.path.realpath(path)
+                if os.path.isdir(os.path.dirname(path)):
+                    if not os.path.exists(os.path.join(path, 'db', 'fs-type')):
+                        ui.status(_('initializing svn repository %r\n') %
+                                  os.path.basename(path))
+                        commandline(ui, 'svnadmin').run0('create', path)
+                        created = path
+                    path = util.normpath(path)
+                    if not path.startswith('/'):
+                        path = '/' + path
+                    path = 'file://' + path
+
             wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')
-
-            if os.path.isdir(os.path.dirname(path)):
-                if not os.path.exists(os.path.join(path, 'db', 'fs-type')):
-                    ui.status(_('initializing svn repository %r\n') %
-                              os.path.basename(path))
-                    commandline(ui, 'svnadmin').run0('create', path)
-                    created = path
-                path = util.normpath(path)
-                if not path.startswith('/'):
-                    path = '/' + path
-                path = 'file://' + path
-
             ui.status(_('initializing svn working copy %r\n')
                       % os.path.basename(wcpath))
             self.run0('checkout', path, wcpath)


More information about the Mercurial-devel mailing list