##// END OF EJS Templates
Import say a file is not tracked after patching : test case
"Mathieu Clabaut " -
r2773:871ca5b9 default
parent child Browse files
Show More
@@ -1,81 +1,100 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 hg init a
3 hg init a
4 mkdir a/d1
5 mkdir a/d1/d2
4 echo line 1 > a/a
6 echo line 1 > a/a
7 echo line 1 > a/d1/d2/a
5 hg --cwd a ci -d '0 0' -Ama
8 hg --cwd a ci -d '0 0' -Ama
6
9
7 echo line 2 >> a/a
10 echo line 2 >> a/a
8 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'
9
12
10 echo % import exported patch
13 echo % import exported patch
11 hg clone -r0 a b
14 hg clone -r0 a b
12 hg --cwd a export tip > tip.patch
15 hg --cwd a export tip > tip.patch
13 hg --cwd b import ../tip.patch
16 hg --cwd b import ../tip.patch
14 echo % message should be same
17 echo % message should be same
15 hg --cwd b tip | grep 'second change'
18 hg --cwd b tip | grep 'second change'
16 echo % committer should be same
19 echo % committer should be same
17 hg --cwd b tip | grep someone
20 hg --cwd b tip | grep someone
18 rm -rf b
21 rm -rf b
19
22
20 echo % import of plain diff should fail without message
23 echo % import of plain diff should fail without message
21 hg clone -r0 a b
24 hg clone -r0 a b
22 hg --cwd a diff -r0:1 > tip.patch
25 hg --cwd a diff -r0:1 > tip.patch
23 hg --cwd b import ../tip.patch
26 hg --cwd b import ../tip.patch
24 rm -rf b
27 rm -rf b
25
28
26 echo % import of plain diff should be ok with message
29 echo % import of plain diff should be ok with message
27 hg clone -r0 a b
30 hg clone -r0 a b
28 hg --cwd a diff -r0:1 > tip.patch
31 hg --cwd a diff -r0:1 > tip.patch
29 hg --cwd b import -mpatch ../tip.patch
32 hg --cwd b import -mpatch ../tip.patch
30 rm -rf b
33 rm -rf b
31
34
32 echo % import from stdin
35 echo % import from stdin
33 hg clone -r0 a b
36 hg clone -r0 a b
34 hg --cwd a export tip | hg --cwd b import -
37 hg --cwd a export tip | hg --cwd b import -
35 rm -rf b
38 rm -rf b
36
39
37 echo % override commit message
40 echo % override commit message
38 hg clone -r0 a b
41 hg clone -r0 a b
39 hg --cwd a export tip | hg --cwd b import -m 'override' -
42 hg --cwd a export tip | hg --cwd b import -m 'override' -
40 hg --cwd b tip | grep override
43 hg --cwd b tip | grep override
41 rm -rf b
44 rm -rf b
42
45
43 cat > mkmsg.py <<EOF
46 cat > mkmsg.py <<EOF
44 import email.Message, sys
47 import email.Message, sys
45 msg = email.Message.Message()
48 msg = email.Message.Message()
46 msg.set_payload('email commit message\n' + open('tip.patch').read())
49 msg.set_payload('email commit message\n' + open('tip.patch').read())
47 msg['Subject'] = 'email patch'
50 msg['Subject'] = 'email patch'
48 msg['From'] = 'email patcher'
51 msg['From'] = 'email patcher'
49 sys.stdout.write(msg.as_string())
52 sys.stdout.write(msg.as_string())
50 EOF
53 EOF
51
54
52 echo % plain diff in email, subject, message body
55 echo % plain diff in email, subject, message body
53 hg clone -r0 a b
56 hg clone -r0 a b
54 hg --cwd a diff -r0:1 > tip.patch
57 hg --cwd a diff -r0:1 > tip.patch
55 python mkmsg.py > msg.patch
58 python mkmsg.py > msg.patch
56 hg --cwd b import ../msg.patch
59 hg --cwd b import ../msg.patch
57 hg --cwd b tip | grep email
60 hg --cwd b tip | grep email
58 rm -rf b
61 rm -rf b
59
62
60 echo % plain diff in email, no subject, message body
63 echo % plain diff in email, no subject, message body
61 hg clone -r0 a b
64 hg clone -r0 a b
62 grep -v '^Subject:' msg.patch | hg --cwd b import -
65 grep -v '^Subject:' msg.patch | hg --cwd b import -
63 rm -rf b
66 rm -rf b
64
67
65 echo % plain diff in email, subject, no message body
68 echo % plain diff in email, subject, no message body
66 hg clone -r0 a b
69 hg clone -r0 a b
67 grep -v '^email ' msg.patch | hg --cwd b import -
70 grep -v '^email ' msg.patch | hg --cwd b import -
68 rm -rf b
71 rm -rf b
69
72
70 echo % plain diff in email, no subject, no message body, should fail
73 echo % plain diff in email, no subject, no message body, should fail
71 hg clone -r0 a b
74 hg clone -r0 a b
72 grep -v '^\(Subject\|email\)' msg.patch | hg --cwd b import -
75 grep -v '^\(Subject\|email\)' msg.patch | hg --cwd b import -
73 rm -rf b
76 rm -rf b
74
77
75 echo % hg export in email, should use patch header
78 echo % hg export in email, should use patch header
76 hg clone -r0 a b
79 hg clone -r0 a b
77 hg --cwd a export tip > tip.patch
80 hg --cwd a export tip > tip.patch
78 python mkmsg.py | hg --cwd b import -
81 python mkmsg.py | hg --cwd b import -
79 hg --cwd b tip | grep second
82 hg --cwd b tip | grep second
80 rm -rf b
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 adding a
1 adding a
2 adding d1/d2/a
2 % import exported patch
3 % import exported patch
3 requesting all changes
4 requesting all changes
4 adding changesets
5 adding changesets
5 adding manifests
6 adding manifests
6 adding file changes
7 adding file changes
7 added 1 changesets with 1 changes to 1 files
8 added 1 changesets with 2 changes to 2 files
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 applying ../tip.patch
10 applying ../tip.patch
10 patching file a
11 patching file a
11 % message should be same
12 % message should be same
12 summary: second change
13 summary: second change
13 % committer should be same
14 % committer should be same
14 user: someone
15 user: someone
15 % import of plain diff should fail without message
16 % import of plain diff should fail without message
16 requesting all changes
17 requesting all changes
17 adding changesets
18 adding changesets
18 adding manifests
19 adding manifests
19 adding file changes
20 adding file changes
20 added 1 changesets with 1 changes to 1 files
21 added 1 changesets with 2 changes to 2 files
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 applying ../tip.patch
23 applying ../tip.patch
23 patching file a
24 patching file a
24 transaction abort!
25 transaction abort!
25 rollback completed
26 rollback completed
26 % import of plain diff should be ok with message
27 % import of plain diff should be ok with message
27 requesting all changes
28 requesting all changes
28 adding changesets
29 adding changesets
29 adding manifests
30 adding manifests
30 adding file changes
31 adding file changes
31 added 1 changesets with 1 changes to 1 files
32 added 1 changesets with 2 changes to 2 files
32 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 applying ../tip.patch
34 applying ../tip.patch
34 patching file a
35 patching file a
35 % import from stdin
36 % import from stdin
36 requesting all changes
37 requesting all changes
37 adding changesets
38 adding changesets
38 adding manifests
39 adding manifests
39 adding file changes
40 adding file changes
40 added 1 changesets with 1 changes to 1 files
41 added 1 changesets with 2 changes to 2 files
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 applying patch from stdin
43 applying patch from stdin
43 patching file a
44 patching file a
44 % override commit message
45 % override commit message
45 requesting all changes
46 requesting all changes
46 adding changesets
47 adding changesets
47 adding manifests
48 adding manifests
48 adding file changes
49 adding file changes
49 added 1 changesets with 1 changes to 1 files
50 added 1 changesets with 2 changes to 2 files
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 applying patch from stdin
52 applying patch from stdin
52 patching file a
53 patching file a
53 summary: override
54 summary: override
54 % plain diff in email, subject, message body
55 % plain diff in email, subject, message body
55 requesting all changes
56 requesting all changes
56 adding changesets
57 adding changesets
57 adding manifests
58 adding manifests
58 adding file changes
59 adding file changes
59 added 1 changesets with 1 changes to 1 files
60 added 1 changesets with 2 changes to 2 files
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 applying ../msg.patch
62 applying ../msg.patch
62 patching file a
63 patching file a
63 user: email patcher
64 user: email patcher
64 summary: email patch
65 summary: email patch
65 % plain diff in email, no subject, message body
66 % plain diff in email, no subject, message body
66 requesting all changes
67 requesting all changes
67 adding changesets
68 adding changesets
68 adding manifests
69 adding manifests
69 adding file changes
70 adding file changes
70 added 1 changesets with 1 changes to 1 files
71 added 1 changesets with 2 changes to 2 files
71 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 applying patch from stdin
73 applying patch from stdin
73 patching file a
74 patching file a
74 % plain diff in email, subject, no message body
75 % plain diff in email, subject, no message body
75 requesting all changes
76 requesting all changes
76 adding changesets
77 adding changesets
77 adding manifests
78 adding manifests
78 adding file changes
79 adding file changes
79 added 1 changesets with 1 changes to 1 files
80 added 1 changesets with 2 changes to 2 files
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 applying patch from stdin
82 applying patch from stdin
82 patching file a
83 patching file a
83 % plain diff in email, no subject, no message body, should fail
84 % plain diff in email, no subject, no message body, should fail
84 requesting all changes
85 requesting all changes
85 adding changesets
86 adding changesets
86 adding manifests
87 adding manifests
87 adding file changes
88 adding file changes
88 added 1 changesets with 1 changes to 1 files
89 added 1 changesets with 2 changes to 2 files
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 applying patch from stdin
91 applying patch from stdin
91 patching file a
92 patching file a
92 transaction abort!
93 transaction abort!
93 rollback completed
94 rollback completed
94 % hg export in email, should use patch header
95 % hg export in email, should use patch header
95 requesting all changes
96 requesting all changes
96 adding changesets
97 adding changesets
97 adding manifests
98 adding manifests
98 adding file changes
99 adding file changes
99 added 1 changesets with 1 changes to 1 files
100 added 1 changesets with 2 changes to 2 files
100 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 applying patch from stdin
102 applying patch from stdin
102 patching file a
103 patching file a
103 summary: second change
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