Show More
@@ -1,81 +1,100 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | 3 | hg init a |
|
4 | mkdir a/d1 | |
|
5 | mkdir a/d1/d2 | |
|
4 | 6 | echo line 1 > a/a |
|
7 | echo line 1 > a/d1/d2/a | |
|
5 | 8 | hg --cwd a ci -d '0 0' -Ama |
|
6 | 9 | |
|
7 | 10 | echo line 2 >> a/a |
|
8 | 11 | hg --cwd a ci -u someone -d '1 0' -m'second change' |
|
9 | 12 | |
|
10 | 13 | echo % import exported patch |
|
11 | 14 | hg clone -r0 a b |
|
12 | 15 | hg --cwd a export tip > tip.patch |
|
13 | 16 | hg --cwd b import ../tip.patch |
|
14 | 17 | echo % message should be same |
|
15 | 18 | hg --cwd b tip | grep 'second change' |
|
16 | 19 | echo % committer should be same |
|
17 | 20 | hg --cwd b tip | grep someone |
|
18 | 21 | rm -rf b |
|
19 | 22 | |
|
20 | 23 | echo % import of plain diff should fail without message |
|
21 | 24 | hg clone -r0 a b |
|
22 | 25 | hg --cwd a diff -r0:1 > tip.patch |
|
23 | 26 | hg --cwd b import ../tip.patch |
|
24 | 27 | rm -rf b |
|
25 | 28 | |
|
26 | 29 | echo % import of plain diff should be ok with message |
|
27 | 30 | hg clone -r0 a b |
|
28 | 31 | hg --cwd a diff -r0:1 > tip.patch |
|
29 | 32 | hg --cwd b import -mpatch ../tip.patch |
|
30 | 33 | rm -rf b |
|
31 | 34 | |
|
32 | 35 | echo % import from stdin |
|
33 | 36 | hg clone -r0 a b |
|
34 | 37 | hg --cwd a export tip | hg --cwd b import - |
|
35 | 38 | rm -rf b |
|
36 | 39 | |
|
37 | 40 | echo % override commit message |
|
38 | 41 | hg clone -r0 a b |
|
39 | 42 | hg --cwd a export tip | hg --cwd b import -m 'override' - |
|
40 | 43 | hg --cwd b tip | grep override |
|
41 | 44 | rm -rf b |
|
42 | 45 | |
|
43 | 46 | cat > mkmsg.py <<EOF |
|
44 | 47 | import email.Message, sys |
|
45 | 48 | msg = email.Message.Message() |
|
46 | 49 | msg.set_payload('email commit message\n' + open('tip.patch').read()) |
|
47 | 50 | msg['Subject'] = 'email patch' |
|
48 | 51 | msg['From'] = 'email patcher' |
|
49 | 52 | sys.stdout.write(msg.as_string()) |
|
50 | 53 | EOF |
|
51 | 54 | |
|
52 | 55 | echo % plain diff in email, subject, message body |
|
53 | 56 | hg clone -r0 a b |
|
54 | 57 | hg --cwd a diff -r0:1 > tip.patch |
|
55 | 58 | python mkmsg.py > msg.patch |
|
56 | 59 | hg --cwd b import ../msg.patch |
|
57 | 60 | hg --cwd b tip | grep email |
|
58 | 61 | rm -rf b |
|
59 | 62 | |
|
60 | 63 | echo % plain diff in email, no subject, message body |
|
61 | 64 | hg clone -r0 a b |
|
62 | 65 | grep -v '^Subject:' msg.patch | hg --cwd b import - |
|
63 | 66 | rm -rf b |
|
64 | 67 | |
|
65 | 68 | echo % plain diff in email, subject, no message body |
|
66 | 69 | hg clone -r0 a b |
|
67 | 70 | grep -v '^email ' msg.patch | hg --cwd b import - |
|
68 | 71 | rm -rf b |
|
69 | 72 | |
|
70 | 73 | echo % plain diff in email, no subject, no message body, should fail |
|
71 | 74 | hg clone -r0 a b |
|
72 | 75 | grep -v '^\(Subject\|email\)' msg.patch | hg --cwd b import - |
|
73 | 76 | rm -rf b |
|
74 | 77 | |
|
75 | 78 | echo % hg export in email, should use patch header |
|
76 | 79 | hg clone -r0 a b |
|
77 | 80 | hg --cwd a export tip > tip.patch |
|
78 | 81 | python mkmsg.py | hg --cwd b import - |
|
79 | 82 | hg --cwd b tip | grep second |
|
80 | 83 | rm -rf b |
|
81 | 84 | |
|
85 | # bug non regression test | |
|
86 | # importing a patch in a subdirectory failed at the commit stage | |
|
87 | echo line 2 >> a/d1/d2/a | |
|
88 | hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' | |
|
89 | echo % hg import in a subdirectory | |
|
90 | hg clone -r0 a b | |
|
91 | hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch | |
|
92 | pushd b/d1/d2 2>&1 > /dev/null | |
|
93 | hg import ../../../tip.patch | |
|
94 | popd 2>&1 > /dev/null | |
|
95 | echo "% message should be 'subdir change'" | |
|
96 | hg --cwd b tip | grep 'subdir change' | |
|
97 | echo "% committer should be 'someoneelse'" | |
|
98 | hg --cwd b tip | grep someoneelse | |
|
99 | echo "% should be empty" | |
|
100 | hg --cwd b status |
@@ -1,103 +1,118 b'' | |||
|
1 | 1 | adding a |
|
2 | adding d1/d2/a | |
|
2 | 3 | % import exported patch |
|
3 | 4 | requesting all changes |
|
4 | 5 | adding changesets |
|
5 | 6 | adding manifests |
|
6 | 7 | adding file changes |
|
7 |
added 1 changesets with |
|
|
8 |
|
|
|
8 | added 1 changesets with 2 changes to 2 files | |
|
9 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
9 | 10 | applying ../tip.patch |
|
10 | 11 | patching file a |
|
11 | 12 | % message should be same |
|
12 | 13 | summary: second change |
|
13 | 14 | % committer should be same |
|
14 | 15 | user: someone |
|
15 | 16 | % import of plain diff should fail without message |
|
16 | 17 | requesting all changes |
|
17 | 18 | adding changesets |
|
18 | 19 | adding manifests |
|
19 | 20 | adding file changes |
|
20 |
added 1 changesets with |
|
|
21 |
|
|
|
21 | added 1 changesets with 2 changes to 2 files | |
|
22 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
22 | 23 | applying ../tip.patch |
|
23 | 24 | patching file a |
|
24 | 25 | transaction abort! |
|
25 | 26 | rollback completed |
|
26 | 27 | % import of plain diff should be ok with message |
|
27 | 28 | requesting all changes |
|
28 | 29 | adding changesets |
|
29 | 30 | adding manifests |
|
30 | 31 | adding file changes |
|
31 |
added 1 changesets with |
|
|
32 |
|
|
|
32 | added 1 changesets with 2 changes to 2 files | |
|
33 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
33 | 34 | applying ../tip.patch |
|
34 | 35 | patching file a |
|
35 | 36 | % import from stdin |
|
36 | 37 | requesting all changes |
|
37 | 38 | adding changesets |
|
38 | 39 | adding manifests |
|
39 | 40 | adding file changes |
|
40 |
added 1 changesets with |
|
|
41 |
|
|
|
41 | added 1 changesets with 2 changes to 2 files | |
|
42 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
42 | 43 | applying patch from stdin |
|
43 | 44 | patching file a |
|
44 | 45 | % override commit message |
|
45 | 46 | requesting all changes |
|
46 | 47 | adding changesets |
|
47 | 48 | adding manifests |
|
48 | 49 | adding file changes |
|
49 |
added 1 changesets with |
|
|
50 |
|
|
|
50 | added 1 changesets with 2 changes to 2 files | |
|
51 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
51 | 52 | applying patch from stdin |
|
52 | 53 | patching file a |
|
53 | 54 | summary: override |
|
54 | 55 | % plain diff in email, subject, message body |
|
55 | 56 | requesting all changes |
|
56 | 57 | adding changesets |
|
57 | 58 | adding manifests |
|
58 | 59 | adding file changes |
|
59 |
added 1 changesets with |
|
|
60 |
|
|
|
60 | added 1 changesets with 2 changes to 2 files | |
|
61 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
61 | 62 | applying ../msg.patch |
|
62 | 63 | patching file a |
|
63 | 64 | user: email patcher |
|
64 | 65 | summary: email patch |
|
65 | 66 | % plain diff in email, no subject, message body |
|
66 | 67 | requesting all changes |
|
67 | 68 | adding changesets |
|
68 | 69 | adding manifests |
|
69 | 70 | adding file changes |
|
70 |
added 1 changesets with |
|
|
71 |
|
|
|
71 | added 1 changesets with 2 changes to 2 files | |
|
72 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
72 | 73 | applying patch from stdin |
|
73 | 74 | patching file a |
|
74 | 75 | % plain diff in email, subject, no message body |
|
75 | 76 | requesting all changes |
|
76 | 77 | adding changesets |
|
77 | 78 | adding manifests |
|
78 | 79 | adding file changes |
|
79 |
added 1 changesets with |
|
|
80 |
|
|
|
80 | added 1 changesets with 2 changes to 2 files | |
|
81 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
81 | 82 | applying patch from stdin |
|
82 | 83 | patching file a |
|
83 | 84 | % plain diff in email, no subject, no message body, should fail |
|
84 | 85 | requesting all changes |
|
85 | 86 | adding changesets |
|
86 | 87 | adding manifests |
|
87 | 88 | adding file changes |
|
88 |
added 1 changesets with |
|
|
89 |
|
|
|
89 | added 1 changesets with 2 changes to 2 files | |
|
90 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
90 | 91 | applying patch from stdin |
|
91 | 92 | patching file a |
|
92 | 93 | transaction abort! |
|
93 | 94 | rollback completed |
|
94 | 95 | % hg export in email, should use patch header |
|
95 | 96 | requesting all changes |
|
96 | 97 | adding changesets |
|
97 | 98 | adding manifests |
|
98 | 99 | adding file changes |
|
99 |
added 1 changesets with |
|
|
100 |
|
|
|
100 | added 1 changesets with 2 changes to 2 files | |
|
101 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
101 | 102 | applying patch from stdin |
|
102 | 103 | patching file a |
|
103 | 104 | summary: second change |
|
105 | % hg import in a subdirectory | |
|
106 | requesting all changes | |
|
107 | adding changesets | |
|
108 | adding manifests | |
|
109 | adding file changes | |
|
110 | added 1 changesets with 2 changes to 2 files | |
|
111 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
112 | applying ../../../tip.patch | |
|
113 | patching file a | |
|
114 | % message should be 'subdir change' | |
|
115 | summary: subdir change | |
|
116 | % committer should be 'someoneelse' | |
|
117 | user: someoneelse | |
|
118 | % should be empty |
General Comments 0
You need to be logged in to leave comments.
Login now