annotate tests/test-import.t @ 16297:1791d7662d32 stable

tests: eliminate shutdown race and sleeps in test-serve
author Matt Mackall <mpm@selenic.com>
date Wed, 28 Mar 2012 10:29:39 -0500
parents 0e0060bf2f44
children fcb97d9a26cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15540
ad2c5561cada tests: 'hghave unix-permissions' for test-import.t
Mads Kiilerich <mads@kiilerich.com>
parents: 15522
diff changeset
1 $ "$TESTDIR/hghave" unix-permissions || exit 80
ad2c5561cada tests: 'hghave unix-permissions' for test-import.t
Mads Kiilerich <mads@kiilerich.com>
parents: 15522
diff changeset
2
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
3 $ hg init a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
4 $ mkdir a/d1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
5 $ mkdir a/d1/d2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
6 $ echo line 1 > a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
7 $ echo line 1 > a/d1/d2/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
8 $ hg --cwd a ci -Ama
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
9 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
10 adding d1/d2/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
11
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
12 $ echo line 2 >> a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
13 $ hg --cwd a ci -u someone -d '1 0' -m'second change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
14
15327
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
15 import with no args:
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
16
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
17 $ hg --cwd a import
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
18 abort: need at least one patch to import
67e92d29ecb5 import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents: 15198
diff changeset
19 [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
20
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
21 generate patches for the test
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
22
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
23 $ hg --cwd a export tip > exported-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
24 $ hg --cwd a diff -r0:1 > diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
25
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
26
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
27 import exported patch
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
28
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
29 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
30 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
31 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
32 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
33 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
34 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
35 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
36 $ hg --cwd b import ../exported-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
37 applying ../exported-tip.patch
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
38
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
39 message and committer should be same
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
40
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
41 $ hg --cwd b tip
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
42 changeset: 1:1d4bd90af0e4
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
43 tag: tip
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
44 user: someone
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
45 date: Thu Jan 01 00:00:01 1970 +0000
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
46 summary: second change
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
47
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
48 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
49
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
50
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
51 import exported patch with external patcher
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
52
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
53 $ cat > dummypatch.py <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
54 > print 'patching file a'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
55 > file('a', 'wb').write('line2\n')
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
56 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
57 $ chmod +x dummypatch.py
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
58 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
59 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
60 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
61 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
62 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
63 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
64 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
65 $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../exported-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
66 applying ../exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
67 $ cat b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
68 line2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
69 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
70
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
71
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
72 import of plain diff should fail without message
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
73
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
74 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
75 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
76 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
77 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
78 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
79 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
81 $ hg --cwd b import ../diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
82 applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
83 abort: empty commit message
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11807
diff changeset
84 [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
85 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
86
7247
c4461ea8b4c8 patch: fix patched files records in externalpatcher()
Patrick Mezard <pmezard@gmail.com>
parents: 6758
diff changeset
87
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
88 import of plain diff should be ok with message
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
89
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
90 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
91 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
92 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
93 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
94 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
95 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
96 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
97 $ hg --cwd b import -mpatch ../diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
98 applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
99 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
100
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
101
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
102 import of plain diff with specific date and user
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
103
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
104 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
105 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
106 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
107 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
108 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
109 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
110 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
111 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
112 applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
113 $ hg -R b tip -pv
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
114 changeset: 1:ca68f19f3a40
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
115 tag: tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
116 user: user@nowhere.net
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
117 date: Thu Jan 01 00:00:01 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
118 files: a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
119 description:
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
120 patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
121
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
122
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
123 diff -r 80971e65b431 -r ca68f19f3a40 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
124 --- a/a Thu Jan 01 00:00:00 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
125 +++ b/a Thu Jan 01 00:00:01 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
126 @@ -1,1 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
127 line 1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
128 +line 2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
129
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
130 $ rm -r b
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
131
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
132
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
133 import of plain diff should be ok with --no-commit
5953
e7f1be4bf40a Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents: 5937
diff changeset
134
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
135 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
136 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
137 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
138 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
139 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
140 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
141 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
142 $ hg --cwd b import --no-commit ../diffed-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
143 applying ../diffed-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
144 $ hg --cwd b diff --nodates
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
145 diff -r 80971e65b431 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
146 --- a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
147 +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
148 @@ -1,1 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
149 line 1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
150 +line 2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
151 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
152
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
153
12675
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
154 import of malformed plain diff should fail
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
155
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
156 $ hg clone -r0 a b
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
157 adding changesets
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
158 adding manifests
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
159 adding file changes
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
160 added 1 changesets with 2 changes to 2 files
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
161 updating to branch default
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
163 $ sed 's/1,1/foo/' < diffed-tip.patch > broken.patch
12675
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
164 $ hg --cwd b import -mpatch ../broken.patch
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
165 applying ../broken.patch
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
166 abort: bad hunk #1
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
167 [255]
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
168 $ rm -r b
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
169
c6cdc123f6e4 patch: fails immediately upon malformed hunk
Patrick Mezard <pmezard@gmail.com>
parents: 12399
diff changeset
170
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
171 hg -R repo import
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
172 put the clone in a subdir - having a directory named "a"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
173 used to hide a bug.
5937
d8878742a924 Test case for hg import --no-commit
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5853
diff changeset
174
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
175 $ mkdir dir
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
176 $ hg clone -r0 a dir/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
177 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
178 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
179 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
180 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
181 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
182 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
183 $ cd dir
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
184 $ hg -R b import ../exported-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
185 applying ../exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
186 $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
187 $ rm -r dir
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
188
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
189
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
190 import from stdin
4230
c93562fb12cc Fix handling of paths when run outside the repo.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3988
diff changeset
191
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
192 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
193 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
194 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
195 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
196 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
197 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
198 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
199 $ hg --cwd b import - < exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
200 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
201 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
202
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
203
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
204 import two patches in one stream
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
205
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
206 $ hg init b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
207 $ hg --cwd a export 0:tip | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
208 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
209 $ hg --cwd a id
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
210 1d4bd90af0e4 tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
211 $ hg --cwd b id
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
212 1d4bd90af0e4 tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
213 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
214
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
215
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
216 override commit message
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
217
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
218 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
219 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
220 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
221 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
222 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
223 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
224 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
225 $ hg --cwd b import -m 'override' - < exported-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
226 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
227 $ hg --cwd b tip | grep override
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
228 summary: override
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
229 $ rm -r b
10384
832f35386067 import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents: 9594
diff changeset
230
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
231 $ cat > mkmsg.py <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
232 > import email.Message, sys
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
233 > msg = email.Message.Message()
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
234 > patch = open(sys.argv[1], 'rb').read()
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
235 > msg.set_payload('email commit message\n' + patch)
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
236 > msg['Subject'] = 'email patch'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
237 > msg['From'] = 'email patcher'
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
238 > file(sys.argv[2], 'wb').write(msg.as_string())
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
239 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
240
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
241
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
242 plain diff in email, subject, message body
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
243
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
244 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
245 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
246 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
247 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
248 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
249 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
250 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
251 $ python mkmsg.py diffed-tip.patch msg.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
252 $ hg --cwd b import ../msg.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
253 applying ../msg.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
254 $ hg --cwd b tip | grep email
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
255 user: email patcher
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
256 summary: email patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
257 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
258
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
259
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
260 plain diff in email, no subject, message body
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
261
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
262 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
263 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
264 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
265 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
266 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
267 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
268 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
269 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
270 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
271 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
272
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
273
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
274 plain diff in email, subject, no message body
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
275
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
276 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
277 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
278 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
279 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
280 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
281 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
282 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
283 $ grep -v '^email ' msg.patch | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
284 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
285 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
286
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
287
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
288 plain diff in email, no subject, no message body, should fail
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
289
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
290 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
291 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
292 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
293 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
294 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
295 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
296 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
297 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
298 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
299 abort: empty commit message
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11807
diff changeset
300 [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
301 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
302
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
303
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
304 hg export in email, should use patch header
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
305
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
306 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
307 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
308 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
309 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
310 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
311 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
312 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
313 $ python mkmsg.py exported-tip.patch msg.patch
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
314 $ cat msg.patch | hg --cwd b import -
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
315 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
316 $ hg --cwd b tip | grep second
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
317 summary: second change
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
318 $ rm -r b
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
319
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
320
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
321 subject: duplicate detection, removal of [PATCH]
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
322 The '---' tests the gitsendmail handling without proper mail headers
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
323
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
324 $ cat > mkmsg2.py <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
325 > import email.Message, sys
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
326 > msg = email.Message.Message()
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
327 > patch = open(sys.argv[1], 'rb').read()
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
328 > msg.set_payload('email patch\n\nnext line\n---\n' + patch)
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
329 > msg['Subject'] = '[PATCH] email patch'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
330 > msg['From'] = 'email patcher'
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
331 > file(sys.argv[2], 'wb').write(msg.as_string())
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
332 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
333
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
334
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
335 plain diff in email, [PATCH] subject, message body with subject
2513
f22e3e8fd457 import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
336
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
337 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
338 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
339 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
340 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
341 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
342 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
343 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
15522
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
344 $ python mkmsg2.py diffed-tip.patch msg.patch
cf0f3cb8a332 tests: don't use stdout redirection for test data
Mads Kiilerich <mads@kiilerich.com>
parents: 15462
diff changeset
345 $ cat msg.patch | hg --cwd b import -
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
346 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
347 $ hg --cwd b tip --template '{desc}\n'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
348 email patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
349
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
350 next line
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
351 ---
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
352 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
353
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
354
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
355 Issue963: Parent of working dir incorrect after import of multiple
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
356 patches and rollback
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
357
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
358 We weren't backing up the correct dirstate file when importing many
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
359 patches: import patch1 patch2; rollback
4779
a7915f79d4cc Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4230
diff changeset
360
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
361 $ echo line 3 >> a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
362 $ hg --cwd a ci -m'third change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
363 $ hg --cwd a export -o '../patch%R' 1 2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
364 $ hg clone -qr0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
365 $ hg --cwd b parents --template 'parent: {rev}\n'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
366 parent: 0
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
367 $ hg --cwd b import -v ../patch1 ../patch2
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
368 applying ../patch1
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
369 patching file a
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
370 a
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
371 created 1d4bd90af0e4
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
372 applying ../patch2
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
373 patching file a
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
374 a
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
375 created 6d019af21222
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
376 $ hg --cwd b rollback
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
377 repository tip rolled back to revision 0 (undo import)
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
378 working directory now based on revision 0
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
379 $ hg --cwd b parents --template 'parent: {rev}\n'
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
380 parent: 0
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
381 $ rm -r b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
382
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
383
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
384 importing a patch in a subdirectory failed at the commit stage
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
385
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
386 $ echo line 2 >> a/d1/d2/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
387 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
388
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
389 hg import in a subdirectory
4779
a7915f79d4cc Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4230
diff changeset
390
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
391 $ hg clone -r0 a b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
392 adding changesets
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
393 adding manifests
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
394 adding file changes
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
395 added 1 changesets with 2 changes to 2 files
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
396 updating to branch default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
397 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
398 $ hg --cwd a export tip > tmp
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
399 $ sed -e 's/d1\/d2\///' < tmp > subdir-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
400 $ dir=`pwd`
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
401 $ cd b/d1/d2 2>&1 > /dev/null
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
402 $ hg import ../../../subdir-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
403 applying ../../../subdir-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
404 $ cd "$dir"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
405
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
406 message should be 'subdir change'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
407 committer should be 'someoneelse'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
408
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
409 $ hg --cwd b tip
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
410 changeset: 1:3577f5aea227
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
411 tag: tip
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
412 user: someoneelse
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
413 date: Thu Jan 01 00:00:01 1970 +0000
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
414 summary: subdir change
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
415
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
416
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
417 should be empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
418
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
419 $ hg --cwd b status
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
420
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
421
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
422 Test fuzziness (ambiguous patch location, fuzz=2)
4779
a7915f79d4cc Added import test for [PATCH] subject and message body with subject
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4230
diff changeset
423
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
424 $ hg init fuzzy
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
425 $ cd fuzzy
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
426 $ echo line1 > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
427 $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
428 $ echo line3 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
429 $ hg ci -Am adda
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
430 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
431 $ echo line1 > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
432 $ echo line2 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
433 $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
434 $ echo line3 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
435 $ hg ci -m change a
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
436 $ hg export tip > fuzzy-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
437 $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
438 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
439 $ echo line1 > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
440 $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
441 $ echo line1 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
442 $ echo line0 >> a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
443 $ hg ci -m brancha
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
444 created new head
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
445 $ hg import --no-commit -v fuzzy-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
446 applying fuzzy-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
447 patching file a
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
448 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
449 applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
450 $ hg revert -a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
451 reverting a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
452
12913
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
453
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
454 import with --no-commit should have written .hg/last-message.txt
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
455
12945
99f7dc8def34 test-import: workaround for missing newline is no longer needed
Mads Kiilerich <mads@kiilerich.com>
parents: 12914
diff changeset
456 $ cat .hg/last-message.txt
99f7dc8def34 test-import: workaround for missing newline is no longer needed
Mads Kiilerich <mads@kiilerich.com>
parents: 12914
diff changeset
457 change (no-eol)
12913
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
458
0e0a52bd58f9 import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents: 12847
diff changeset
459
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
460 test fuzziness with eol=auto
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
461
14125
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
462 $ hg --config patch.eol=auto import --no-commit -v fuzzy-tip.patch
2852843947da tests: do not export several times the same patch/diff in test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 13446
diff changeset
463 applying fuzzy-tip.patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
464 patching file a
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
465 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
466 applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
467 $ cd ..
5548
1fb38ef1f113 test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents: 5418
diff changeset
468
1fb38ef1f113 test-import: test fuzziness, ambiguous patch locations
Patrick Mezard <pmezard@gmail.com>
parents: 5418
diff changeset
469
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
470 Test hunk touching empty files (issue906)
5852
03ce5a919ae3 patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents: 5548
diff changeset
471
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
472 $ hg init empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
473 $ cd empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
474 $ touch a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
475 $ touch b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
476 $ touch c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
477 $ echo d > d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
478 $ hg ci -Am init
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
479 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
480 adding b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
481 adding c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
482 adding d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
483 $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
484 $ echo b > b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
485 $ hg mv b1 b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
486 $ echo c > c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
487 $ hg copy c1 c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
488 $ rm d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
489 $ touch d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
490 $ hg diff --git
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
491 diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
492 --- a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
493 +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
494 @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
495 +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
496 diff --git a/b1 b/b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
497 rename from b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
498 rename to b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
499 --- a/b1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
500 +++ b/b2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
501 @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
502 +b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
503 diff --git a/c1 b/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
504 --- a/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
505 +++ b/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
506 @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
507 +c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
508 diff --git a/c1 b/c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
509 copy from c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
510 copy to c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
511 --- a/c1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
512 +++ b/c2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
513 @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
514 +c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
515 diff --git a/d b/d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
516 --- a/d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
517 +++ b/d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
518 @@ -1,1 +0,0 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
519 -d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
520 $ hg ci -m empty
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
521 $ hg export --git tip > empty.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
522 $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
523 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
524 $ hg import empty.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
525 applying empty.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
526 $ for name in a b1 b2 c1 c2 d; do
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
527 > echo % $name file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
528 > test -f $name && cat $name
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
529 > done
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
530 % a file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
531 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
532 % b1 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
533 % b2 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
534 b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
535 % c1 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
536 c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
537 % c2 file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
538 c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
539 % d file
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
540 $ cd ..
5852
03ce5a919ae3 patch: handle empty vs no file in git patches (issue906)
Patrick Mezard <pmezard@gmail.com>
parents: 5548
diff changeset
541
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
542
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
543 Test importing a patch ending with a binary file removal
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
544
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
545 $ hg init binaryremoval
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
546 $ cd binaryremoval
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
547 $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
548 $ python -c "file('b', 'wb').write('a\x00b')"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
549 $ hg ci -Am addall
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
550 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
551 adding b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
552 $ hg rm a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
553 $ hg rm b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
554 $ hg st
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
555 R a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
556 R b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
557 $ hg ci -m remove
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
558 $ hg export --git . > remove.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
559 $ cat remove.diff | grep git
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
560 diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
561 diff --git a/b b/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
562 $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
563 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
564 $ hg import remove.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
565 applying remove.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
566 $ hg manifest
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
567 $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
568
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
569
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
570 Issue927: test update+rename with common name
6179
36ab165abbe2 patch: fix iterhunks() with trailing binary file removal
Patrick Mezard <pmezard@gmail.com>
parents: 6001
diff changeset
571
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
572 $ hg init t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
573 $ cd t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
574 $ touch a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
575 $ hg ci -Am t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
576 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
577 $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
578
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
579 Here, bfile.startswith(afile)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
580
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
581 $ hg copy a a2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
582 $ hg ci -m copya
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
583 $ hg export --git tip > copy.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
584 $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
585 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
586 $ hg import copy.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
587 applying copy.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
588
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
589 a should contain an 'a'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
590
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
591 $ cat a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
592 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
593
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
594 and a2 should have duplicated it
6520
ba0b2dacc623 fix import with -p0
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6295
diff changeset
595
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
596 $ cat a2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
597 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
598 $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
599
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
600
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
601 test -p0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
602
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
603 $ hg init p0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
604 $ cd p0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
605 $ echo a > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
606 $ hg ci -Am t
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
607 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
608 $ hg import -p0 - << EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
609 > foobar
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
610 > --- a Sat Apr 12 22:43:58 2008 -0400
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
611 > +++ a Sat Apr 12 22:44:05 2008 -0400
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
612 > @@ -1,1 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
613 > -a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
614 > +bb
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
615 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
616 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
617 $ hg status
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
618 $ cat a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
619 bb
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
620 $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
621
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
622
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
623 test paths outside repo root
6758
87c704ac92d4 Check that git patches only touch files under root
Brendan Cully <brendan@kublai.com>
parents: 6520
diff changeset
624
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
625 $ mkdir outside
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
626 $ touch outside/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
627 $ hg init inside
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
628 $ cd inside
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
629 $ hg import - <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
630 > diff --git a/a b/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
631 > rename from ../outside/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
632 > rename to bar
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
633 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
634 applying patch from stdin
14452
ee574cfd0c32 patch: use temporary files to handle intermediate copies
Patrick Mezard <pmezard@gmail.com>
parents: 14125
diff changeset
635 abort: path contains illegal component: ../outside/foo
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11807
diff changeset
636 [255]
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
637 $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
638
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
639
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
640 test import with similarity and git and strip (issue295 et al.)
7402
bffdab64dfbb import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents: 7247
diff changeset
641
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
642 $ hg init sim
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
643 $ cd sim
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
644 $ echo 'this is a test' > a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
645 $ hg ci -Ama
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
646 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
647 $ cat > ../rename.diff <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
648 > diff --git a/foo/a b/foo/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
649 > deleted file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
650 > --- a/foo/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
651 > +++ /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
652 > @@ -1,1 +0,0 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
653 > -this is a test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
654 > diff --git a/foo/b b/foo/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
655 > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
656 > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
657 > +++ b/foo/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
658 > @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
659 > +this is a test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
660 > +foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
661 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
662 $ hg import --no-commit -v -s 1 ../rename.diff -p2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
663 applying ../rename.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
664 patching file a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
665 patching file b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
666 adding b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
667 recording removal of a as rename to b (88% similar)
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
668 applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
669 $ hg st -C
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
670 A b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
671 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
672 R a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
673 $ hg revert -a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
674 undeleting a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
675 forgetting b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
676 $ rm b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
677 $ hg import --no-commit -v -s 100 ../rename.diff -p2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
678 applying ../rename.diff
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
679 patching file a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
680 patching file b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
681 adding b
15194
0705f2ac79d6 import: simplify status reporting logic (and make it more I18N-friendly)
Greg Ward <greg@gerg.ca>
parents: 14452
diff changeset
682 applied to working directory
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
683 $ hg st -C
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
684 A b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
685 R a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
686 $ cd ..
7971
6ea0318daf75 Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents: 7402
diff changeset
687
6ea0318daf75 Fix issue1495, corner case of adding empty files via patching
Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
parents: 7402
diff changeset
688
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
689 Issue1495: add empty file from the end of patch
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
690
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
691 $ hg init addemptyend
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
692 $ cd addemptyend
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
693 $ touch a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
694 $ hg addremove
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
695 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
696 $ hg ci -m "commit"
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
697 $ cat > a.patch <<EOF
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
698 > add a, b
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
699 > diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
700 > --- a/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
701 > +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
702 > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
703 > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
704 > diff --git a/b b/b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
705 > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
706 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
707 $ hg import --no-commit a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
708 applying a.patch
15198
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
709
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
710 apply a good patch followed by an empty patch (mainly to ensure
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
711 that dirstate is *not* updated when import crashes)
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
712 $ hg update -q -C .
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
713 $ rm b
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
714 $ touch empty.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
715 $ hg import a.patch empty.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
716 applying a.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
717 applying empty.patch
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
718 transaction abort!
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
719 rollback completed
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
720 abort: empty.patch: no diffs found
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
721 [255]
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
722 $ hg tip --template '{rev} {desc|firstline}\n'
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
723 0 commit
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
724 $ hg -q status
62dc0e7ab092 import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents: 15194
diff changeset
725 M a
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
726 $ cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
727
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
728 create file when source is not /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
729
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
730 $ cat > create.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
731 > diff -Naur proj-orig/foo proj-new/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
732 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
733 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
734 > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
735 > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
736 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
737
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
738 some people have patches like the following too
9573
b8352a3617f3 patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
739
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
740 $ cat > create2.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
741 > diff -Naur proj-orig/foo proj-new/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
742 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
743 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
744 > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
745 > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
746 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
747 $ hg init oddcreate
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
748 $ cd oddcreate
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
749 $ hg import --no-commit ../create.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
750 applying ../create.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
751 $ cat foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
752 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
753 $ rm foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
754 $ hg revert foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
755 $ hg import --no-commit ../create2.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
756 applying ../create2.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
757 $ cat foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
758 a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
759
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
760
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
761 Issue1859: first line mistaken for email headers
9576
c156bf947e26 Merge with stable
Matt Mackall <mpm@selenic.com>
parents: 9328 9573
diff changeset
762
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
763 $ hg init emailconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
764 $ cd emailconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
765 $ cat > a.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
766 > module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
767 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
768 > description
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
769 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
770 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
771 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
772 > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
773 > +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
774 > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
775 > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
776 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
777 $ hg import -d '0 0' a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
778 applying a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
779 $ hg parents -v
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
780 changeset: 0:5a681217c0ad
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
781 tag: tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
782 user: test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
783 date: Thu Jan 01 00:00:00 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
784 files: a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
785 description:
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
786 module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
787
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
788 description
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
789
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
790
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
791 $ cd ..
9573
b8352a3617f3 patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
792
b8352a3617f3 patch: do not swallow header-like patch first line (issue1859)
Patrick Mezard <pmezard@gmail.com>
parents: 8523
diff changeset
793
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
794 --- in commit message
10729
7a5931c5f2dc patch: enhance diff detection regexp, allow '--- ' in patch message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10524
diff changeset
795
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
796 $ hg init commitconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
797 $ cd commitconfusion
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
798 $ cat > a.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
799 > module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
800 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
801 > --- description
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
802 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
803 > diff --git a/a b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
804 > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
805 > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
806 > +++ b/a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
807 > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
808 > +a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
809 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
810 > hg import -d '0 0' a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
811 > hg parents -v
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
812 > cd ..
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
813 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
814 > echo '% tricky header splitting'
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
815 > cat > trickyheaders.patch <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
816 > From: User A <user@a>
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
817 > Subject: [PATCH] from: tricky!
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
818 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
819 > # HG changeset patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
820 > # User User B
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
821 > # Date 1266264441 18000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
822 > # Branch stable
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
823 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
824 > # Parent 0000000000000000000000000000000000000000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
825 > from: tricky!
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
826 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
827 > That is not a header.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
828 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
829 > diff -r 000000000000 -r f2be6a1170ac foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
830 > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
831 > +++ b/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
832 > @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
833 > +foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
834 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
835 applying a.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
836 changeset: 0:f34d9187897d
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
837 tag: tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
838 user: test
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
839 date: Thu Jan 01 00:00:00 1970 +0000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
840 files: a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
841 description:
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
842 module: summary
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
843
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
844
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
845 % tricky header splitting
10501
a27af7229850 import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents: 10384
diff changeset
846
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
847 $ hg init trickyheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
848 $ cd trickyheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
849 $ hg import -d '0 0' ../trickyheaders.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
850 applying ../trickyheaders.patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
851 $ hg export --git tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
852 # HG changeset patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
853 # User User B
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
854 # Date 0 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
855 # Node ID eb56ab91903632294ac504838508cb370c0901d2
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
856 # Parent 0000000000000000000000000000000000000000
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
857 from: tricky!
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
858
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
859 That is not a header.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
860
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
861 diff --git a/foo b/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
862 new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
863 --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
864 +++ b/foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
865 @@ -0,0 +1,1 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
866 +foo
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
867 $ cd ..
10501
a27af7229850 import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents: 10384
diff changeset
868
a27af7229850 import: if in doubt, consume stream until start of diff
Brendan Cully <brendan@kublai.com>
parents: 10384
diff changeset
869
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12366
diff changeset
870 Issue2102: hg export and hg import speak different languages
10748
fb06e357e698 patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10745
diff changeset
871
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
872 $ hg init issue2102
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
873 $ cd issue2102
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
874 $ mkdir -p src/cmd/gc
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
875 $ touch src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
876 $ hg ci -Am init
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
877 adding src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
878 $ hg import - <<EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
879 > # HG changeset patch
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
880 > # User Rob Pike
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
881 > # Date 1216685449 25200
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
882 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
883 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
884 > help management of empty pkg and lib directories in perforce
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
885 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
886 > R=gri
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
887 > DELTA=4 (4 added, 0 deleted, 0 changed)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
888 > OCL=13328
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
889 > CL=13328
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
890 >
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
891 > diff --git a/lib/place-holder b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
892 > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
893 > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
894 > +++ b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
895 > @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
896 > +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
897 > +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
898 > diff --git a/pkg/place-holder b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
899 > new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
900 > --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
901 > +++ b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
902 > @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
903 > +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
904 > +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
905 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
906 > old mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
907 > new mode 100755
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
908 > EOF
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
909 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
910 $ hg sum
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
911 parent: 1:d59915696727 tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
912 help management of empty pkg and lib directories in perforce
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
913 branch: default
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
914 commit: (clean)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
915 update: (current)
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
916 $ hg diff --git -c tip
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
917 diff --git a/lib/place-holder b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
918 new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
919 --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
920 +++ b/lib/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
921 @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
922 +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
923 +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
924 diff --git a/pkg/place-holder b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
925 new file mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
926 --- /dev/null
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
927 +++ b/pkg/place-holder
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
928 @@ -0,0 +1,2 @@
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
929 +perforce does not maintain empty directories.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
930 +this file helps.
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
931 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
932 old mode 100644
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
933 new mode 100755
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
934 $ cd ..
10748
fb06e357e698 patch: more precise NoHunk, raised for every file (issue2102)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 10745
diff changeset
935
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
936
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
937 diff lines looking like headers
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
938
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
939 $ hg init difflineslikeheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
940 $ cd difflineslikeheaders
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
941 $ echo a >a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
942 $ echo b >b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
943 $ echo c >c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
944 $ hg ci -Am1
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
945 adding a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
946 adding b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
947 adding c
10883
196908117c27 patch: don't look for headers in diff lines
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10775
diff changeset
948
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
949 $ echo "key: value" >>a
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
950 $ echo "key: value" >>b
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
951 $ echo "foo" >>c
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
952 $ hg ci -m2
10883
196908117c27 patch: don't look for headers in diff lines
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10775
diff changeset
953
11807
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
954 $ hg up -C 0
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
955 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
956 $ hg diff --git -c1 >want
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
957 $ hg diff -c1 | hg import --no-commit -
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
958 applying patch from stdin
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
959 $ hg diff --git >have
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
960 $ diff want have
887e9f487b7a tests: unify test-import
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11407
diff changeset
961 $ cd ..
10883
196908117c27 patch: don't look for headers in diff lines
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 10775
diff changeset
962
15462
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
963 import a unified diff with no lines of context (diff -U0)
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
964
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
965 $ hg init diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
966 $ cd diffzero
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
967 $ cat > f << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
968 > c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
969 > c4
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
970 > c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
971 > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
972 $ hg commit -Am0
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
973 adding f
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
974
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
975 $ hg import --no-commit - << EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
976 > # HG changeset patch
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
977 > # User test
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
978 > # Date 0 0
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
979 > # Node ID f4974ab632f3dee767567b0576c0ec9a4508575c
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
980 > # Parent 8679a12a975b819fae5f7ad3853a2886d143d794
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
981 > 1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
982 > diff -r 8679a12a975b -r f4974ab632f3 f
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
983 > --- a/f Thu Jan 01 00:00:00 1970 +0000
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
984 > +++ b/f Thu Jan 01 00:00:00 1970 +0000
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
985 > @@ -0,0 +1,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
986 > +c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
987 > @@ -1,0 +3,1 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
988 > +c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
989 > @@ -3,1 +4,0 @@
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
990 > -c5
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
991 > EOF
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
992 applying patch from stdin
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
993
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
994 $ cat f
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
995 c1
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
996 c2
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
997 c3
2b1ec74c961f mdiff/patch: fix bad hunk handling for unified diffs with zero context
Nicolas Venegas <nvenegas@atlassian.com>
parents: 15327
diff changeset
998 c4
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
999
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1000 Test corner case involving fuzz and skew
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1001
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1002 $ hg init morecornercases
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1003 $ cd morecornercases
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1004
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1005 $ cat > 01-no-context-beginning-of-file.diff <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1006 > diff --git a/a b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1007 > --- a/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1008 > +++ b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1009 > @@ -1,0 +1,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1010 > +line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1011 > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1012
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1013 $ cat > 02-no-context-middle-of-file.diff <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1014 > diff --git a/a b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1015 > --- a/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1016 > +++ b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1017 > @@ -1,1 +1,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1018 > -2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1019 > +add some skew
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1020 > @@ -2,0 +2,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1021 > +line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1022 > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1023
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1024 $ cat > 03-no-context-end-of-file.diff <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1025 > diff --git a/a b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1026 > --- a/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1027 > +++ b/a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1028 > @@ -10,0 +10,1 @@
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1029 > +line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1030 > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1031
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1032 $ cat > 04-middle-of-file-completely-fuzzed.diff <<EOF
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1033 > diff --git a/a b/a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1034 > --- a/a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1035 > +++ b/a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1036 > @@ -1,1 +1,1 @@
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1037 > -2
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1038 > +add some skew
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1039 > @@ -2,2 +2,3 @@
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1040 > not matching, should fuzz
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1041 > ... a bit
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1042 > +line
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1043 > EOF
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1044
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1045 $ cat > a <<EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1046 > 1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1047 > 2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1048 > 3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1049 > 4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1050 > EOF
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1051 $ hg ci -Am adda a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1052 $ for p in *.diff; do
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1053 > hg import -v --no-commit $p
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1054 > cat a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1055 > hg revert -aqC a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1056 > # patch -p1 < $p
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1057 > # cat a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1058 > # hg revert -aC a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1059 > done
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1060 applying 01-no-context-beginning-of-file.diff
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1061 patching file a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1062 applied to working directory
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1063 1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1064 line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1065 2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1066 3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1067 4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1068 applying 02-no-context-middle-of-file.diff
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1069 patching file a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1070 Hunk #1 succeeded at 2 (offset 1 lines).
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1071 Hunk #2 succeeded at 4 (offset 1 lines).
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1072 applied to working directory
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1073 1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1074 add some skew
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1075 3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1076 line
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1077 4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1078 applying 03-no-context-end-of-file.diff
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1079 patching file a
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1080 Hunk #1 succeeded at 5 (offset -6 lines).
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1081 applied to working directory
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1082 1
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1083 2
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1084 3
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1085 4
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1086 line
16124
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1087 applying 04-middle-of-file-completely-fuzzed.diff
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1088 patching file a
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1089 Hunk #1 succeeded at 2 (offset 1 lines).
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1090 Hunk #2 succeeded at 5 with fuzz 2 (offset 1 lines).
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1091 applied to working directory
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1092 1
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1093 add some skew
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1094 3
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1095 4
0e0060bf2f44 patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents: 16123
diff changeset
1096 line
16123
b0c7525f826d patch: fix fuzzing of hunks without previous lines (issue3264)
Patrick Mezard <patrick@mezard.eu>
parents: 16112
diff changeset
1097