##// END OF EJS Templates
mq: let qimport read patches from URLs
Brendan Cully -
r7158:d1d011ac default
parent child Browse files
Show More
@@ -34,7 +34,7 b' from mercurial.node import bin, hex, sho'
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
36 from mercurial import repair
37 import os, sys, re, errno
37 import os, sys, re, errno, urllib
38
38
39 commands.norepo += " qclone"
39 commands.norepo += " qclone"
40
40
@@ -1499,7 +1499,10 b' class queue:'
1499 raise util.Abort(_('need --name to import a patch from -'))
1499 raise util.Abort(_('need --name to import a patch from -'))
1500 text = sys.stdin.read()
1500 text = sys.stdin.read()
1501 else:
1501 else:
1502 text = file(filename, 'rb').read()
1502 if os.path.exists(filename):
1503 text = file(filename, 'rb').read()
1504 else:
1505 text = urllib.urlopen(filename).read()
1503 except IOError:
1506 except IOError:
1504 raise util.Abort(_("unable to read %s") % filename)
1507 raise util.Abort(_("unable to read %s") % filename)
1505 if not patchname:
1508 if not patchname:
@@ -27,6 +27,15 b' cd repo'
27 echo % qimport non-existing-file
27 echo % qimport non-existing-file
28 hg qimport non-existing-file
28 hg qimport non-existing-file
29
29
30 echo % import URL
31 echo foo >> foo
32 hg add foo
33 hg diff > $HGTMP/url.diff
34 hg revert --no-backup foo
35 rm foo
36 hg qimport file://$HGTMP/url.diff
37 hg qun
38
30 echo % build diff with CRLF
39 echo % build diff with CRLF
31 python ../writelines.py b 5 'a\n' 5 'a\r\n'
40 python ../writelines.py b 5 'a\n' 5 'a\r\n'
32 hg ci -Am addb
41 hg ci -Am addb
@@ -1,5 +1,8 b''
1 % qimport non-existing-file
1 % qimport non-existing-file
2 abort: unable to read non-existing-file
2 abort: unable to read non-existing-file
3 % import URL
4 adding url.diff to series file
5 url.diff
3 % build diff with CRLF
6 % build diff with CRLF
4 adding b
7 adding b
5 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now