hgext/convert/cvs.py
changeset 7444 f792c7bb2fb3
parent 7442 a14ce129cfcd
child 7472 9d457bb38de5
child 7513 fed8f75f29ce
--- a/hgext/convert/cvs.py	Fri Nov 28 09:50:30 2008 +0100
+++ b/hgext/convert/cvs.py	Fri Nov 28 11:38:41 2008 +0100
@@ -1,6 +1,6 @@
 # CVS conversion code inspired by hg-cvs-import and git-cvsimport
 
-import os, locale, re, socket
+import os, locale, re, socket, errno
 from cStringIO import StringIO
 from mercurial import util
 from mercurial.i18n import _
@@ -202,7 +202,7 @@
                 if not passw:
                     passw = "A"
                     cvspass = os.path.expanduser("~/.cvspass")
-                    if os.path.exists(cvspass):
+                    try:
                         pf = open(cvspass)
                         for line in pf.read().splitlines():
                             part1, part2 = line.split(' ', 1)
@@ -217,6 +217,11 @@
                                 passw = part2
                                 break
                         pf.close()
+                    except IOError, inst:
+                        if inst.errno != errno.ENOENT:
+                            if not getattr(inst, 'filename', None):
+                                inst.filename = cvspass
+                            raise
 
                 sck = socket.socket()
                 sck.connect((serv, port))