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