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