<div dir="ltr"># HG changeset patch<br># User Blesso <a href="mailto:hrvoje1212@gmail.com">hrvoje1212@gmail.com</a><br># Date 1367602499 -7200<br># Branch stable<br># Node ID 2fb5c25951f23acfc22b7aa1054ed0089afea19e<br># Parent 762208a3edabc483936fff7ef4c8e02b25a8fba0<br>
convert: fix bug of wrong CVS path parsing without port number (issue3678)<br><br>The cvsps.py:getrepopath suffers from a string parsing bug (it returns<br>"user@server/path/to/repository" if the CVSROOT is given like this:<br>
":pserver:user@server/path/to/repository" ), which gives returnes the wrong<br>value becouse cvsps.py fails to strip the prefix from filenames.<br>With this patch for the same input we get the correct repo path that is:<br>
"/path/to/repository"<br><br>diff -r 762208a3edab -r 2fb5c25951f2 hgext/convert/cvsps.py<br>--- a/hgext/convert/cvsps.py Wed May 01 17:49:53 2013 -0500<br>+++ b/hgext/convert/cvsps.py Fri May 03 19:34:59 2013 +0200<br>
@@ -50,7 +50,7 @@<br> >>> getrepopath('/foo/bar')<br> '/foo/bar'<br> >>> getrepopath('c:/foo/bar')<br>- 'c:/foo/bar'<br>+ '/foo/bar'<br> >>> getrepopath(':pserver:10/foo/bar')<br>
'/foo/bar'<br> >>> getrepopath(':pserver:10c:/foo/bar')<br>@@ -58,30 +58,31 @@<br> >>> getrepopath(':pserver:/foo/bar')<br> '/foo/bar'<br> >>> getrepopath(':pserver:c:/foo/bar')<br>
- 'c:/foo/bar'<br>+ '/foo/bar'<br> >>> getrepopath(':pserver:truc@foo.bar:/foo/bar')<br> '/foo/bar'<br> >>> getrepopath(':pserver:truc@foo.bar:c:/foo/bar')<br>
- 'c:/foo/bar'<br>+ '/foo/bar'<br>+ >>> getrepopath('user@server/path/to/repository')<br>+ '/path/to/repository'<br> """<br> # According to CVS manual, CVS paths are expressed like:<br>
# [:method:][[user][:password]@]hostname[:[port]]/path/to/repository<br> #<br>- # Unfortunately, Windows absolute paths start with a drive letter<br>- # like 'c:' making it harder to parse. Here we assume that drive<br>
- # letters are only one character long and any CVS component before<br>- # the repository path is at least 2 characters long, and use this<br>- # to disambiguate.<br>+ # CVSpath is splitted into parts and then position of the first occurance<br>
+ # of the '/' char after the '@' is located. The solution is the rest of the<br>+ # string after that '/' sign including it<br>+<br> parts = cvspath.split(':')<br>- if len(parts) == 1:<br>
- return parts[0]<br>- # Here there is an ambiguous case if we have a port number<br>- # immediately followed by a Windows driver letter. We assume this<br>- # never happens and decide it must be CVS path component,<br>
- # therefore ignoring it.<br>- if len(parts[-2]) > 1:<br>- return parts[-1].lstrip('0123456789')<br>- return parts[-2] + ':' + parts[-1]<br>+ atposition = parts[-1].find('@')<br>
+ start = 0<br>+<br>+ if atposition != -1:<br>+ start = atposition<br>+<br>+ repopath = parts[-1][parts[-1].find('/', start):]<br>+ return repopath<br>+<br> <br> def createlog(ui, directory=None, root="", rlog=True, cache=None):<br>
'''Collect the CVS rlog'''<br><br></div>