##// END OF EJS Templates
convert: fix bug of wrong CVS path parsing without port number (issue3678)...
Blesso -
r19145:0a12e5f3 stable
parent child Browse files
Show More
@@ -50,7 +50,7 b' def getrepopath(cvspath):'
50 >>> getrepopath('/foo/bar')
50 >>> getrepopath('/foo/bar')
51 '/foo/bar'
51 '/foo/bar'
52 >>> getrepopath('c:/foo/bar')
52 >>> getrepopath('c:/foo/bar')
53 'c:/foo/bar'
53 '/foo/bar'
54 >>> getrepopath(':pserver:10/foo/bar')
54 >>> getrepopath(':pserver:10/foo/bar')
55 '/foo/bar'
55 '/foo/bar'
56 >>> getrepopath(':pserver:10c:/foo/bar')
56 >>> getrepopath(':pserver:10c:/foo/bar')
@@ -58,30 +58,30 b' def getrepopath(cvspath):'
58 >>> getrepopath(':pserver:/foo/bar')
58 >>> getrepopath(':pserver:/foo/bar')
59 '/foo/bar'
59 '/foo/bar'
60 >>> getrepopath(':pserver:c:/foo/bar')
60 >>> getrepopath(':pserver:c:/foo/bar')
61 'c:/foo/bar'
61 '/foo/bar'
62 >>> getrepopath(':pserver:truc@foo.bar:/foo/bar')
62 >>> getrepopath(':pserver:truc@foo.bar:/foo/bar')
63 '/foo/bar'
63 '/foo/bar'
64 >>> getrepopath(':pserver:truc@foo.bar:c:/foo/bar')
64 >>> getrepopath(':pserver:truc@foo.bar:c:/foo/bar')
65 'c:/foo/bar'
65 '/foo/bar'
66 >>> getrepopath('user@server/path/to/repository')
67 '/path/to/repository'
66 """
68 """
67 # According to CVS manual, CVS paths are expressed like:
69 # According to CVS manual, CVS paths are expressed like:
68 # [:method:][[user][:password]@]hostname[:[port]]/path/to/repository
70 # [:method:][[user][:password]@]hostname[:[port]]/path/to/repository
69 #
71 #
70 # Unfortunately, Windows absolute paths start with a drive letter
72 # CVSpath is splitted into parts and then position of the first occurrence
71 # like 'c:' making it harder to parse. Here we assume that drive
73 # of the '/' char after the '@' is located. The solution is the rest of the
72 # letters are only one character long and any CVS component before
74 # string after that '/' sign including it
73 # the repository path is at least 2 characters long, and use this
75
74 # to disambiguate.
75 parts = cvspath.split(':')
76 parts = cvspath.split(':')
76 if len(parts) == 1:
77 atposition = parts[-1].find('@')
77 return parts[0]
78 start = 0
78 # Here there is an ambiguous case if we have a port number
79
79 # immediately followed by a Windows driver letter. We assume this
80 if atposition != -1:
80 # never happens and decide it must be CVS path component,
81 start = atposition
81 # therefore ignoring it.
82
82 if len(parts[-2]) > 1:
83 repopath = parts[-1][parts[-1].find('/', start):]
83 return parts[-1].lstrip('0123456789')
84 return repopath
84 return parts[-2] + ':' + parts[-1]
85
85
86 def createlog(ui, directory=None, root="", rlog=True, cache=None):
86 def createlog(ui, directory=None, root="", rlog=True, cache=None):
87 '''Collect the CVS rlog'''
87 '''Collect the CVS rlog'''
General Comments 0
You need to be logged in to leave comments. Login now