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