Show More
@@ -1,431 +1,432 | |||||
1 | $ cat <<EOF > merge |
|
1 | $ cat <<EOF > merge | |
2 | > from __future__ import print_function |
|
2 | > from __future__ import print_function | |
3 | > import sys, os |
|
3 | > import sys, os | |
4 | > |
|
4 | > | |
5 | > try: |
|
5 | > try: | |
6 | > import msvcrt |
|
6 | > import msvcrt | |
7 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
7 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) | |
8 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
8 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) | |
9 | > except ImportError: |
|
9 | > except ImportError: | |
10 | > pass |
|
10 | > pass | |
11 | > |
|
11 | > | |
12 | > print("merging for", os.path.basename(sys.argv[1])) |
|
12 | > print("merging for", os.path.basename(sys.argv[1])) | |
13 | > EOF |
|
13 | > EOF | |
14 | $ HGMERGE="$PYTHON ../merge"; export HGMERGE |
|
14 | $ HGMERGE="$PYTHON ../merge"; export HGMERGE | |
15 |
|
15 | |||
16 | $ hg init t |
|
16 | $ hg init t | |
17 | $ cd t |
|
17 | $ cd t | |
18 | $ echo This is file a1 > a |
|
18 | $ echo This is file a1 > a | |
19 | $ hg add a |
|
19 | $ hg add a | |
20 | $ hg commit -m "commit #0" |
|
20 | $ hg commit -m "commit #0" | |
21 | $ echo This is file b1 > b |
|
21 | $ echo This is file b1 > b | |
22 | $ hg add b |
|
22 | $ hg add b | |
23 | $ hg commit -m "commit #1" |
|
23 | $ hg commit -m "commit #1" | |
24 |
|
24 | |||
25 | $ hg update 0 |
|
25 | $ hg update 0 | |
26 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
26 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
27 |
|
27 | |||
28 | Test interrupted updates by having a non-empty dir with the same name as one |
|
28 | Test interrupted updates by having a non-empty dir with the same name as one | |
29 | of the files in a commit we're updating to |
|
29 | of the files in a commit we're updating to | |
30 |
|
30 | |||
31 | $ mkdir b && touch b/nonempty |
|
31 | $ mkdir b && touch b/nonempty | |
32 | $ hg up |
|
32 | $ hg up | |
33 |
abort: |
|
33 | abort: Unlinking directory not permitted: '$TESTTMP/t/b' (windows !) | |
|
34 | abort: Directory not empty: '$TESTTMP/t/b' (no-windows !) | |||
34 | [255] |
|
35 | [255] | |
35 | $ hg ci |
|
36 | $ hg ci | |
36 | abort: last update was interrupted |
|
37 | abort: last update was interrupted | |
37 | (use 'hg update' to get a consistent checkout) |
|
38 | (use 'hg update' to get a consistent checkout) | |
38 | [255] |
|
39 | [255] | |
39 | $ hg sum |
|
40 | $ hg sum | |
40 | parent: 0:538afb845929 |
|
41 | parent: 0:538afb845929 | |
41 | commit #0 |
|
42 | commit #0 | |
42 | branch: default |
|
43 | branch: default | |
43 | commit: 1 unknown (interrupted update) |
|
44 | commit: 1 unknown (interrupted update) | |
44 | update: 1 new changesets (update) |
|
45 | update: 1 new changesets (update) | |
45 | phases: 2 draft |
|
46 | phases: 2 draft | |
46 |
|
47 | |||
47 | $ rm b/nonempty |
|
48 | $ rm b/nonempty | |
48 |
|
49 | |||
49 | $ hg up |
|
50 | $ hg up | |
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
51 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
51 | $ hg sum |
|
52 | $ hg sum | |
52 | parent: 1:b8bb4a988f25 tip |
|
53 | parent: 1:b8bb4a988f25 tip | |
53 | commit #1 |
|
54 | commit #1 | |
54 | branch: default |
|
55 | branch: default | |
55 | commit: (clean) |
|
56 | commit: (clean) | |
56 | update: (current) |
|
57 | update: (current) | |
57 | phases: 2 draft |
|
58 | phases: 2 draft | |
58 |
|
59 | |||
59 | Prepare a basic merge |
|
60 | Prepare a basic merge | |
60 |
|
61 | |||
61 | $ hg up 0 |
|
62 | $ hg up 0 | |
62 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
63 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
63 | $ echo This is file c1 > c |
|
64 | $ echo This is file c1 > c | |
64 | $ hg add c |
|
65 | $ hg add c | |
65 | $ hg commit -m "commit #2" |
|
66 | $ hg commit -m "commit #2" | |
66 | created new head |
|
67 | created new head | |
67 | $ echo This is file b1 > b |
|
68 | $ echo This is file b1 > b | |
68 | no merges expected |
|
69 | no merges expected | |
69 | $ hg merge -P 1 |
|
70 | $ hg merge -P 1 | |
70 | changeset: 1:b8bb4a988f25 |
|
71 | changeset: 1:b8bb4a988f25 | |
71 | user: test |
|
72 | user: test | |
72 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
73 | date: Thu Jan 01 00:00:00 1970 +0000 | |
73 | summary: commit #1 |
|
74 | summary: commit #1 | |
74 |
|
75 | |||
75 | $ hg merge 1 |
|
76 | $ hg merge 1 | |
76 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
77 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
77 | (branch merge, don't forget to commit) |
|
78 | (branch merge, don't forget to commit) | |
78 | $ hg diff --nodates |
|
79 | $ hg diff --nodates | |
79 | diff -r 49035e18a8e6 b |
|
80 | diff -r 49035e18a8e6 b | |
80 | --- /dev/null |
|
81 | --- /dev/null | |
81 | +++ b/b |
|
82 | +++ b/b | |
82 | @@ -0,0 +1,1 @@ |
|
83 | @@ -0,0 +1,1 @@ | |
83 | +This is file b1 |
|
84 | +This is file b1 | |
84 | $ hg status |
|
85 | $ hg status | |
85 | M b |
|
86 | M b | |
86 | $ cd ..; rm -r t |
|
87 | $ cd ..; rm -r t | |
87 |
|
88 | |||
88 | $ hg init t |
|
89 | $ hg init t | |
89 | $ cd t |
|
90 | $ cd t | |
90 | $ echo This is file a1 > a |
|
91 | $ echo This is file a1 > a | |
91 | $ hg add a |
|
92 | $ hg add a | |
92 | $ hg commit -m "commit #0" |
|
93 | $ hg commit -m "commit #0" | |
93 | $ echo This is file b1 > b |
|
94 | $ echo This is file b1 > b | |
94 | $ hg add b |
|
95 | $ hg add b | |
95 | $ hg commit -m "commit #1" |
|
96 | $ hg commit -m "commit #1" | |
96 |
|
97 | |||
97 | $ hg update 0 |
|
98 | $ hg update 0 | |
98 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
99 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
99 | $ echo This is file c1 > c |
|
100 | $ echo This is file c1 > c | |
100 | $ hg add c |
|
101 | $ hg add c | |
101 | $ hg commit -m "commit #2" |
|
102 | $ hg commit -m "commit #2" | |
102 | created new head |
|
103 | created new head | |
103 | $ echo This is file b2 > b |
|
104 | $ echo This is file b2 > b | |
104 | merge should fail |
|
105 | merge should fail | |
105 | $ hg merge 1 |
|
106 | $ hg merge 1 | |
106 | b: untracked file differs |
|
107 | b: untracked file differs | |
107 | abort: untracked files in working directory differ from files in requested revision |
|
108 | abort: untracked files in working directory differ from files in requested revision | |
108 | [255] |
|
109 | [255] | |
109 |
|
110 | |||
110 | #if symlink |
|
111 | #if symlink | |
111 | symlinks to directories should be treated as regular files (issue5027) |
|
112 | symlinks to directories should be treated as regular files (issue5027) | |
112 | $ rm b |
|
113 | $ rm b | |
113 | $ ln -s 'This is file b2' b |
|
114 | $ ln -s 'This is file b2' b | |
114 | $ hg merge 1 |
|
115 | $ hg merge 1 | |
115 | b: untracked file differs |
|
116 | b: untracked file differs | |
116 | abort: untracked files in working directory differ from files in requested revision |
|
117 | abort: untracked files in working directory differ from files in requested revision | |
117 | [255] |
|
118 | [255] | |
118 | symlinks shouldn't be followed |
|
119 | symlinks shouldn't be followed | |
119 | $ rm b |
|
120 | $ rm b | |
120 | $ echo This is file b1 > .hg/b |
|
121 | $ echo This is file b1 > .hg/b | |
121 | $ ln -s .hg/b b |
|
122 | $ ln -s .hg/b b | |
122 | $ hg merge 1 |
|
123 | $ hg merge 1 | |
123 | b: untracked file differs |
|
124 | b: untracked file differs | |
124 | abort: untracked files in working directory differ from files in requested revision |
|
125 | abort: untracked files in working directory differ from files in requested revision | |
125 | [255] |
|
126 | [255] | |
126 |
|
127 | |||
127 | $ rm b |
|
128 | $ rm b | |
128 | $ echo This is file b2 > b |
|
129 | $ echo This is file b2 > b | |
129 | #endif |
|
130 | #endif | |
130 |
|
131 | |||
131 | bad config |
|
132 | bad config | |
132 | $ hg merge 1 --config merge.checkunknown=x |
|
133 | $ hg merge 1 --config merge.checkunknown=x | |
133 | abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') |
|
134 | abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') | |
134 | [255] |
|
135 | [255] | |
135 | this merge should fail |
|
136 | this merge should fail | |
136 | $ hg merge 1 --config merge.checkunknown=abort |
|
137 | $ hg merge 1 --config merge.checkunknown=abort | |
137 | b: untracked file differs |
|
138 | b: untracked file differs | |
138 | abort: untracked files in working directory differ from files in requested revision |
|
139 | abort: untracked files in working directory differ from files in requested revision | |
139 | [255] |
|
140 | [255] | |
140 |
|
141 | |||
141 | this merge should warn |
|
142 | this merge should warn | |
142 | $ hg merge 1 --config merge.checkunknown=warn |
|
143 | $ hg merge 1 --config merge.checkunknown=warn | |
143 | b: replacing untracked file |
|
144 | b: replacing untracked file | |
144 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
145 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
145 | (branch merge, don't forget to commit) |
|
146 | (branch merge, don't forget to commit) | |
146 | $ cat b.orig |
|
147 | $ cat b.orig | |
147 | This is file b2 |
|
148 | This is file b2 | |
148 | $ hg up --clean 2 |
|
149 | $ hg up --clean 2 | |
149 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
150 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
150 | $ mv b.orig b |
|
151 | $ mv b.orig b | |
151 |
|
152 | |||
152 | this merge should silently ignore |
|
153 | this merge should silently ignore | |
153 | $ cat b |
|
154 | $ cat b | |
154 | This is file b2 |
|
155 | This is file b2 | |
155 | $ hg merge 1 --config merge.checkunknown=ignore |
|
156 | $ hg merge 1 --config merge.checkunknown=ignore | |
156 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
157 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
157 | (branch merge, don't forget to commit) |
|
158 | (branch merge, don't forget to commit) | |
158 |
|
159 | |||
159 | merge.checkignored |
|
160 | merge.checkignored | |
160 | $ hg up --clean 1 |
|
161 | $ hg up --clean 1 | |
161 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
162 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
162 | $ cat >> .hgignore << EOF |
|
163 | $ cat >> .hgignore << EOF | |
163 | > remoteignored |
|
164 | > remoteignored | |
164 | > EOF |
|
165 | > EOF | |
165 | $ echo This is file localignored3 > localignored |
|
166 | $ echo This is file localignored3 > localignored | |
166 | $ echo This is file remoteignored3 > remoteignored |
|
167 | $ echo This is file remoteignored3 > remoteignored | |
167 | $ hg add .hgignore localignored remoteignored |
|
168 | $ hg add .hgignore localignored remoteignored | |
168 | $ hg commit -m "commit #3" |
|
169 | $ hg commit -m "commit #3" | |
169 |
|
170 | |||
170 | $ hg up 2 |
|
171 | $ hg up 2 | |
171 | 1 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
172 | 1 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
172 | $ cat >> .hgignore << EOF |
|
173 | $ cat >> .hgignore << EOF | |
173 | > localignored |
|
174 | > localignored | |
174 | > EOF |
|
175 | > EOF | |
175 | $ hg add .hgignore |
|
176 | $ hg add .hgignore | |
176 | $ hg commit -m "commit #4" |
|
177 | $ hg commit -m "commit #4" | |
177 |
|
178 | |||
178 | remote .hgignore shouldn't be used for determining whether a file is ignored |
|
179 | remote .hgignore shouldn't be used for determining whether a file is ignored | |
179 | $ echo This is file remoteignored4 > remoteignored |
|
180 | $ echo This is file remoteignored4 > remoteignored | |
180 | $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort |
|
181 | $ hg merge 3 --config merge.checkignored=ignore --config merge.checkunknown=abort | |
181 | remoteignored: untracked file differs |
|
182 | remoteignored: untracked file differs | |
182 | abort: untracked files in working directory differ from files in requested revision |
|
183 | abort: untracked files in working directory differ from files in requested revision | |
183 | [255] |
|
184 | [255] | |
184 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore |
|
185 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore | |
185 | merging .hgignore |
|
186 | merging .hgignore | |
186 | merging for .hgignore |
|
187 | merging for .hgignore | |
187 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
188 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
188 | (branch merge, don't forget to commit) |
|
189 | (branch merge, don't forget to commit) | |
189 | $ cat remoteignored |
|
190 | $ cat remoteignored | |
190 | This is file remoteignored3 |
|
191 | This is file remoteignored3 | |
191 | $ cat remoteignored.orig |
|
192 | $ cat remoteignored.orig | |
192 | This is file remoteignored4 |
|
193 | This is file remoteignored4 | |
193 | $ rm remoteignored.orig |
|
194 | $ rm remoteignored.orig | |
194 |
|
195 | |||
195 | local .hgignore should be used for that |
|
196 | local .hgignore should be used for that | |
196 | $ hg up --clean 4 |
|
197 | $ hg up --clean 4 | |
197 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
198 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
198 | $ echo This is file localignored4 > localignored |
|
199 | $ echo This is file localignored4 > localignored | |
199 | also test other conflicting files to see we output the full set of warnings |
|
200 | also test other conflicting files to see we output the full set of warnings | |
200 | $ echo This is file b2 > b |
|
201 | $ echo This is file b2 > b | |
201 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort |
|
202 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=abort | |
202 | b: untracked file differs |
|
203 | b: untracked file differs | |
203 | localignored: untracked file differs |
|
204 | localignored: untracked file differs | |
204 | abort: untracked files in working directory differ from files in requested revision |
|
205 | abort: untracked files in working directory differ from files in requested revision | |
205 | [255] |
|
206 | [255] | |
206 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore |
|
207 | $ hg merge 3 --config merge.checkignored=abort --config merge.checkunknown=ignore | |
207 | localignored: untracked file differs |
|
208 | localignored: untracked file differs | |
208 | abort: untracked files in working directory differ from files in requested revision |
|
209 | abort: untracked files in working directory differ from files in requested revision | |
209 | [255] |
|
210 | [255] | |
210 | $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort |
|
211 | $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=abort | |
211 | b: untracked file differs |
|
212 | b: untracked file differs | |
212 | abort: untracked files in working directory differ from files in requested revision |
|
213 | abort: untracked files in working directory differ from files in requested revision | |
213 | [255] |
|
214 | [255] | |
214 | $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn |
|
215 | $ hg merge 3 --config merge.checkignored=warn --config merge.checkunknown=warn | |
215 | b: replacing untracked file |
|
216 | b: replacing untracked file | |
216 | localignored: replacing untracked file |
|
217 | localignored: replacing untracked file | |
217 | merging .hgignore |
|
218 | merging .hgignore | |
218 | merging for .hgignore |
|
219 | merging for .hgignore | |
219 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
220 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
220 | (branch merge, don't forget to commit) |
|
221 | (branch merge, don't forget to commit) | |
221 | $ cat localignored |
|
222 | $ cat localignored | |
222 | This is file localignored3 |
|
223 | This is file localignored3 | |
223 | $ cat localignored.orig |
|
224 | $ cat localignored.orig | |
224 | This is file localignored4 |
|
225 | This is file localignored4 | |
225 | $ rm localignored.orig |
|
226 | $ rm localignored.orig | |
226 |
|
227 | |||
227 | $ cat b.orig |
|
228 | $ cat b.orig | |
228 | This is file b2 |
|
229 | This is file b2 | |
229 | $ hg up --clean 2 |
|
230 | $ hg up --clean 2 | |
230 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
231 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
231 | $ mv b.orig b |
|
232 | $ mv b.orig b | |
232 |
|
233 | |||
233 | this merge of b should work |
|
234 | this merge of b should work | |
234 | $ cat b |
|
235 | $ cat b | |
235 | This is file b2 |
|
236 | This is file b2 | |
236 | $ hg merge -f 1 |
|
237 | $ hg merge -f 1 | |
237 | merging b |
|
238 | merging b | |
238 | merging for b |
|
239 | merging for b | |
239 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
240 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
240 | (branch merge, don't forget to commit) |
|
241 | (branch merge, don't forget to commit) | |
241 | $ hg diff --nodates |
|
242 | $ hg diff --nodates | |
242 | diff -r 49035e18a8e6 b |
|
243 | diff -r 49035e18a8e6 b | |
243 | --- /dev/null |
|
244 | --- /dev/null | |
244 | +++ b/b |
|
245 | +++ b/b | |
245 | @@ -0,0 +1,1 @@ |
|
246 | @@ -0,0 +1,1 @@ | |
246 | +This is file b2 |
|
247 | +This is file b2 | |
247 | $ hg status |
|
248 | $ hg status | |
248 | M b |
|
249 | M b | |
249 | $ cd ..; rm -r t |
|
250 | $ cd ..; rm -r t | |
250 |
|
251 | |||
251 | $ hg init t |
|
252 | $ hg init t | |
252 | $ cd t |
|
253 | $ cd t | |
253 | $ echo This is file a1 > a |
|
254 | $ echo This is file a1 > a | |
254 | $ hg add a |
|
255 | $ hg add a | |
255 | $ hg commit -m "commit #0" |
|
256 | $ hg commit -m "commit #0" | |
256 | $ echo This is file b1 > b |
|
257 | $ echo This is file b1 > b | |
257 | $ hg add b |
|
258 | $ hg add b | |
258 | $ hg commit -m "commit #1" |
|
259 | $ hg commit -m "commit #1" | |
259 | $ echo This is file b22 > b |
|
260 | $ echo This is file b22 > b | |
260 | $ hg commit -m "commit #2" |
|
261 | $ hg commit -m "commit #2" | |
261 | $ hg update 1 |
|
262 | $ hg update 1 | |
262 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
263 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
263 | $ echo This is file c1 > c |
|
264 | $ echo This is file c1 > c | |
264 | $ hg add c |
|
265 | $ hg add c | |
265 | $ hg commit -m "commit #3" |
|
266 | $ hg commit -m "commit #3" | |
266 | created new head |
|
267 | created new head | |
267 |
|
268 | |||
268 | Contents of b should be "this is file b1" |
|
269 | Contents of b should be "this is file b1" | |
269 | $ cat b |
|
270 | $ cat b | |
270 | This is file b1 |
|
271 | This is file b1 | |
271 |
|
272 | |||
272 | $ echo This is file b22 > b |
|
273 | $ echo This is file b22 > b | |
273 | merge fails |
|
274 | merge fails | |
274 | $ hg merge 2 |
|
275 | $ hg merge 2 | |
275 | abort: uncommitted changes |
|
276 | abort: uncommitted changes | |
276 | (use 'hg status' to list changes) |
|
277 | (use 'hg status' to list changes) | |
277 | [255] |
|
278 | [255] | |
278 | merge expected! |
|
279 | merge expected! | |
279 | $ hg merge -f 2 |
|
280 | $ hg merge -f 2 | |
280 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
281 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
281 | (branch merge, don't forget to commit) |
|
282 | (branch merge, don't forget to commit) | |
282 | $ hg diff --nodates |
|
283 | $ hg diff --nodates | |
283 | diff -r 85de557015a8 b |
|
284 | diff -r 85de557015a8 b | |
284 | --- a/b |
|
285 | --- a/b | |
285 | +++ b/b |
|
286 | +++ b/b | |
286 | @@ -1,1 +1,1 @@ |
|
287 | @@ -1,1 +1,1 @@ | |
287 | -This is file b1 |
|
288 | -This is file b1 | |
288 | +This is file b22 |
|
289 | +This is file b22 | |
289 | $ hg status |
|
290 | $ hg status | |
290 | M b |
|
291 | M b | |
291 | $ cd ..; rm -r t |
|
292 | $ cd ..; rm -r t | |
292 |
|
293 | |||
293 | $ hg init t |
|
294 | $ hg init t | |
294 | $ cd t |
|
295 | $ cd t | |
295 | $ echo This is file a1 > a |
|
296 | $ echo This is file a1 > a | |
296 | $ hg add a |
|
297 | $ hg add a | |
297 | $ hg commit -m "commit #0" |
|
298 | $ hg commit -m "commit #0" | |
298 | $ echo This is file b1 > b |
|
299 | $ echo This is file b1 > b | |
299 | $ hg add b |
|
300 | $ hg add b | |
300 | $ hg commit -m "commit #1" |
|
301 | $ hg commit -m "commit #1" | |
301 | $ echo This is file b22 > b |
|
302 | $ echo This is file b22 > b | |
302 | $ hg commit -m "commit #2" |
|
303 | $ hg commit -m "commit #2" | |
303 | $ hg update 1 |
|
304 | $ hg update 1 | |
304 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
305 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
305 | $ echo This is file c1 > c |
|
306 | $ echo This is file c1 > c | |
306 | $ hg add c |
|
307 | $ hg add c | |
307 | $ hg commit -m "commit #3" |
|
308 | $ hg commit -m "commit #3" | |
308 | created new head |
|
309 | created new head | |
309 | $ echo This is file b33 > b |
|
310 | $ echo This is file b33 > b | |
310 | merge of b should fail |
|
311 | merge of b should fail | |
311 | $ hg merge 2 |
|
312 | $ hg merge 2 | |
312 | abort: uncommitted changes |
|
313 | abort: uncommitted changes | |
313 | (use 'hg status' to list changes) |
|
314 | (use 'hg status' to list changes) | |
314 | [255] |
|
315 | [255] | |
315 | merge of b expected |
|
316 | merge of b expected | |
316 | $ hg merge -f 2 |
|
317 | $ hg merge -f 2 | |
317 | merging b |
|
318 | merging b | |
318 | merging for b |
|
319 | merging for b | |
319 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
320 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
320 | (branch merge, don't forget to commit) |
|
321 | (branch merge, don't forget to commit) | |
321 | $ hg diff --nodates |
|
322 | $ hg diff --nodates | |
322 | diff -r 85de557015a8 b |
|
323 | diff -r 85de557015a8 b | |
323 | --- a/b |
|
324 | --- a/b | |
324 | +++ b/b |
|
325 | +++ b/b | |
325 | @@ -1,1 +1,1 @@ |
|
326 | @@ -1,1 +1,1 @@ | |
326 | -This is file b1 |
|
327 | -This is file b1 | |
327 | +This is file b33 |
|
328 | +This is file b33 | |
328 | $ hg status |
|
329 | $ hg status | |
329 | M b |
|
330 | M b | |
330 |
|
331 | |||
331 | Test for issue2364 |
|
332 | Test for issue2364 | |
332 |
|
333 | |||
333 | $ hg up -qC . |
|
334 | $ hg up -qC . | |
334 | $ hg rm b |
|
335 | $ hg rm b | |
335 | $ hg ci -md |
|
336 | $ hg ci -md | |
336 | $ hg revert -r -2 b |
|
337 | $ hg revert -r -2 b | |
337 | $ hg up -q -- -2 |
|
338 | $ hg up -q -- -2 | |
338 |
|
339 | |||
339 | Test that updated files are treated as "modified", when |
|
340 | Test that updated files are treated as "modified", when | |
340 | 'merge.update()' is aborted before 'merge.recordupdates()' (= parents |
|
341 | 'merge.update()' is aborted before 'merge.recordupdates()' (= parents | |
341 | aren't changed), even if none of mode, size and timestamp of them |
|
342 | aren't changed), even if none of mode, size and timestamp of them | |
342 | isn't changed on the filesystem (see also issue4583). |
|
343 | isn't changed on the filesystem (see also issue4583). | |
343 |
|
344 | |||
344 | $ cat > $TESTTMP/abort.py <<EOF |
|
345 | $ cat > $TESTTMP/abort.py <<EOF | |
345 | > from __future__ import absolute_import |
|
346 | > from __future__ import absolute_import | |
346 | > # emulate aborting before "recordupdates()". in this case, files |
|
347 | > # emulate aborting before "recordupdates()". in this case, files | |
347 | > # are changed without updating dirstate |
|
348 | > # are changed without updating dirstate | |
348 | > from mercurial import ( |
|
349 | > from mercurial import ( | |
349 | > error, |
|
350 | > error, | |
350 | > extensions, |
|
351 | > extensions, | |
351 | > merge, |
|
352 | > merge, | |
352 | > ) |
|
353 | > ) | |
353 | > def applyupdates(orig, *args, **kwargs): |
|
354 | > def applyupdates(orig, *args, **kwargs): | |
354 | > orig(*args, **kwargs) |
|
355 | > orig(*args, **kwargs) | |
355 | > raise error.Abort('intentional aborting') |
|
356 | > raise error.Abort('intentional aborting') | |
356 | > def extsetup(ui): |
|
357 | > def extsetup(ui): | |
357 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) |
|
358 | > extensions.wrapfunction(merge, "applyupdates", applyupdates) | |
358 | > EOF |
|
359 | > EOF | |
359 |
|
360 | |||
360 | $ cat >> .hg/hgrc <<EOF |
|
361 | $ cat >> .hg/hgrc <<EOF | |
361 | > [fakedirstatewritetime] |
|
362 | > [fakedirstatewritetime] | |
362 | > # emulate invoking dirstate.write() via repo.status() |
|
363 | > # emulate invoking dirstate.write() via repo.status() | |
363 | > # at 2000-01-01 00:00 |
|
364 | > # at 2000-01-01 00:00 | |
364 | > fakenow = 200001010000 |
|
365 | > fakenow = 200001010000 | |
365 | > EOF |
|
366 | > EOF | |
366 |
|
367 | |||
367 | (file gotten from other revision) |
|
368 | (file gotten from other revision) | |
368 |
|
369 | |||
369 | $ hg update -q -C 2 |
|
370 | $ hg update -q -C 2 | |
370 | $ echo 'THIS IS FILE B5' > b |
|
371 | $ echo 'THIS IS FILE B5' > b | |
371 | $ hg commit -m 'commit #5' |
|
372 | $ hg commit -m 'commit #5' | |
372 |
|
373 | |||
373 | $ hg update -q -C 3 |
|
374 | $ hg update -q -C 3 | |
374 | $ cat b |
|
375 | $ cat b | |
375 | This is file b1 |
|
376 | This is file b1 | |
376 | $ touch -t 200001010000 b |
|
377 | $ touch -t 200001010000 b | |
377 | $ hg debugrebuildstate |
|
378 | $ hg debugrebuildstate | |
378 |
|
379 | |||
379 | $ cat >> .hg/hgrc <<EOF |
|
380 | $ cat >> .hg/hgrc <<EOF | |
380 | > [extensions] |
|
381 | > [extensions] | |
381 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
382 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
382 | > abort = $TESTTMP/abort.py |
|
383 | > abort = $TESTTMP/abort.py | |
383 | > EOF |
|
384 | > EOF | |
384 | $ hg merge 5 |
|
385 | $ hg merge 5 | |
385 | abort: intentional aborting |
|
386 | abort: intentional aborting | |
386 | [255] |
|
387 | [255] | |
387 | $ cat >> .hg/hgrc <<EOF |
|
388 | $ cat >> .hg/hgrc <<EOF | |
388 | > [extensions] |
|
389 | > [extensions] | |
389 | > fakedirstatewritetime = ! |
|
390 | > fakedirstatewritetime = ! | |
390 | > abort = ! |
|
391 | > abort = ! | |
391 | > EOF |
|
392 | > EOF | |
392 |
|
393 | |||
393 | $ cat b |
|
394 | $ cat b | |
394 | THIS IS FILE B5 |
|
395 | THIS IS FILE B5 | |
395 | $ touch -t 200001010000 b |
|
396 | $ touch -t 200001010000 b | |
396 | $ hg status -A b |
|
397 | $ hg status -A b | |
397 | M b |
|
398 | M b | |
398 |
|
399 | |||
399 | (file merged from other revision) |
|
400 | (file merged from other revision) | |
400 |
|
401 | |||
401 | $ hg update -q -C 3 |
|
402 | $ hg update -q -C 3 | |
402 | $ echo 'this is file b6' > b |
|
403 | $ echo 'this is file b6' > b | |
403 | $ hg commit -m 'commit #6' |
|
404 | $ hg commit -m 'commit #6' | |
404 | created new head |
|
405 | created new head | |
405 |
|
406 | |||
406 | $ cat b |
|
407 | $ cat b | |
407 | this is file b6 |
|
408 | this is file b6 | |
408 | $ touch -t 200001010000 b |
|
409 | $ touch -t 200001010000 b | |
409 | $ hg debugrebuildstate |
|
410 | $ hg debugrebuildstate | |
410 |
|
411 | |||
411 | $ cat >> .hg/hgrc <<EOF |
|
412 | $ cat >> .hg/hgrc <<EOF | |
412 | > [extensions] |
|
413 | > [extensions] | |
413 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py |
|
414 | > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py | |
414 | > abort = $TESTTMP/abort.py |
|
415 | > abort = $TESTTMP/abort.py | |
415 | > EOF |
|
416 | > EOF | |
416 | $ hg merge --tool internal:other 5 |
|
417 | $ hg merge --tool internal:other 5 | |
417 | abort: intentional aborting |
|
418 | abort: intentional aborting | |
418 | [255] |
|
419 | [255] | |
419 | $ cat >> .hg/hgrc <<EOF |
|
420 | $ cat >> .hg/hgrc <<EOF | |
420 | > [extensions] |
|
421 | > [extensions] | |
421 | > fakedirstatewritetime = ! |
|
422 | > fakedirstatewritetime = ! | |
422 | > abort = ! |
|
423 | > abort = ! | |
423 | > EOF |
|
424 | > EOF | |
424 |
|
425 | |||
425 | $ cat b |
|
426 | $ cat b | |
426 | THIS IS FILE B5 |
|
427 | THIS IS FILE B5 | |
427 | $ touch -t 200001010000 b |
|
428 | $ touch -t 200001010000 b | |
428 | $ hg status -A b |
|
429 | $ hg status -A b | |
429 | M b |
|
430 | M b | |
430 |
|
431 | |||
431 | $ cd .. |
|
432 | $ cd .. |
@@ -1,92 +1,93 | |||||
1 | Test update logic when there are renames or weird same-name cases between dirs |
|
1 | Test update logic when there are renames or weird same-name cases between dirs | |
2 | and files |
|
2 | and files | |
3 |
|
3 | |||
4 | Update with local changes across a file rename |
|
4 | Update with local changes across a file rename | |
5 |
|
5 | |||
6 | $ hg init r1 && cd r1 |
|
6 | $ hg init r1 && cd r1 | |
7 |
|
7 | |||
8 | $ echo a > a |
|
8 | $ echo a > a | |
9 | $ hg add a |
|
9 | $ hg add a | |
10 | $ hg ci -m a |
|
10 | $ hg ci -m a | |
11 |
|
11 | |||
12 | $ hg mv a b |
|
12 | $ hg mv a b | |
13 | $ hg ci -m rename |
|
13 | $ hg ci -m rename | |
14 |
|
14 | |||
15 | $ echo b > b |
|
15 | $ echo b > b | |
16 | $ hg ci -m change |
|
16 | $ hg ci -m change | |
17 |
|
17 | |||
18 | $ hg up -q 0 |
|
18 | $ hg up -q 0 | |
19 |
|
19 | |||
20 | $ echo c > a |
|
20 | $ echo c > a | |
21 |
|
21 | |||
22 | $ hg up |
|
22 | $ hg up | |
23 | merging a and b to b |
|
23 | merging a and b to b | |
24 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') |
|
24 | warning: conflicts while merging b! (edit, then use 'hg resolve --mark') | |
25 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
25 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
26 | use 'hg resolve' to retry unresolved file merges |
|
26 | use 'hg resolve' to retry unresolved file merges | |
27 | [1] |
|
27 | [1] | |
28 |
|
28 | |||
29 | Test update when local untracked directory exists with the same name as a |
|
29 | Test update when local untracked directory exists with the same name as a | |
30 | tracked file in a commit we are updating to |
|
30 | tracked file in a commit we are updating to | |
31 | $ hg init r2 && cd r2 |
|
31 | $ hg init r2 && cd r2 | |
32 | $ echo root > root && hg ci -Am root # rev 0 |
|
32 | $ echo root > root && hg ci -Am root # rev 0 | |
33 | adding root |
|
33 | adding root | |
34 | $ echo text > name && hg ci -Am "name is a file" # rev 1 |
|
34 | $ echo text > name && hg ci -Am "name is a file" # rev 1 | |
35 | adding name |
|
35 | adding name | |
36 | $ hg up 0 |
|
36 | $ hg up 0 | |
37 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
37 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
38 | $ mkdir name |
|
38 | $ mkdir name | |
39 | $ hg up 1 |
|
39 | $ hg up 1 | |
40 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
40 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
41 |
|
41 | |||
42 | Test update when local untracked directory exists with some files in it and has |
|
42 | Test update when local untracked directory exists with some files in it and has | |
43 | the same name a tracked file in a commit we are updating to. In future this |
|
43 | the same name a tracked file in a commit we are updating to. In future this | |
44 | should be updated to give an friendlier error message, but now we should just |
|
44 | should be updated to give an friendlier error message, but now we should just | |
45 | make sure that this does not erase untracked data |
|
45 | make sure that this does not erase untracked data | |
46 | $ hg up 0 |
|
46 | $ hg up 0 | |
47 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
47 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
48 | $ mkdir name |
|
48 | $ mkdir name | |
49 | $ echo text > name/file |
|
49 | $ echo text > name/file | |
50 | $ hg st |
|
50 | $ hg st | |
51 | ? name/file |
|
51 | ? name/file | |
52 | $ hg up 1 |
|
52 | $ hg up 1 | |
53 |
abort: |
|
53 | abort: Unlinking directory not permitted: '$TESTTMP/r1/r2/name' (windows !) | |
|
54 | abort: Directory not empty: '$TESTTMP/r1/r2/name' (no-windows !) | |||
54 | [255] |
|
55 | [255] | |
55 | $ cat name/file |
|
56 | $ cat name/file | |
56 | text |
|
57 | text | |
57 | $ cd .. |
|
58 | $ cd .. | |
58 |
|
59 | |||
59 | #if symlink |
|
60 | #if symlink | |
60 |
|
61 | |||
61 | Test update when two commits have symlinks that point to different folders |
|
62 | Test update when two commits have symlinks that point to different folders | |
62 | $ hg init r3 && cd r3 |
|
63 | $ hg init r3 && cd r3 | |
63 | $ echo root > root && hg ci -Am root |
|
64 | $ echo root > root && hg ci -Am root | |
64 | adding root |
|
65 | adding root | |
65 | $ mkdir folder1 && mkdir folder2 |
|
66 | $ mkdir folder1 && mkdir folder2 | |
66 | $ ln -s folder1 folder |
|
67 | $ ln -s folder1 folder | |
67 | $ hg ci -Am "symlink to folder1" |
|
68 | $ hg ci -Am "symlink to folder1" | |
68 | adding folder |
|
69 | adding folder | |
69 | $ rm folder |
|
70 | $ rm folder | |
70 | $ ln -s folder2 folder |
|
71 | $ ln -s folder2 folder | |
71 | $ hg ci -Am "symlink to folder2" |
|
72 | $ hg ci -Am "symlink to folder2" | |
72 | $ hg up 1 |
|
73 | $ hg up 1 | |
73 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
74 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
74 | $ cd .. |
|
75 | $ cd .. | |
75 |
|
76 | |||
76 | #endif |
|
77 | #endif | |
77 |
|
78 | |||
78 | #if rmcwd |
|
79 | #if rmcwd | |
79 |
|
80 | |||
80 | Test that warning is printed if cwd is deleted during update |
|
81 | Test that warning is printed if cwd is deleted during update | |
81 | $ hg init r4 && cd r4 |
|
82 | $ hg init r4 && cd r4 | |
82 | $ mkdir dir |
|
83 | $ mkdir dir | |
83 | $ cd dir |
|
84 | $ cd dir | |
84 | $ echo a > a |
|
85 | $ echo a > a | |
85 | $ echo b > b |
|
86 | $ echo b > b | |
86 | $ hg add a b |
|
87 | $ hg add a b | |
87 | $ hg ci -m "file and dir" |
|
88 | $ hg ci -m "file and dir" | |
88 | $ hg up -q null |
|
89 | $ hg up -q null | |
89 | current directory was removed |
|
90 | current directory was removed | |
90 | (consider changing to repo root: $TESTTMP/r1/r4) |
|
91 | (consider changing to repo root: $TESTTMP/r1/r4) | |
91 |
|
92 | |||
92 | #endif |
|
93 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now