##// END OF EJS Templates
use our urlopener (proxy handling, etc) instead of urllib
Benoit Boissinot -
r7271:8046f0a0 default
parent child Browse files
Show More
@@ -33,8 +33,8 b' from mercurial.i18n import _'
33 33 from mercurial.node import bin, hex, short
34 34 from mercurial.repo import RepoError
35 35 from mercurial import commands, cmdutil, hg, patch, revlog, util
36 from mercurial import repair, extensions
37 import os, sys, re, errno, urllib
36 from mercurial import repair, extensions, url
37 import os, sys, re, errno
38 38
39 39 commands.norepo += " qclone"
40 40
@@ -1521,10 +1521,7 b' class queue:'
1521 1521 raise util.Abort(_('need --name to import a patch from -'))
1522 1522 text = sys.stdin.read()
1523 1523 else:
1524 if os.path.exists(filename):
1525 text = file(filename, 'rb').read()
1526 else:
1527 text = urllib.urlopen(filename).read()
1524 text = url.open(self.ui, filename).read()
1528 1525 except IOError:
1529 1526 raise util.Abort(_("unable to read %s") % filename)
1530 1527 if not patchname:
@@ -8,7 +8,7 b''
8 8 from node import hex, nullid, nullrev, short
9 9 from repo import RepoError, NoCapability
10 10 from i18n import _, gettext
11 import os, re, sys, urllib
11 import os, re, sys
12 12 import hg, util, revlog, bundlerepo, extensions, copies
13 13 import difflib, patch, time, help, mdiff, tempfile, url
14 14 import version, socket
@@ -1590,13 +1590,11 b' def import_(ui, repo, patch1, *patches, '
1590 1590
1591 1591 if pf == '-':
1592 1592 ui.status(_("applying patch from stdin\n"))
1593 data = patch.extract(ui, sys.stdin)
1593 pf = sys.stdin
1594 1594 else:
1595 1595 ui.status(_("applying %s\n") % p)
1596 if os.path.exists(pf):
1597 data = patch.extract(ui, file(pf, 'rb'))
1598 else:
1599 data = patch.extract(ui, urllib.urlopen(pf))
1596 pf = url.open(ui, pf)
1597 data = patch.extract(ui, pf)
1600 1598 tmpname, message, user, date, branch, nodeid, p1, p2 = data
1601 1599
1602 1600 if tmpname is None:
@@ -2844,10 +2842,7 b' def unbundle(ui, repo, fname1, *fnames, '
2844 2842 try:
2845 2843 lock = repo.lock()
2846 2844 for fname in fnames:
2847 if os.path.exists(fname):
2848 f = open(fname, "rb")
2849 else:
2850 f = urllib.urlopen(fname)
2845 f = url.open(ui, fname)
2851 2846 gen = changegroup.readbundle(f, fname)
2852 2847 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
2853 2848 finally:
1 NO CONTENT: modified file chmod 100755 => 100644
@@ -25,7 +25,7 b' hg init repo'
25 25 cd repo
26 26
27 27 echo % qimport non-existing-file
28 hg qimport non-existing-file
28 hg qimport non-existing-file 2>&1 | sed -e 's/\(No such file or directory:\) .*/\1/'
29 29
30 30 echo % import URL
31 31 echo foo >> foo
@@ -1,5 +1,5 b''
1 1 % qimport non-existing-file
2 abort: unable to read non-existing-file
2 abort: No such file or directory:
3 3 % import URL
4 4 adding url.diff to series file
5 5 url.diff
General Comments 0
You need to be logged in to leave comments. Login now