##// END OF EJS Templates
mq: qimport must read patches in binary mode
Patrick Mezard -
r6027:cee68264 default
parent child Browse files
Show More
@@ -0,0 +1,36 b''
1 #!/bin/sh
2
3 cat > writelines.py <<EOF
4 import sys
5 path = sys.argv[1]
6 args = sys.argv[2:]
7 assert (len(args) % 2) == 0
8
9 f = file(path, 'wb')
10 for i in xrange(len(args)/2):
11 count, s = args[2*i:2*i+2]
12 count = int(count)
13 s = s.decode('string_escape')
14 f.write(s*count)
15 f.close()
16
17 EOF
18
19 echo "[extensions]" >> $HGRCPATH
20 echo "mq=" >> $HGRCPATH
21 echo "[diff]" >> $HGRCPATH
22 echo "git=1" >> $HGRCPATH
23
24 echo % build diff with CRLF
25 hg init repo
26 cd repo
27 python ../writelines.py b 5 'a\n' 5 'a\r\n'
28 hg ci -Am addb
29 python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
30 hg diff > b.diff
31 hg up -C
32 echo % qimport CRLF diff
33 hg qimport b.diff
34 hg qpush
35
36
@@ -0,0 +1,7 b''
1 % build diff with CRLF
2 adding b
3 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4 % qimport CRLF diff
5 adding b.diff to series file
6 applying b.diff
7 Now at: b.diff
@@ -1414,7 +1414,7 b' class queue:'
1414 raise util.Abort(_('need --name to import a patch from -'))
1414 raise util.Abort(_('need --name to import a patch from -'))
1415 text = sys.stdin.read()
1415 text = sys.stdin.read()
1416 else:
1416 else:
1417 text = file(filename).read()
1417 text = file(filename, 'rb').read()
1418 except IOError:
1418 except IOError:
1419 raise util.Abort(_("unable to read %s") % patchname)
1419 raise util.Abort(_("unable to read %s") % patchname)
1420 if not patchname:
1420 if not patchname:
General Comments 0
You need to be logged in to leave comments. Login now