Mercurial patch for CVS import
Ralf Leibold
Ralf.Leibold at nuance.com
Mon Jul 30 09:00:05 CDT 2007
Hi,
First I want to thank you for this great VCS. I really enjoy working
with it.
I will send you three patches I found useful when working with
Mercurial. [As discussed with Matt last week I send this to this mailing
list.] Here is the first one:
I found a bug importing from CVS. The $HOME/.cvspass-file has a second
format which is
/1 :pserver:<user>@<host>:<port><CVSROOT-dir> <password>
So there are 3 columns and the second column is slightly ordered
differently. I patched hgext/convert/cvs.py. At the end of this mail you
will find the patch done with "export"-command versus version
"5026:48ebd6a83994" of http://selenic.com/repo/hg.
Thanks again for your great work.
Ralf
# HG changeset patch
# User leibold at AC-Fairway.eu.scansoft.com
# Date 1185801929 -7200
# Branch FixCVS
# Node ID 8be016ddc8bd9c97930b3b9dd1868270e8c675aa
# Parent 48ebd6a8399480a889410a130d98e6bf342bc3ca
CVS import: Support other .cvspass-file format.
diff -r 48ebd6a83994 -r 8be016ddc8bd hgext/convert/cvs.py
--- a/hgext/convert/cvs.py Sat Jul 28 20:15:54 2007 +0200
+++ b/hgext/convert/cvs.py Mon Jul 30 15:25:29 2007 +0200
@@ -116,6 +116,7 @@ class convert_cvs(converter_source):
self.ui.status("connecting to %s\n" % root)
if root.startswith(":pserver:"):
+ cmd = ['cvs -z9', 'server']
root = root[9:]
m =
re.match(r'(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?(.*)',
root)
@@ -132,7 +133,6 @@ class convert_cvs(converter_source):
rr += str(port)
if not passw:
- passw = "A"
pf = open(os.path.join(os.environ["HOME"],
".cvspass"))
for l in pf:
# :pserver:cvs at mea.tmt.tele.fi:/cvsroot/zmailer
Ah<Z
@@ -143,6 +143,25 @@ class convert_cvs(converter_source):
passw = p
break
pf.close()
+ if not passw:
+ passw = "A"
+ rr = ":pserver:" + user + "@" + serv + ":"
+ if port:
+ rr2, port = "-", int(port)
+ else:
+ rr2, port = rr + root, 2401
+ rr += str(port) + root
+
+ pf = open(os.path.join(os.environ["HOME"],
".cvspass"))
+ for l in pf:
+ # /1
:pserver:cvs at mea.tmt.tele.fi:2401/cvsroot/zmailer Ah<Z
+ m = re.match(r'(/\d+\s+/)?(.*)', l)
+ l = m.group(2)
+ dummy, w, p = l.split(' ', 2)
+ if w in [rr, rr2]:
+ passw = p
+ break
+ pf.close()
sck = socket.socket()
sck.connect((serv, port))
More information about the Mercurial-devel
mailing list