Show More
@@ -1,65 +1,72 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | cat > writelines.py <<EOF |
|
3 | cat > writelines.py <<EOF | |
4 | import sys |
|
4 | import sys | |
5 | path = sys.argv[1] |
|
5 | path = sys.argv[1] | |
6 | args = sys.argv[2:] |
|
6 | args = sys.argv[2:] | |
7 | assert (len(args) % 2) == 0 |
|
7 | assert (len(args) % 2) == 0 | |
8 |
|
8 | |||
9 | f = file(path, 'wb') |
|
9 | f = file(path, 'wb') | |
10 | for i in xrange(len(args)/2): |
|
10 | for i in xrange(len(args)/2): | |
11 | count, s = args[2*i:2*i+2] |
|
11 | count, s = args[2*i:2*i+2] | |
12 | count = int(count) |
|
12 | count = int(count) | |
13 | s = s.decode('string_escape') |
|
13 | s = s.decode('string_escape') | |
14 | f.write(s*count) |
|
14 | f.write(s*count) | |
15 | f.close() |
|
15 | f.close() | |
16 |
|
16 | |||
17 | EOF |
|
17 | EOF | |
18 |
|
18 | |||
19 | echo "[extensions]" >> $HGRCPATH |
|
19 | echo "[extensions]" >> $HGRCPATH | |
20 | echo "mq=" >> $HGRCPATH |
|
20 | echo "mq=" >> $HGRCPATH | |
21 | echo "[diff]" >> $HGRCPATH |
|
21 | echo "[diff]" >> $HGRCPATH | |
22 | echo "git=1" >> $HGRCPATH |
|
22 | echo "git=1" >> $HGRCPATH | |
23 |
|
23 | |||
24 | hg init repo |
|
24 | 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 | |
29 |
|
29 | |||
30 | echo % import URL |
|
30 | echo % import URL | |
31 | echo foo >> foo |
|
31 | echo foo >> foo | |
32 | hg add foo |
|
32 | hg add foo | |
33 | hg diff > $HGTMP/url.diff |
|
33 | hg diff > $HGTMP/url.diff | |
34 | hg revert --no-backup foo |
|
34 | hg revert --no-backup foo | |
35 | rm foo |
|
35 | rm foo | |
36 | hg qimport file://$HGTMP/url.diff |
|
36 | # Under unix: file:///foobar/blah | |
|
37 | # Under windows: file:///c:/foobar/blah | |||
|
38 | patchurl=`echo $HGTMP/url.diff | tr '\\' /` | |||
|
39 | expr $patchurl : "\/" > /dev/null | |||
|
40 | if [ $? -ne 0 ]; then | |||
|
41 | patchurl='/'$patchurl | |||
|
42 | fi | |||
|
43 | hg qimport file://$patchurl | |||
37 | hg qun |
|
44 | hg qun | |
38 |
|
45 | |||
39 | echo % import patch that already exists |
|
46 | echo % import patch that already exists | |
40 | echo foo2 >> foo |
|
47 | echo foo2 >> foo | |
41 | hg add foo |
|
48 | hg add foo | |
42 | hg diff > ../url.diff |
|
49 | hg diff > ../url.diff | |
43 | hg revert --no-backup foo |
|
50 | hg revert --no-backup foo | |
44 | rm foo |
|
51 | rm foo | |
45 | hg qimport ../url.diff |
|
52 | hg qimport ../url.diff | |
46 | hg qpush |
|
53 | hg qpush | |
47 | cat foo |
|
54 | cat foo | |
48 | hg qpop |
|
55 | hg qpop | |
49 | echo % qimport -f |
|
56 | echo % qimport -f | |
50 | hg qimport -f ../url.diff |
|
57 | hg qimport -f ../url.diff | |
51 | hg qpush |
|
58 | hg qpush | |
52 | cat foo |
|
59 | cat foo | |
53 | hg qpop |
|
60 | hg qpop | |
54 |
|
61 | |||
55 | echo % build diff with CRLF |
|
62 | echo % build diff with CRLF | |
56 | python ../writelines.py b 5 'a\n' 5 'a\r\n' |
|
63 | python ../writelines.py b 5 'a\n' 5 'a\r\n' | |
57 | hg ci -Am addb |
|
64 | hg ci -Am addb | |
58 | python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n' |
|
65 | python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n' | |
59 | hg diff > b.diff |
|
66 | hg diff > b.diff | |
60 | hg up -C |
|
67 | hg up -C | |
61 | echo % qimport CRLF diff |
|
68 | echo % qimport CRLF diff | |
62 | hg qimport b.diff |
|
69 | hg qimport b.diff | |
63 | hg qpush |
|
70 | hg qpush | |
64 |
|
71 | |||
65 |
|
72 |
General Comments 0
You need to be logged in to leave comments.
Login now