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 |
@@ -268,6 +268,25 b' class localrepository(object):' | |||||
268 | self.dirstate.read() |
|
268 | self.dirstate.read() | |
269 | return wlock |
|
269 | return wlock | |
270 |
|
270 | |||
|
271 | def checkfilemerge(self, filename, text, filelog, manifest1, manifest2): | |||
|
272 | "determine whether a new filenode is needed" | |||
|
273 | fp1 = manifest1.get(filename, nullid) | |||
|
274 | fp2 = manifest2.get(filename, nullid) | |||
|
275 | ||||
|
276 | if fp2 != nullid: | |||
|
277 | # is one parent an ancestor of the other? | |||
|
278 | fpa = filelog.ancestor(fp1, fp2) | |||
|
279 | if fpa == fp1: | |||
|
280 | fp1, fp2 = fp2, nullid | |||
|
281 | elif fpa == fp2: | |||
|
282 | fp2 = nullid | |||
|
283 | ||||
|
284 | # is the file unmodified from the parent? report existing entry | |||
|
285 | if fp2 == nullid and text == filelog.read(fp1): | |||
|
286 | return (fp1, None, None) | |||
|
287 | ||||
|
288 | return (None, fp1, fp2) | |||
|
289 | ||||
271 | def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): |
|
290 | def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): | |
272 | orig_parent = self.dirstate.parents()[0] or nullid |
|
291 | orig_parent = self.dirstate.parents()[0] or nullid | |
273 | p1 = p1 or self.dirstate.parents()[0] or nullid |
|
292 | p1 = p1 or self.dirstate.parents()[0] or nullid | |
@@ -298,27 +317,10 b' class localrepository(object):' | |||||
298 | r = self.file(f) |
|
317 | r = self.file(f) | |
299 | mfm[f] = tm |
|
318 | mfm[f] = tm | |
300 |
|
319 | |||
301 | fp1 = m1.get(f, nullid) |
|
320 | (entry, fp1, fp2) = self.checkfilemerge(f, t, r, m1, m2) | |
302 |
f |
|
321 | if entry: | |
303 |
|
322 | mm[f] = entry | ||
304 | # is the same revision on two branches of a merge? |
|
323 | continue | |
305 | if fp2 == fp1: |
|
|||
306 | fp2 = nullid |
|
|||
307 |
|
||||
308 | if fp2 != nullid: |
|
|||
309 | # is one parent an ancestor of the other? |
|
|||
310 | fpa = r.ancestor(fp1, fp2) |
|
|||
311 | if fpa == fp1: |
|
|||
312 | fp1, fp2 = fp2, nullid |
|
|||
313 | elif fpa == fp2: |
|
|||
314 | fp2 = nullid |
|
|||
315 |
|
||||
316 | # is the file unmodified from the parent? |
|
|||
317 | if t == r.read(fp1): |
|
|||
318 | # record the proper existing parent in manifest |
|
|||
319 | # no need to add a revision |
|
|||
320 | mm[f] = fp1 |
|
|||
321 | continue |
|
|||
322 |
|
324 | |||
323 | mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) |
|
325 | mm[f] = r.add(t, {}, tr, linkrev, fp1, fp2) | |
324 | changed.append(f) |
|
326 | changed.append(f) | |
@@ -403,22 +405,9 b' class localrepository(object):' | |||||
403 | self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) |
|
405 | self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) | |
404 | fp1, fp2 = nullid, nullid |
|
406 | fp1, fp2 = nullid, nullid | |
405 | else: |
|
407 | else: | |
406 | fp1 = m1.get(f, nullid) |
|
408 | entry, fp1, fp2 = self.checkfilemerge(f, t, r, m1, m2) | |
407 |
f |
|
409 | if entry: | |
408 |
|
410 | new[f] = entry | ||
409 | if fp2 != nullid: |
|
|||
410 | # is one parent an ancestor of the other? |
|
|||
411 | fpa = r.ancestor(fp1, fp2) |
|
|||
412 | if fpa == fp1: |
|
|||
413 | fp1, fp2 = fp2, nullid |
|
|||
414 | elif fpa == fp2: |
|
|||
415 | fp2 = nullid |
|
|||
416 |
|
||||
417 | # is the file unmodified from the parent? |
|
|||
418 | if not meta and t == r.read(fp1) and fp2 == nullid: |
|
|||
419 | # record the proper existing parent in manifest |
|
|||
420 | # no need to add a revision |
|
|||
421 | new[f] = fp1 |
|
|||
422 | continue |
|
411 | continue | |
423 |
|
412 | |||
424 | new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
|
413 | new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
General Comments 0
You need to be logged in to leave comments.
Login now