Mercurial > hg-stable
annotate tests/test-import @ 10827:b66388f6adfa
color: don't split colors across lines (which confuses less -R)
Currently, less -R doesn't support colors spanning multiple lines; only
the first line will be colorized.
Instead of allowing colors to span multiple lines, the color extension
now applies colors to each line it receives, even when ui.write() is
given multiple lines in one call.
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Fri, 02 Apr 2010 15:22:19 -0500 |
parents | c52057614c72 |
children | 196908117c27 |
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 |
8167
6c82beaaa11a
tests: removed redundant "-d '0 0'" from test scripts
Martin Geisler <mg@lazybytes.net>
parents:
7971
diff
changeset
|
8 hg --cwd a ci -Ama |
2513
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 |
7247
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
23 echo % import exported patch with external patcher |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
24 cat > dummypatch.py <<EOF |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
25 print 'patching file a' |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
26 file('a', 'wb').write('line2\n') |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
27 EOF |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
28 chmod +x dummypatch.py |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
29 hg clone -r0 a b |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
30 hg --cwd a export tip > tip.patch |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
31 hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
32 cat b/a |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
33 rm -r b |
c4461ea8b4c8
patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents:
6758
diff
changeset
|
34 |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 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
|
39 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
40 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
41 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
|
42 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
|
43 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
|
44 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
|
45 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
46 |
5953
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
47 echo % import of plain diff with specific date and user |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
48 hg clone -r0 a b |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
49 hg --cwd a diff -r0:1 > tip.patch |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
50 hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
51 hg -R b tip -pv |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
52 rm -r b |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5937
diff
changeset
|
53 |
5937
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
54 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
|
55 hg clone -r0 a b |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
56 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
|
57 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
|
58 hg --cwd b diff --nodates |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
59 rm -r b |
d8878742a924
Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5853
diff
changeset
|
60 |
4230
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
61 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
|
62 # 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
|
63 # 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
|
64 mkdir dir |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
65 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
|
66 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
|
67 cd dir |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
68 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
|
69 cd .. |
c93562fb12cc
Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3988
diff
changeset
|
70 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
|
71 |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
72 echo % import from stdin |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
73 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
|
74 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
|
75 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
76 |
10384
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
77 echo % import two patches in one stream |
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
78 hg init b |
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
79 hg --cwd a export 0:tip | hg --cwd b import - |
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
80 hg --cwd a id |
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
81 hg --cwd b id |
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
82 rm -r b |
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
9594
diff
changeset
|
83 |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
84 echo % override commit message |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
85 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
|
86 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
|
87 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
|
88 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
89 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
90 cat > mkmsg.py <<EOF |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
91 import email.Message, sys |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
92 msg = email.Message.Message() |
5530
b0ff52ec9b52
test-import: read email payload in binary mode
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
93 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
|
94 msg['Subject'] = 'email patch' |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
95 msg['From'] = 'email patcher' |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
96 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
|
97 EOF |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
98 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
106 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
107 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
|
108 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
|
109 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
|
110 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
111 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
112 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
|
113 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
|
114 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
|
115 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
116 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
117 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
|
118 hg clone -r0 a b |
2843
0b9ac7dfcf56
Fix some tests for portability.
Danek Duvall <danek.duvall@sun.com>
parents:
2773
diff
changeset
|
119 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
|
120 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
121 |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 rm -r b |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
128 |
4779
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
129 # 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
|
130 # 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
|
131 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
|
132 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
|
133 msg = email.Message.Message() |
5418
9b469bdb1ce1
patch: fix git sendmail handling without proper mail headers
Patrick Mezard <pmezard@gmail.com>
parents:
4779
diff
changeset
|
134 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
|
135 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
|
136 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
|
137 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
|
138 EOF |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
139 |
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 |
5986
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
147 # We weren't backing up the correct dirstate file when importing many patches |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
148 # (issue963) |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
149 echo '% import patch1 patch2; rollback' |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
150 echo line 3 >> a/a |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
151 hg --cwd a ci -m'third change' |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
152 hg --cwd a export -o '../patch%R' 1 2 |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
153 hg clone -qr0 a b |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
8167
diff
changeset
|
154 hg --cwd b parents --template 'parent: {rev}\n' |
5986
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
155 hg --cwd b import ../patch1 ../patch2 |
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
156 hg --cwd b rollback |
8523
5b7da468531b
tests: replace #...# syntax with {...}
Martin Geisler <mg@lazybytes.net>
parents:
8167
diff
changeset
|
157 hg --cwd b parents --template 'parent: {rev}\n' |
5986
a732eebf1958
hg import: write the dirstate after every commit
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5852
diff
changeset
|
158 rm -r b |
4779
a7915f79d4cc
Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4230
diff
changeset
|
159 |
2773
871ca5b9d348
Import say a file is not tracked after patching : test case
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2513
diff
changeset
|
160 # 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
|
161 # 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 dir=`pwd` |
0b9ac7dfcf56
Fix some tests for portability.
Danek Duvall <danek.duvall@sun.com>
parents:
2773
diff
changeset
|
168 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
|
169 hg import ../../../tip.patch |
10775
c52057614c72
Tests with spaces in paths
Mads Kiilerich <mads@kiilerich.com>
parents:
10748
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 hg --cwd b status |
5548
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
177 |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
178 |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
179 # Test fuzziness (ambiguous patch location, fuzz=2) |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
180 echo % test fuzziness |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
181 hg init fuzzy |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
182 cd fuzzy |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
183 echo line1 > a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
184 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
185 echo line3 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
186 hg ci -Am adda |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
187 echo line1 > a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
188 echo line2 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
189 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
190 echo line3 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
191 hg ci -m change a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
192 hg export tip > tip.patch |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
193 hg up -C 0 |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
194 echo line1 > a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
195 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
196 echo line1 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
197 echo line0 >> a |
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
198 hg ci -m brancha |
10524
3212afb33116
patch: fix patching with fuzz and eol normalization
Patrick Mezard <pmezard@gmail.com>
parents:
10501
diff
changeset
|
199 hg import --no-commit -v tip.patch |
3212afb33116
patch: fix patching with fuzz and eol normalization
Patrick Mezard <pmezard@gmail.com>
parents:
10501
diff
changeset
|
200 hg revert -a |
3212afb33116
patch: fix patching with fuzz and eol normalization
Patrick Mezard <pmezard@gmail.com>
parents:
10501
diff
changeset
|
201 echo '% test fuzziness with eol=auto' |
3212afb33116
patch: fix patching with fuzz and eol normalization
Patrick Mezard <pmezard@gmail.com>
parents:
10501
diff
changeset
|
202 hg --config patch.eol=auto import --no-commit -v tip.patch |
5548
1fb38ef1f113
test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents:
5418
diff
changeset
|
203 cd .. |
5852
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
204 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
205 # 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
|
206 hg init empty |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
207 cd empty |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
208 touch a |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
209 touch b1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
210 touch c1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
211 echo d > d |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
212 hg ci -Am init |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
213 echo a > a |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
214 echo b > b1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
215 hg mv b1 b2 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
216 echo c > c1 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
217 hg copy c1 c2 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
218 rm d |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
219 touch d |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
220 hg diff --git |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
221 hg ci -m empty |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
222 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
|
223 hg up -C 0 |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
224 hg import empty.diff |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
225 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
|
226 do |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
227 echo % $name file |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
228 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
|
229 done |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
230 cd .. |
03ce5a919ae3
patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents:
5548
diff
changeset
|
231 |
6179
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
232 # Test importing a patch ending with a binary file removal |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
233 echo % test trailing binary removal |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
234 hg init binaryremoval |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
235 cd binaryremoval |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
236 echo a > a |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
237 python -c "file('b', 'wb').write('a\x00b')" |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
238 hg ci -Am addall |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
239 hg rm a |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
240 hg rm b |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
241 hg st |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
242 hg ci -m remove |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
243 hg export --git . > remove.diff |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
244 cat remove.diff | grep git |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
245 hg up -C 0 |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
246 hg import remove.diff |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
247 hg manifest |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
248 cd .. |
36ab165abbe2
patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents:
6001
diff
changeset
|
249 |
6295
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
250 echo % 'test update+rename with common name (issue 927)' |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
251 hg init t |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
252 cd t |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
253 touch a |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
254 hg ci -Am t |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
255 echo a > a |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
256 # Here, bfile.startswith(afile) |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
257 hg copy a a2 |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
258 hg ci -m copya |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
259 hg export --git tip > copy.diff |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
260 hg up -C 0 |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
261 hg import copy.diff |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
262 echo % view a |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
263 # a should contain an 'a' |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
264 cat a |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
265 echo % view a2 |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
266 # and a2 should have duplicated it |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
267 cat a2 |
bace1990ab12
patch: fix corner case with update + copy patch handling (issue 937)
Patrick Mezard <pmezard@gmail.com>
parents:
6179
diff
changeset
|
268 cd .. |
6520
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
269 |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
270 echo % 'test -p0' |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
271 hg init p0 |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
272 cd p0 |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
273 echo a > a |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
274 hg ci -Am t |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
275 hg import -p0 - << EOF |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
276 foobar |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
277 --- a Sat Apr 12 22:43:58 2008 -0400 |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
278 +++ a Sat Apr 12 22:44:05 2008 -0400 |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
279 @@ -1,1 +1,1 @@ |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
280 -a |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
281 +bb |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
282 EOF |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
283 hg status |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
284 cat a |
ba0b2dacc623
fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6295
diff
changeset
|
285 cd .. |
6758
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
286 |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
287 echo % 'test paths outside repo root' |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
288 mkdir outside |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
289 touch outside/foo |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
290 hg init inside |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
291 cd inside |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
292 hg import - <<EOF |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
293 diff --git a/a b/b |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
294 rename from ../outside/foo |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
295 rename to bar |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
296 EOF |
87c704ac92d4
Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents:
6520
diff
changeset
|
297 cd .. |
7402
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
298 |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
299 echo '% test import with similarity (issue295)' |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
300 hg init sim |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
301 cd sim |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
302 echo 'this is a test' > a |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
303 hg ci -Ama |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
304 cat > ../rename.diff <<EOF |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
305 diff --git a/a b/a |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
306 deleted file mode 100644 |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
307 --- a/a |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
308 +++ /dev/null |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
309 @@ -1,1 +0,0 @@ |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
310 -this is a test |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
311 diff --git a/b b/b |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
312 new file mode 100644 |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
313 --- /dev/null |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
314 +++ b/b |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
315 @@ -0,0 +1,2 @@ |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
316 +this is a test |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
317 +foo |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
318 EOF |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
319 hg import --no-commit -v -s 1 ../rename.diff |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
320 hg st -C |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
321 hg revert -a |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
322 rm b |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
323 hg import --no-commit -v -s 100 ../rename.diff |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
324 hg st -C |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7247
diff
changeset
|
325 cd .. |
7971
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
326 |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
327 |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
328 echo '% add empty file from the end of patch (issue 1495)' |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
329 hg init addemptyend |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
330 cd addemptyend |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
331 touch a |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
332 hg addremove |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
333 hg ci -m "commit" |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
334 cat > a.patch <<EOF |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
335 diff --git a/a b/a |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
336 --- a/a |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
337 +++ b/a |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
338 @@ -0,0 +1,1 @@ |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
339 +a |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
340 diff --git a/b b/b |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
341 new file mode 100644 |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
342 EOF |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
343 hg import --no-commit a.patch |
6ea0318daf75
Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents:
7402
diff
changeset
|
344 cd .. |
9573
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
345 |
9328
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
346 echo '% create file when source is not /dev/null' |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
347 cat > create.patch <<EOF |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
348 diff -Naur proj-orig/foo proj-new/foo |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
349 --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800 |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
350 +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
351 @@ -0,0 +1,1 @@ |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
352 +a |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
353 EOF |
10745
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
354 # some people have patches like the following too |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
355 cat > create2.patch <<EOF |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
356 diff -Naur proj-orig/foo proj-new/foo |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
357 --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800 |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
358 +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700 |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
359 @@ -0,0 +1,1 @@ |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
360 +a |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
361 EOF |
9328
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
362 hg init oddcreate |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
363 cd oddcreate |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
364 hg import --no-commit ../create.patch |
648d6a1a1cf2
patch: create file even if source is not /dev/null
Brendan Cully <brendan@kublai.com>
parents:
8523
diff
changeset
|
365 cat foo |
10745
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
366 rm foo |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
367 hg revert foo |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
368 hg import --no-commit ../create2.patch |
d94832c4a31d
patch: try harder to find the file to patch on file creation (issue2041)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10729
diff
changeset
|
369 cat foo |
9576 | 370 |
9573
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
371 echo % 'first line mistaken for email headers (issue 1859)' |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
372 hg init emailconfusion |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
373 cd emailconfusion |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
374 cat > a.patch <<EOF |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
375 module: summary |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
376 |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
377 description |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
378 |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
379 |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
380 diff -r 000000000000 -r 9b4c1e343b55 test.txt |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
381 --- /dev/null |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
382 +++ b/a |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
383 @@ -0,0 +1,1 @@ |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
384 +a |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
385 EOF |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
386 hg import -d '0 0' a.patch |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
387 hg parents -v |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
388 cd .. |
b8352a3617f3
patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents:
8523
diff
changeset
|
389 |
10729
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
390 echo % '--- in commit message' |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
391 hg init commitconfusion |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
392 cd commitconfusion |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
393 cat > a.patch <<EOF |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
394 module: summary |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
395 |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
396 --- description |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
397 |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
398 diff --git a/a b/a |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
399 new file mode 100644 |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
400 --- /dev/null |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
401 +++ b/a |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
402 @@ -0,0 +1,1 @@ |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
403 +a |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
404 EOF |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
405 hg import -d '0 0' a.patch |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
406 hg parents -v |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
407 cd .. |
7a5931c5f2dc
patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10524
diff
changeset
|
408 |
10501
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
409 echo '% tricky header splitting' |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
410 cat > trickyheaders.patch <<EOF |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
411 From: User A <user@a> |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
412 Subject: [PATCH] from: tricky! |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
413 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
414 # HG changeset patch |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
415 # User User B |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
416 # Date 1266264441 18000 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
417 # Branch stable |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
418 # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
419 # Parent 0000000000000000000000000000000000000000 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
420 from: tricky! |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
421 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
422 That is not a header. |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
423 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
424 diff -r 000000000000 -r f2be6a1170ac foo |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
425 --- /dev/null |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
426 +++ b/foo |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
427 @@ -0,0 +1,1 @@ |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
428 +foo |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
429 EOF |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
430 |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
431 hg init trickyheaders |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
432 cd trickyheaders |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
433 hg import -d '0 0' ../trickyheaders.patch |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
434 hg export --git tip |
a27af7229850
import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents:
10384
diff
changeset
|
435 cd .. |
10748
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
436 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
437 echo '% issue2102' |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
438 hg init issue2102 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
439 cd issue2102 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
440 mkdir -p src/cmd/gc |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
441 touch src/cmd/gc/mksys.bash |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
442 hg ci -Am init |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
443 hg import - <<EOF |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
444 # HG changeset patch |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
445 # User Rob Pike |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
446 # Date 1216685449 25200 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
447 # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
448 # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
449 help management of empty pkg and lib directories in perforce |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
450 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
451 R=gri |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
452 DELTA=4 (4 added, 0 deleted, 0 changed) |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
453 OCL=13328 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
454 CL=13328 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
455 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
456 diff --git a/lib/place-holder b/lib/place-holder |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
457 new file mode 100644 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
458 --- /dev/null |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
459 +++ b/lib/place-holder |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
460 @@ -0,0 +1,2 @@ |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
461 +perforce does not maintain empty directories. |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
462 +this file helps. |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
463 diff --git a/pkg/place-holder b/pkg/place-holder |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
464 new file mode 100644 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
465 --- /dev/null |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
466 +++ b/pkg/place-holder |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
467 @@ -0,0 +1,2 @@ |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
468 +perforce does not maintain empty directories. |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
469 +this file helps. |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
470 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
471 old mode 100644 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
472 new mode 100755 |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
473 EOF |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
474 hg sum |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
475 hg diff --git -c tip |
fb06e357e698
patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10745
diff
changeset
|
476 cd .. |