##// END OF EJS Templates
merge: let bid merge work on the file->action dict...
Martin von Zweigbergk -
r23638:09be050c default
parent child Browse files
Show More
@@ -525,12 +525,6 b' def manifestmerge(repo, wctx, p2, pa, br'
525 525 raise util.Abort(_("untracked files in working directory differ "
526 526 "from files in requested revision"))
527 527
528 # Convert to dictionary-of-lists format
529 actionbyfile = actions
530 actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
531 for f, (m, args, msg) in actionbyfile.iteritems():
532 actions[m].append((f, args, msg))
533
534 528 return actions, diverge, renamedelete
535 529
536 530 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
@@ -583,22 +577,21 b' def calculateupdates(repo, wctx, mctx, a'
583 577 # Arbitrarily pick warnings from first iteration
584 578 diverge = diverge1
585 579 renamedelete = renamedelete1
586 for m, l in sorted(actions.items()):
587 for a in l:
588 f, args, msg = a
589 repo.ui.debug(' %s: %s -> %s\n' % (f, msg, m))
590 if f in fbids:
591 d = fbids[f]
592 if m in d:
593 d[m].append(a)
594 else:
595 d[m] = [a]
580 for f, a in sorted(actions.iteritems()):
581 m, args, msg = a
582 repo.ui.debug(' %s: %s -> %s\n' % (f, msg, m))
583 if f in fbids:
584 d = fbids[f]
585 if m in d:
586 d[m].append(a)
596 587 else:
597 fbids[f] = {m: [a]}
588 d[m] = [a]
589 else:
590 fbids[f] = {m: [a]}
598 591
599 592 # Pick the best bid for each file
600 593 repo.ui.note(_('\nauction for merging merge bids\n'))
601 actions = dict((m, []) for m in actions.keys())
594 actions = {}
602 595 for f, bids in sorted(fbids.items()):
603 596 # bids is a mapping from action method to list af actions
604 597 # Consensus?
@@ -606,19 +599,19 b' def calculateupdates(repo, wctx, mctx, a'
606 599 m, l = bids.items()[0]
607 600 if util.all(a == l[0] for a in l[1:]): # len(bids) is > 1
608 601 repo.ui.note(" %s: consensus for %s\n" % (f, m))
609 actions[m].append(l[0])
602 actions[f] = l[0]
610 603 continue
611 604 # If keep is an option, just do it.
612 605 if 'k' in bids:
613 606 repo.ui.note(" %s: picking 'keep' action\n" % f)
614 actions['k'].append(bids['k'][0])
607 actions[f] = bids['k'][0]
615 608 continue
616 609 # If there are gets and they all agree [how could they not?], do it.
617 610 if 'g' in bids:
618 611 ga0 = bids['g'][0]
619 612 if util.all(a == ga0 for a in bids['g'][1:]):
620 613 repo.ui.note(" %s: picking 'get' action\n" % f)
621 actions['g'].append(ga0)
614 actions[f] = ga0
622 615 continue
623 616 # TODO: Consider other simple actions such as mode changes
624 617 # Handle inefficient democrazy.
@@ -630,10 +623,16 b' def calculateupdates(repo, wctx, mctx, a'
630 623 m, l = bids.items()[0]
631 624 repo.ui.warn(_(' %s: ambiguous merge - picked %s action\n') %
632 625 (f, m))
633 actions[m].append(l[0])
626 actions[f] = l[0]
634 627 continue
635 628 repo.ui.note(_('end of auction\n\n'))
636 629
630 # Convert to dictionary-of-lists format
631 actionbyfile = actions
632 actions = dict((m, []) for m in 'a f g cd dc r dm dg m e k'.split())
633 for f, (m, args, msg) in actionbyfile.iteritems():
634 actions[m].append((f, args, msg))
635
637 636 _resolvetrivial(repo, wctx, mctx, ancestors[0], actions)
638 637
639 638 if wctx.rev() is None:
@@ -141,8 +141,8 b' Redo merge with merge.preferancestor="*"'
141 141 resolving manifests
142 142 branchmerge: True, force: False, partial: False
143 143 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
144 f1: versions differ -> m
144 145 f2: remote unchanged -> k
145 f1: versions differ -> m
146 146
147 147 auction for merging merge bids
148 148 f1: picking 'get' action
@@ -184,8 +184,8 b' The other way around:'
184 184 resolving manifests
185 185 branchmerge: True, force: False, partial: False
186 186 ancestor: 40663881a6dd, local: adfe50279922+, remote: 3b08d01b0ab5
187 f1: versions differ -> m
187 188 f2: remote is newer -> g
188 f1: versions differ -> m
189 189
190 190 auction for merging merge bids
191 191 f1: picking 'keep' action
@@ -249,8 +249,8 b' Verify how the output looks and and how '
249 249 resolving manifests
250 250 branchmerge: True, force: False, partial: False
251 251 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
252 f1: versions differ -> m
252 253 f2: remote unchanged -> k
253 f1: versions differ -> m
254 254
255 255 auction for merging merge bids
256 256 f1: picking 'get' action
General Comments 0
You need to be logged in to leave comments. Login now