Show More
@@ -462,11 +462,33 b' class localrepository(repo.repository):' | |||
|
462 | 462 | desc=_('working directory of %s') % self.origroot) |
|
463 | 463 | |
|
464 | 464 | def checkfilemerge(self, filename, text, filelog, manifest1, manifest2): |
|
465 | "determine whether a new filenode is needed" | |
|
465 | """ | |
|
466 | Determine whether a new filenode is needed and what parent | |
|
467 | and rename information is needed for a file commit. | |
|
468 | ||
|
469 | Returns (old entry, file parent 1, file parent 2, metadata) | |
|
470 | ||
|
471 | If old entry is not None, a commit is not needed. | |
|
472 | """ | |
|
466 | 473 | fp1 = manifest1.get(filename, nullid) |
|
467 | 474 | fp2 = manifest2.get(filename, nullid) |
|
468 | 475 | |
|
469 | if fp2 != nullid: | |
|
476 | meta = {} | |
|
477 | cp = self.dirstate.copied(filename) | |
|
478 | if cp: | |
|
479 | meta["copy"] = cp | |
|
480 | if not manifest2: # not a branch merge | |
|
481 | meta["copyrev"] = hex(manifest1.get(cp, nullid)) | |
|
482 | fp2 = nullid | |
|
483 | elif fp2 != nullid: # copied on remote side | |
|
484 | meta["copyrev"] = hex(manifest1.get(cp, nullid)) | |
|
485 | else: # copied on local side, reversed | |
|
486 | meta["copyrev"] = hex(manifest2.get(cp)) | |
|
487 | fp2 = nullid | |
|
488 | self.ui.debug(_(" %s: copy %s:%s\n") % | |
|
489 | (filename, cp, meta["copyrev"])) | |
|
490 | fp1 = nullid | |
|
491 | elif fp2 != nullid: | |
|
470 | 492 | # is one parent an ancestor of the other? |
|
471 | 493 | fpa = filelog.ancestor(fp1, fp2) |
|
472 | 494 | if fpa == fp1: |
@@ -475,10 +497,10 b' class localrepository(repo.repository):' | |||
|
475 | 497 | fp2 = nullid |
|
476 | 498 | |
|
477 | 499 | # is the file unmodified from the parent? report existing entry |
|
478 |
if fp2 == nullid and |
|
|
479 | return (fp1, None, None) | |
|
500 | if fp2 == nullid and not filelog.cmp(fp1, text): | |
|
501 | return (fp1, None, None, {}) | |
|
480 | 502 | |
|
481 | return (None, fp1, fp2) | |
|
503 | return (None, fp1, fp2, meta) | |
|
482 | 504 | |
|
483 | 505 | def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None): |
|
484 | 506 | orig_parent = self.dirstate.parents()[0] or nullid |
@@ -506,12 +528,12 b' class localrepository(repo.repository):' | |||
|
506 | 528 | m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f))) |
|
507 | 529 | r = self.file(f) |
|
508 | 530 | |
|
509 |
|
|
|
531 | entry, fp1, fp2, meta = self.checkfilemerge(f, t, r, m1, m2) | |
|
510 | 532 | if entry: |
|
511 | 533 | m1[f] = entry |
|
512 | 534 | continue |
|
513 | 535 | |
|
514 |
m1[f] = r.add(t, |
|
|
536 | m1[f] = r.add(t, meta, tr, linkrev, fp1, fp2) | |
|
515 | 537 | changed.append(f) |
|
516 | 538 | if update_dirstate: |
|
517 | 539 | self.dirstate.update([f], "n") |
@@ -589,18 +611,10 b' class localrepository(repo.repository):' | |||
|
589 | 611 | |
|
590 | 612 | r = self.file(f) |
|
591 | 613 | |
|
592 | meta = {} | |
|
593 | cp = self.dirstate.copied(f) | |
|
594 | if cp: | |
|
595 |
|
|
|
596 | meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid))) | |
|
597 | self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"])) | |
|
598 | fp1, fp2 = nullid, nullid | |
|
599 | else: | |
|
600 | entry, fp1, fp2 = self.checkfilemerge(f, t, r, m1, m2) | |
|
601 | if entry: | |
|
602 | new[f] = entry | |
|
603 | continue | |
|
614 | entry, fp1, fp2, meta = self.checkfilemerge(f, t, r, m1, m2) | |
|
615 | if entry: | |
|
616 | new[f] = entry | |
|
617 | continue | |
|
604 | 618 | |
|
605 | 619 | new[f] = r.add(t, meta, tr, linkrev, fp1, fp2) |
|
606 | 620 | # remember what we've added so that we can later calculate |
@@ -359,6 +359,8 b' def recordupdates(repo, action, branchme' | |||
|
359 | 359 | repo.dirstate.update([f], 'r') |
|
360 | 360 | if f != fd: |
|
361 | 361 | repo.dirstate.copy(f, fd) |
|
362 | else: | |
|
363 | repo.dirstate.copy(f2, fd) | |
|
362 | 364 | |
|
363 | 365 | def update(repo, node, branchmerge=False, force=False, partial=None, |
|
364 | 366 | wlock=None, show_stats=True, remind=True): |
@@ -23,3 +23,5 b' hg merge -y --debug' | |||
|
23 | 23 | hg status -AC |
|
24 | 24 | cat b |
|
25 | 25 | hg ci -m "merge" -d "0 0" |
|
26 | hg debugindex .hg/data/b.i | |
|
27 | hg debugrename b No newline at end of file |
@@ -20,3 +20,7 b' M b2' | |||
|
20 | 20 | R a |
|
21 | 21 | C c2 |
|
22 | 22 | blahblah |
|
23 | rev offset length base linkrev nodeid p1 p2 | |
|
24 | 0 0 67 0 1 dc51707dfc98 000000000000 000000000000 | |
|
25 | 1 67 72 1 3 b2494a44f0a9 000000000000 dc51707dfc98 | |
|
26 | renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66 |
@@ -42,6 +42,7 b' 1 files updated, 2 files merged, 0 files' | |||
|
42 | 42 | -------------- |
|
43 | 43 | M a |
|
44 | 44 | M b |
|
45 | a | |
|
45 | 46 | -------------- |
|
46 | 47 | |
|
47 | 48 | -------------- |
@@ -85,6 +86,7 b' 0 files updated, 2 files merged, 0 files' | |||
|
85 | 86 | (branch merge, don't forget to commit) |
|
86 | 87 | -------------- |
|
87 | 88 | M b |
|
89 | a | |
|
88 | 90 | -------------- |
|
89 | 91 | |
|
90 | 92 | -------------- |
@@ -128,6 +130,7 b' 0 files updated, 2 files merged, 0 files' | |||
|
128 | 130 | (branch merge, don't forget to commit) |
|
129 | 131 | -------------- |
|
130 | 132 | M b |
|
133 | a | |
|
131 | 134 | C a |
|
132 | 135 | -------------- |
|
133 | 136 | |
@@ -172,6 +175,7 b' 0 files updated, 2 files merged, 0 files' | |||
|
172 | 175 | (branch merge, don't forget to commit) |
|
173 | 176 | -------------- |
|
174 | 177 | M b |
|
178 | a | |
|
175 | 179 | -------------- |
|
176 | 180 | |
|
177 | 181 | -------------- |
@@ -430,6 +434,7 b' 0 files updated, 2 files merged, 0 files' | |||
|
430 | 434 | (branch merge, don't forget to commit) |
|
431 | 435 | -------------- |
|
432 | 436 | M b |
|
437 | a | |
|
433 | 438 | -------------- |
|
434 | 439 | |
|
435 | 440 | -------------- |
@@ -452,6 +457,7 b' 1 files updated, 2 files merged, 0 files' | |||
|
452 | 457 | (branch merge, don't forget to commit) |
|
453 | 458 | -------------- |
|
454 | 459 | M b |
|
460 | a | |
|
455 | 461 | M c |
|
456 | 462 | -------------- |
|
457 | 463 |
General Comments 0
You need to be logged in to leave comments.
Login now