comparison hgext/convert/subversion.py @ 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 0e4171fdb9d4
children e7cfe3587ea4 17c3dbf3026f
comparison
equal deleted inserted replaced
17246:bf5bb38bcc7c 17247:6d51a0c71d4e
1018 self.delexec = [] 1018 self.delexec = []
1019 self.copies = [] 1019 self.copies = []
1020 self.wc = None 1020 self.wc = None
1021 self.cwd = os.getcwd() 1021 self.cwd = os.getcwd()
1022 1022
1023 path = os.path.realpath(path)
1024
1025 created = False 1023 created = False
1026 if os.path.isfile(os.path.join(path, '.svn', 'entries')): 1024 if os.path.isfile(os.path.join(path, '.svn', 'entries')):
1027 self.wc = path 1025 self.wc = os.path.realpath(path)
1028 self.run0('update') 1026 self.run0('update')
1029 else: 1027 else:
1028 if not re.search(r'^(file|http|https|svn|svn\+ssh)\://', path):
1029 path = os.path.realpath(path)
1030 if os.path.isdir(os.path.dirname(path)):
1031 if not os.path.exists(os.path.join(path, 'db', 'fs-type')):
1032 ui.status(_('initializing svn repository %r\n') %
1033 os.path.basename(path))
1034 commandline(ui, 'svnadmin').run0('create', path)
1035 created = path
1036 path = util.normpath(path)
1037 if not path.startswith('/'):
1038 path = '/' + path
1039 path = 'file://' + path
1040
1030 wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc') 1041 wcpath = os.path.join(os.getcwd(), os.path.basename(path) + '-wc')
1031
1032 if os.path.isdir(os.path.dirname(path)):
1033 if not os.path.exists(os.path.join(path, 'db', 'fs-type')):
1034 ui.status(_('initializing svn repository %r\n') %
1035 os.path.basename(path))
1036 commandline(ui, 'svnadmin').run0('create', path)
1037 created = path
1038 path = util.normpath(path)
1039 if not path.startswith('/'):
1040 path = '/' + path
1041 path = 'file://' + path
1042
1043 ui.status(_('initializing svn working copy %r\n') 1042 ui.status(_('initializing svn working copy %r\n')
1044 % os.path.basename(wcpath)) 1043 % os.path.basename(wcpath))
1045 self.run0('checkout', path, wcpath) 1044 self.run0('checkout', path, wcpath)
1046 1045
1047 self.wc = wcpath 1046 self.wc = wcpath