hgext/mq.py
changeset 7271 8046f0a070a6
parent 7216 292fb2ad2846
child 7280 810ca383da9c
--- a/hgext/mq.py	Mon Oct 27 21:50:01 2008 +0100
+++ b/hgext/mq.py	Mon Oct 27 21:50:16 2008 +0100
@@ -33,8 +33,8 @@
 from mercurial.node import bin, hex, short
 from mercurial.repo import RepoError
 from mercurial import commands, cmdutil, hg, patch, revlog, util
-from mercurial import repair, extensions
-import os, sys, re, errno, urllib
+from mercurial import repair, extensions, url
+import os, sys, re, errno
 
 commands.norepo += " qclone"
 
@@ -1521,10 +1521,7 @@
                             raise util.Abort(_('need --name to import a patch from -'))
                         text = sys.stdin.read()
                     else:
-                        if os.path.exists(filename):
-                            text = file(filename, 'rb').read()
-                        else:
-                            text = urllib.urlopen(filename).read()
+                        text = url.open(self.ui, filename).read()
                 except IOError:
                     raise util.Abort(_("unable to read %s") % filename)
                 if not patchname: