##// END OF EJS Templates
mergestate: introduce a new ACTION_KEEP_NEW...
Pulkit Goyal -
r46095:6877b0ee default
parent child Browse files
Show More
@@ -552,6 +552,7 b' class mergeresult(object):'
552 NO_OP_ACTIONS = (
552 NO_OP_ACTIONS = (
553 mergestatemod.ACTION_KEEP,
553 mergestatemod.ACTION_KEEP,
554 mergestatemod.ACTION_KEEP_ABSENT,
554 mergestatemod.ACTION_KEEP_ABSENT,
555 mergestatemod.ACTION_KEEP_NEW,
555 )
556 )
556
557
557 def __init__(self):
558 def __init__(self):
@@ -921,7 +922,7 b' def manifestmerge('
921 else: # file not in ancestor, not in remote
922 else: # file not in ancestor, not in remote
922 mresult.addfile(
923 mresult.addfile(
923 f,
924 f,
924 mergestatemod.ACTION_KEEP,
925 mergestatemod.ACTION_KEEP_NEW,
925 None,
926 None,
926 b'ancestor missing, remote missing',
927 b'ancestor missing, remote missing',
927 )
928 )
@@ -1191,6 +1192,11 b' def calculateupdates('
1191 repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f)
1192 repo.ui.note(_(b" %s: picking 'keep absent' action\n") % f)
1192 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0])
1193 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_ABSENT][0])
1193 continue
1194 continue
1195 # If keep new is an option, let's just do that
1196 if mergestatemod.ACTION_KEEP_NEW in bids:
1197 repo.ui.note(_(b" %s: picking 'keep new' action\n") % f)
1198 mresult.addfile(f, *bids[mergestatemod.ACTION_KEEP_NEW][0])
1199 continue
1194 # If there are gets and they all agree [how could they not?], do it.
1200 # If there are gets and they all agree [how could they not?], do it.
1195 if mergestatemod.ACTION_GET in bids:
1201 if mergestatemod.ACTION_GET in bids:
1196 ga0 = bids[mergestatemod.ACTION_GET][0]
1202 ga0 = bids[mergestatemod.ACTION_GET][0]
@@ -1496,15 +1502,9 b' def applyupdates('
1496 progress.increment(item=f)
1502 progress.increment(item=f)
1497
1503
1498 # keep (noop, just log it)
1504 # keep (noop, just log it)
1499 for f, args, msg in mresult.getactions(
1505 for a in mergeresult.NO_OP_ACTIONS:
1500 (mergestatemod.ACTION_KEEP,), sort=True
1506 for f, args, msg in mresult.getactions((a,), sort=True):
1501 ):
1507 repo.ui.debug(b" %s: %s -> %s\n" % (f, msg, a))
1502 repo.ui.debug(b" %s: %s -> k\n" % (f, msg))
1503 # no progress
1504 for f, args, msg in mresult.getactions(
1505 (mergestatemod.ACTION_KEEP_ABSENT,), sort=True
1506 ):
1507 repo.ui.debug(b" %s: %s -> ka\n" % (f, msg))
1508 # no progress
1508 # no progress
1509
1509
1510 # directory rename, move local
1510 # directory rename, move local
@@ -117,6 +117,9 b" ACTION_KEEP = b'k'"
117 # keep it absent (absent means file not present, it can be a result
117 # keep it absent (absent means file not present, it can be a result
118 # of file deletion, rename etc.)
118 # of file deletion, rename etc.)
119 ACTION_KEEP_ABSENT = b'ka'
119 ACTION_KEEP_ABSENT = b'ka'
120 # the file is absent on the ancestor and remote side of the merge
121 # hence this file is new and we should keep it
122 ACTION_KEEP_NEW = b'kn'
120 ACTION_EXEC = b'e'
123 ACTION_EXEC = b'e'
121 ACTION_CREATED_MERGE = b'cm'
124 ACTION_CREATED_MERGE = b'cm'
122
125
@@ -767,6 +770,10 b' def recordupdates(repo, actions, branchm'
767 for f, args, msg in actions.get(ACTION_KEEP_ABSENT, []):
770 for f, args, msg in actions.get(ACTION_KEEP_ABSENT, []):
768 pass
771 pass
769
772
773 # keep new
774 for f, args, msg in actions.get(ACTION_KEEP_NEW, []):
775 pass
776
770 # get
777 # get
771 for f, args, msg in actions.get(ACTION_GET, []):
778 for f, args, msg in actions.get(ACTION_GET, []):
772 if branchmerge:
779 if branchmerge:
@@ -431,8 +431,8 b' Verify that the old context ancestor wor'
431 resolving manifests
431 resolving manifests
432 branchmerge: True, force: False, partial: False
432 branchmerge: True, force: False, partial: False
433 ancestor: 11b5b303e36c, local: c0ef19750a22+, remote: 6ca01f7342b9
433 ancestor: 11b5b303e36c, local: c0ef19750a22+, remote: 6ca01f7342b9
434 d1/a: ancestor missing, remote missing -> k
434 d1/a: ancestor missing, remote missing -> kn
435 d1/b: ancestor missing, remote missing -> k
435 d1/b: ancestor missing, remote missing -> kn
436 d2/b: remote created -> g
436 d2/b: remote created -> g
437
437
438 calculating bids for ancestor 154e6000f54e
438 calculating bids for ancestor 154e6000f54e
@@ -452,13 +452,13 b' Verify that the old context ancestor wor'
452
452
453 auction for merging merge bids (2 ancestors)
453 auction for merging merge bids (2 ancestors)
454 list of bids for d1/a:
454 list of bids for d1/a:
455 ancestor missing, remote missing -> k
455 ancestor missing, remote missing -> kn
456 other deleted -> r
456 other deleted -> r
457 d1/a: picking 'keep' action
457 d1/a: picking 'keep new' action
458 list of bids for d1/b:
458 list of bids for d1/b:
459 ancestor missing, remote missing -> k
459 ancestor missing, remote missing -> kn
460 other deleted -> r
460 other deleted -> r
461 d1/b: picking 'keep' action
461 d1/b: picking 'keep new' action
462 list of bids for d2/b:
462 list of bids for d2/b:
463 remote created -> g
463 remote created -> g
464 remote created -> g
464 remote created -> g
@@ -467,8 +467,8 b' Verify that the old context ancestor wor'
467
467
468 d2/b: remote created -> g
468 d2/b: remote created -> g
469 getting d2/b
469 getting d2/b
470 d1/a: ancestor missing, remote missing -> k
470 d1/a: ancestor missing, remote missing -> kn
471 d1/b: ancestor missing, remote missing -> k
471 d1/b: ancestor missing, remote missing -> kn
472 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
472 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
473 (branch merge, don't forget to commit)
473 (branch merge, don't forget to commit)
474
474
General Comments 0
You need to be logged in to leave comments. Login now