Show More
@@ -0,0 +1,46 b'' | |||
|
1 | #!/bin/sh | |
|
2 | ||
|
3 | hg init | |
|
4 | ||
|
5 | echo foo > a | |
|
6 | echo foo > b | |
|
7 | hg add a b | |
|
8 | ||
|
9 | hg ci -m "test" -d "0 0" | |
|
10 | ||
|
11 | echo blah > a | |
|
12 | ||
|
13 | hg ci -m "branch a" -d "0 0" | |
|
14 | ||
|
15 | hg co 0 | |
|
16 | ||
|
17 | echo blah > b | |
|
18 | ||
|
19 | hg ci -m "branch b" -d "0 0" | |
|
20 | HGMERGE=true hg up -m 1 | |
|
21 | ||
|
22 | hg ci -m "merge b/a -> blah" -d "0 0" | |
|
23 | ||
|
24 | hg co 1 | |
|
25 | HGMERGE=true hg up -m 2 | |
|
26 | hg ci -m "merge a/b -> blah" -d "0 0" | |
|
27 | ||
|
28 | hg log | |
|
29 | hg debugindex .hg/00changelog.i | |
|
30 | ||
|
31 | echo | |
|
32 | ||
|
33 | echo 1 | |
|
34 | hg manifest 1 | |
|
35 | echo 2 | |
|
36 | hg manifest 2 | |
|
37 | echo 3 | |
|
38 | hg manifest 3 | |
|
39 | echo 4 | |
|
40 | hg manifest 4 | |
|
41 | ||
|
42 | echo | |
|
43 | ||
|
44 | hg debugindex .hg/data/a.i | |
|
45 | ||
|
46 | hg verify No newline at end of file |
@@ -0,0 +1,59 b'' | |||
|
1 | changeset: 4:2ee31f665a86 | |
|
2 | tag: tip | |
|
3 | parent: 1:96155394af80 | |
|
4 | parent: 2:92cc4c306b19 | |
|
5 | user: test | |
|
6 | date: Thu Jan 1 00:00:00 1970 +0000 | |
|
7 | summary: merge a/b -> blah | |
|
8 | ||
|
9 | changeset: 3:e16a66a37edd | |
|
10 | parent: 2:92cc4c306b19 | |
|
11 | parent: 1:96155394af80 | |
|
12 | user: test | |
|
13 | date: Thu Jan 1 00:00:00 1970 +0000 | |
|
14 | summary: merge b/a -> blah | |
|
15 | ||
|
16 | changeset: 2:92cc4c306b19 | |
|
17 | parent: 0:5e0375449e74 | |
|
18 | user: test | |
|
19 | date: Thu Jan 1 00:00:00 1970 +0000 | |
|
20 | summary: branch b | |
|
21 | ||
|
22 | changeset: 1:96155394af80 | |
|
23 | user: test | |
|
24 | date: Thu Jan 1 00:00:00 1970 +0000 | |
|
25 | summary: branch a | |
|
26 | ||
|
27 | changeset: 0:5e0375449e74 | |
|
28 | user: test | |
|
29 | date: Thu Jan 1 00:00:00 1970 +0000 | |
|
30 | summary: test | |
|
31 | ||
|
32 | rev offset length base linkrev nodeid p1 p2 | |
|
33 | 0 0 60 0 0 5e0375449e74 000000000000 000000000000 | |
|
34 | 1 60 62 1 1 96155394af80 5e0375449e74 000000000000 | |
|
35 | 2 122 62 2 2 92cc4c306b19 5e0375449e74 000000000000 | |
|
36 | 3 184 69 3 3 e16a66a37edd 92cc4c306b19 96155394af80 | |
|
37 | 4 253 29 3 4 2ee31f665a86 96155394af80 92cc4c306b19 | |
|
38 | ||
|
39 | 1 | |
|
40 | 79d7492df40aa0fa093ec4209be78043c181f094 644 a | |
|
41 | 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 b | |
|
42 | 2 | |
|
43 | 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 a | |
|
44 | 79d7492df40aa0fa093ec4209be78043c181f094 644 b | |
|
45 | 3 | |
|
46 | 79d7492df40aa0fa093ec4209be78043c181f094 644 a | |
|
47 | 79d7492df40aa0fa093ec4209be78043c181f094 644 b | |
|
48 | 4 | |
|
49 | 79d7492df40aa0fa093ec4209be78043c181f094 644 a | |
|
50 | 79d7492df40aa0fa093ec4209be78043c181f094 644 b | |
|
51 | ||
|
52 | rev offset length base linkrev nodeid p1 p2 | |
|
53 | 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000 | |
|
54 | 1 5 6 1 1 79d7492df40a 2ed2a3912a0b 000000000000 | |
|
55 | checking changesets | |
|
56 | checking manifests | |
|
57 | crosschecking files in changesets and manifests | |
|
58 | checking files | |
|
59 | 2 files, 5 changesets, 4 total revisions |
@@ -2580,17 +2580,20 b' norepo = ("clone init version help debug' | |||
|
2580 | 2580 | def find(cmd): |
|
2581 | 2581 | """Return (aliases, command table entry) for command string.""" |
|
2582 | 2582 | choice = None |
|
2583 | count = 0 | |
|
2583 | 2584 | for e in table.keys(): |
|
2584 | 2585 | aliases = e.lstrip("^").split("|") |
|
2585 | 2586 | if cmd in aliases: |
|
2586 | 2587 | return aliases, table[e] |
|
2587 | 2588 | for a in aliases: |
|
2588 | 2589 | if a.startswith(cmd): |
|
2589 |
|
|
|
2590 | raise AmbiguousCommand(cmd) | |
|
2591 |
|
|
|
2592 | choice = aliases, table[e] | |
|
2593 | break | |
|
2590 | count += 1 | |
|
2591 | choice = aliases, table[e] | |
|
2592 | break | |
|
2593 | ||
|
2594 | if count > 1: | |
|
2595 | raise AmbiguousCommand(cmd) | |
|
2596 | ||
|
2594 | 2597 | if choice: |
|
2595 | 2598 | return choice |
|
2596 | 2599 |
@@ -274,6 +274,25 b' class localrepository(object):' | |||
|
274 | 274 | self.dirstate.read() |
|
275 | 275 | return wlock |
|
276 | 276 | |
|
277 | def checkfilemerge(self, filename, text, filelog, manifest1, manifest2): | |
|
278 | "determine whether a new filenode is needed" | |
|
279 | fp1 = manifest1.get(filename, nullid) | |
|
280 | fp2 = manifest2.get(filename, nullid) | |
|
281 | ||
|
282 | if fp2 != nullid: | |
|
283 | # is one parent an ancestor of the other? | |
|
284 | fpa = filelog.ancestor(fp1, fp2) | |
|
285 | if fpa == fp1: | |
|
286 | fp1, fp2 = fp2, nullid | |
|
287 | elif fpa == fp2: | |
|
288 | fp2 = nullid | |
|
289 | ||
|
290 | # is the file unmodified from the parent? report existing entry | |
|
291 | if fp2 == nullid and text == filelog.read(fp1): | |
|
292 | return (fp1, None, None) | |
|
293 | ||
|
294 | return (None, fp1, fp2) | |
|
295 | ||
|
277 | 296 | def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): |
|
278 | 297 | orig_parent = self.dirstate.parents()[0] or nullid |
|
279 | 298 | p1 = p1 or self.dirstate.parents()[0] or nullid |
@@ -304,27 +323,10 b' class localrepository(object):' | |||
|
304 | 323 | r = self.file(f) |
|
305 | 324 | mfm[f] = tm |
|
306 | 325 | |
|
307 | fp1 = m1.get(f, nullid) | |
|
308 |
f |
|
|
309 | ||
|
310 | # is the same revision on two branches of a merge? | |
|
311 | if fp2 == fp1: | |
|
312 | fp2 = nullid | |
|
313 | ||
|
314 | if fp2 != nullid: | |
|
315 | # is one parent an ancestor of the other? | |
|
316 | fpa = r.ancestor(fp1, fp2) | |
|
317 | if fpa == fp1: | |
|
318 | fp1, fp2 = fp2, nullid | |
|
319 | elif fpa == fp2: | |
|
320 | fp2 = nullid | |
|
321 | ||
|
322 | # is the file unmodified from the parent? | |
|
323 | if t == r.read(fp1): | |
|
324 | # record the proper existing parent in manifest | |
|
325 | # no need to add a revision | |
|
326 | mm[f] = fp1 | |
|
327 | continue | |
|
326 | (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2) | |
|
327 | if entry: | |
|
328 | mm[f] = entry | |
|
329 | continue | |
|
328 | 330 | |
|
329 | 331 | mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) |
|
330 | 332 | changed.append(f) |
@@ -412,22 +414,9 b' class localrepository(object):' | |||
|
412 | 414 | self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) |
|
413 | 415 | fp1, fp2 = nullid, nullid |
|
414 | 416 | else: |
|
415 | fp1 = m1.get(f, nullid) | |
|
416 |
f |
|
|
417 | ||
|
418 | if fp2 != nullid: | |
|
419 | # is one parent an ancestor of the other? | |
|
420 | fpa = r.ancestor(fp1, fp2) | |
|
421 | if fpa == fp1: | |
|
422 | fp1, fp2 = fp2, nullid | |
|
423 | elif fpa == fp2: | |
|
424 | fp2 = nullid | |
|
425 | ||
|
426 | # is the file unmodified from the parent? | |
|
427 | if not meta and t == r.read(fp1) and fp2 == nullid: | |
|
428 | # record the proper existing parent in manifest | |
|
429 | # no need to add a revision | |
|
430 | new[f] = fp1 | |
|
417 | entry, fp1, fp2 = self.checkfilemerge(f, t, r, m1, m2) | |
|
418 | if entry: | |
|
419 | new[f] = entry | |
|
431 | 420 | continue |
|
432 | 421 | |
|
433 | 422 | new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
General Comments 0
You need to be logged in to leave comments.
Login now