changeset 17247:6d51a0c71d4e stable

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
author Patrick Mezard <patrick@mezard.eu>
date Thu, 26 Jul 2012 12:07:55 +0200
parents bf5bb38bcc7c
children 6ffb35b2284c
files hgext/convert/subversion.py
diffstat 1 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Wed Jul 25 16:50:22 2012 +0200
+++ b/hgext/convert/subversion.py	Thu Jul 26 12:07:55 2012 +0200
@@ -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:
-            wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')
+            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
 
-            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')
             ui.status(_('initializing svn working copy %r\n')
                       % os.path.basename(wcpath))
             self.run0('checkout', path, wcpath)