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