|
1 #!/bin/sh |
|
2 |
|
3 hg init a |
|
4 echo line 1 > a/a |
|
5 hg --cwd a ci -d '0 0' -Ama |
|
6 |
|
7 echo line 2 >> a/a |
|
8 hg --cwd a ci -u someone -d '1 0' -m'second change' |
|
9 |
|
10 echo % import exported patch |
|
11 hg clone -r0 a b |
|
12 hg --cwd a export tip > tip.patch |
|
13 hg --cwd b import ../tip.patch |
|
14 echo % message should be same |
|
15 hg --cwd b tip | grep 'second change' |
|
16 echo % committer should be same |
|
17 hg --cwd b tip | grep someone |
|
18 rm -rf b |
|
19 |
|
20 echo % import of plain diff should fail without message |
|
21 hg clone -r0 a b |
|
22 hg --cwd a diff -r0:1 > tip.patch |
|
23 hg --cwd b import ../tip.patch |
|
24 rm -rf b |
|
25 |
|
26 echo % import of plain diff should be ok with message |
|
27 hg clone -r0 a b |
|
28 hg --cwd a diff -r0:1 > tip.patch |
|
29 hg --cwd b import -mpatch ../tip.patch |
|
30 rm -rf b |
|
31 |
|
32 echo % import from stdin |
|
33 hg clone -r0 a b |
|
34 hg --cwd a export tip | hg --cwd b import - |
|
35 rm -rf b |
|
36 |
|
37 echo % override commit message |
|
38 hg clone -r0 a b |
|
39 hg --cwd a export tip | hg --cwd b import -m 'override' - |
|
40 hg --cwd b tip | grep override |
|
41 rm -rf b |
|
42 |
|
43 cat > mkmsg.py <<EOF |
|
44 import email.Message, sys |
|
45 msg = email.Message.Message() |
|
46 msg.set_payload('email commit message\n' + open('tip.patch').read()) |
|
47 msg['Subject'] = 'email patch' |
|
48 msg['From'] = 'email patcher' |
|
49 sys.stdout.write(msg.as_string()) |
|
50 EOF |
|
51 |
|
52 echo % plain diff in email, subject, message body |
|
53 hg clone -r0 a b |
|
54 hg --cwd a diff -r0:1 > tip.patch |
|
55 python mkmsg.py > msg.patch |
|
56 hg --cwd b import ../msg.patch |
|
57 hg --cwd b tip | grep email |
|
58 rm -rf b |
|
59 |
|
60 echo % plain diff in email, no subject, message body |
|
61 hg clone -r0 a b |
|
62 grep -v '^Subject:' msg.patch | hg --cwd b import - |
|
63 rm -rf b |
|
64 |
|
65 echo % plain diff in email, subject, no message body |
|
66 hg clone -r0 a b |
|
67 grep -v '^email ' msg.patch | hg --cwd b import - |
|
68 rm -rf b |
|
69 |
|
70 echo % plain diff in email, no subject, no message body, should fail |
|
71 hg clone -r0 a b |
|
72 grep -v '^\(Subject\|email\)' msg.patch | hg --cwd b import - |
|
73 rm -rf b |
|
74 |
|
75 echo % hg export in email, should use patch header |
|
76 hg clone -r0 a b |
|
77 hg --cwd a export tip > tip.patch |
|
78 python mkmsg.py | hg --cwd b import - |
|
79 hg --cwd b tip | grep second |
|
80 rm -rf b |
|
81 |