Mercurial > hg
annotate tests/test-import @ 5937:d8878742a924
Test case for hg import --no-commit
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 25 Jan 2008 16:18:49 +0100 |
parents | deb0d3518674 |
children | e7f1be4bf40a |
rev | line source |
---|---|
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
2 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
3 hg init a |
2773
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
4 mkdir a/d1 |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
5 mkdir a/d1/d2 |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
6 echo line 1 > a/a |
2773
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
7 echo line 1 > a/d1/d2/a |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
8 hg --cwd a ci -d '0 0' -Ama |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
9 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
10 echo line 2 >> a/a |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
11 hg --cwd a ci -u someone -d '1 0' -m'second change' |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
12 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
13 echo % import exported patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
14 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 hg --cwd a export tip > tip.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
16 hg --cwd b import ../tip.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
17 echo % message should be same |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
18 hg --cwd b tip | grep 'second change' |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
19 echo % committer should be same |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
20 hg --cwd b tip | grep someone |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
21 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
22 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
23 echo % import of plain diff should fail without message |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
24 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
25 hg --cwd a diff -r0:1 > tip.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
26 hg --cwd b import ../tip.patch |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
27 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
28 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
29 echo % import of plain diff should be ok with message |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
30 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
31 hg --cwd a diff -r0:1 > tip.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
32 hg --cwd b import -mpatch ../tip.patch |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
33 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
34 |
5937
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
35 echo % import of plain diff should be ok with --no-commit |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
36 hg clone -r0 a b |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
37 hg --cwd a diff -r0:1 > tip.patch |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
38 hg --cwd b import --no-commit ../tip.patch |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
39 hg --cwd b diff --nodates |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
40 rm -r b |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
41 |
4230
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
42 echo % hg -R repo import |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
43 # put the clone in a subdir - having a directory named "a" |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
44 # used to hide a bug. |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
45 mkdir dir |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
46 hg clone -r0 a dir/b |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
47 hg --cwd a export tip > dir/tip.patch |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
48 cd dir |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
49 hg -R b import tip.patch |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
50 cd .. |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
51 rm -r dir |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
52 |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
53 echo % import from stdin |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
54 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
55 hg --cwd a export tip | hg --cwd b import - |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
56 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
57 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
58 echo % override commit message |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
59 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
60 hg --cwd a export tip | hg --cwd b import -m 'override' - |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
61 hg --cwd b tip | grep override |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
62 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
63 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
64 cat > mkmsg.py <<EOF |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
65 import email.Message, sys |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
66 msg = email.Message.Message() |
5530
b0ff52ec9b52
test-import: read email payload in binary mode
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
67 msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read()) |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
68 msg['Subject'] = 'email patch' |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
69 msg['From'] = 'email patcher' |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
70 sys.stdout.write(msg.as_string()) |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
71 EOF |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
72 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
73 echo % plain diff in email, subject, message body |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
74 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
75 hg --cwd a diff -r0:1 > tip.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
76 python mkmsg.py > msg.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
77 hg --cwd b import ../msg.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
78 hg --cwd b tip | grep email |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
79 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
80 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
81 echo % plain diff in email, no subject, message body |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
82 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
83 grep -v '^Subject:' msg.patch | hg --cwd b import - |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
84 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
85 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
86 echo % plain diff in email, subject, no message body |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
87 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
88 grep -v '^email ' msg.patch | hg --cwd b import - |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
89 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
90 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
91 echo % plain diff in email, no subject, no message body, should fail |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
92 hg clone -r0 a b |
2843
0b9ac7dfcf56
Fix some tests for portability.
Danek Duvall <danek.duvall@sun.com>
parents:
2773
diff
changeset
|
93 egrep -v '^(Subject|email)' msg.patch | hg --cwd b import - |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
94 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
95 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
96 echo % hg export in email, should use patch header |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
97 hg clone -r0 a b |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
98 hg --cwd a export tip > tip.patch |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
99 python mkmsg.py | hg --cwd b import - |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
100 hg --cwd b tip | grep second |
3988
9dcf9d45cab8
Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2843
diff
changeset
|
101 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
102 |
4779
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
103 # subject: duplicate detection, removal of [PATCH] |
5418
9b469bdb1ce1
patch: fix git sendmail handling without proper mail headers
Patrick Mezard <pmezard@gmail.com>
parents:
4779
diff
changeset
|
104 # The '---' tests the gitsendmail handling without proper mail headers |
4779
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
105 cat > mkmsg2.py <<EOF |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
106 import email.Message, sys |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
107 msg = email.Message.Message() |
5418
9b469bdb1ce1
patch: fix git sendmail handling without proper mail headers
Patrick Mezard <pmezard@gmail.com>
parents:
4779
diff
changeset
|
108 msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read()) |
4779
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
109 msg['Subject'] = '[PATCH] email patch' |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
110 msg['From'] = 'email patcher' |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
111 sys.stdout.write(msg.as_string()) |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
112 EOF |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
113 |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
114 echo '% plain diff in email, [PATCH] subject, message body with subject' |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
115 hg clone -r0 a b |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
116 hg --cwd a diff -r0:1 > tip.patch |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
117 python mkmsg2.py | hg --cwd b import - |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
118 hg --cwd b tip --template '{desc}\n' |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
119 rm -r b |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
120 |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
121 |
2773
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
122 # bug non regression test |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
123 # importing a patch in a subdirectory failed at the commit stage |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
124 echo line 2 >> a/d1/d2/a |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
125 hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change' |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
126 echo % hg import in a subdirectory |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
127 hg clone -r0 a b |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
128 hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch |
2843
0b9ac7dfcf56
Fix some tests for portability.
Danek Duvall <danek.duvall@sun.com>
parents:
2773
diff
changeset
|
129 dir=`pwd` |
0b9ac7dfcf56
Fix some tests for portability.
Danek Duvall <danek.duvall@sun.com>
parents:
2773
diff
changeset
|
130 cd b/d1/d2 2>&1 > /dev/null |
2773
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
131 hg import ../../../tip.patch |
2843
0b9ac7dfcf56
Fix some tests for portability.
Danek Duvall <danek.duvall@sun.com>
parents:
2773
diff
changeset
|
132 cd $dir |
2773
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
133 echo "% message should be 'subdir change'" |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
134 hg --cwd b tip | grep 'subdir change' |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
135 echo "% committer should be 'someoneelse'" |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
136 hg --cwd b tip | grep someoneelse |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
137 echo "% should be empty" |
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
138 hg --cwd b status |
5548
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
139 |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
140 |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
141 # Test fuzziness (ambiguous patch location, fuzz=2) |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
142 echo % test fuzziness |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
143 hg init fuzzy |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
144 cd fuzzy |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
145 echo line1 > a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
146 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
147 echo line3 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
148 hg ci -Am adda |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
149 echo line1 > a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
150 echo line2 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
151 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
152 echo line3 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
153 hg ci -m change a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
154 hg export tip > tip.patch |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
155 hg up -C 0 |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
156 echo line1 > a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
157 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
158 echo line1 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
159 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
160 hg ci -m brancha |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
161 hg import -v tip.patch |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
162 cd .. |
5852
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
163 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
164 # Test hunk touching empty files (issue906) |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
165 hg init empty |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
166 cd empty |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
167 touch a |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
168 touch b1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
169 touch c1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
170 echo d > d |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
171 hg ci -Am init |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
172 echo a > a |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
173 echo b > b1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
174 hg mv b1 b2 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
175 echo c > c1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
176 hg copy c1 c2 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
177 rm d |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
178 touch d |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
179 hg diff --git |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
180 hg ci -m empty |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
181 hg export --git tip > empty.diff |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
182 hg up -C 0 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
183 hg import empty.diff |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
184 for name in a b1 b2 c1 c2 d; |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
185 do |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
186 echo % $name file |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
187 test -f $name && cat $name |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
188 done |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
189 cd .. |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
190 |