##// END OF EJS Templates
merge: have merge.update use a matcher instead of partial fn...
Augie Fackler -
r27344:43c00ca8 default
parent child Browse files
Show More
@@ -712,8 +712,8 b' class base(histeditaction):'
712 712
713 713 def run(self):
714 714 if self.repo['.'].node() != self.node:
715 mergemod.update(self.repo, self.node, False, True, False)
716 # branchmerge, force, partial)
715 mergemod.update(self.repo, self.node, False, True)
716 # branchmerge, force)
717 717 return self.continueclean()
718 718
719 719 def continuedirty(self):
@@ -1364,8 +1364,11 b' def overridecat(orig, ui, repo, file1, *'
1364 1364 err = 0
1365 1365 return err
1366 1366
1367 def mergeupdate(orig, repo, node, branchmerge, force, partial,
1367 def mergeupdate(orig, repo, node, branchmerge, force,
1368 1368 *args, **kwargs):
1369 matcher = kwargs.get('matcher', None)
1370 # note if this is a partial update
1371 partial = matcher and not matcher.always()
1369 1372 wlock = repo.wlock()
1370 1373 try:
1371 1374 # branch | | |
@@ -1405,7 +1408,7 b' def mergeupdate(orig, repo, node, branch'
1405 1408
1406 1409 oldstandins = lfutil.getstandinsstate(repo)
1407 1410
1408 result = orig(repo, node, branchmerge, force, partial, *args, **kwargs)
1411 result = orig(repo, node, branchmerge, force, *args, **kwargs)
1409 1412
1410 1413 newstandins = lfutil.getstandinsstate(repo)
1411 1414 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
@@ -632,7 +632,7 b' def rebasenode(repo, rev, p1, base, stat'
632 632 # Update to target and merge it with local
633 633 if repo['.'].rev() != p1:
634 634 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
635 merge.update(repo, p1, False, True, False)
635 merge.update(repo, p1, False, True)
636 636 else:
637 637 repo.ui.debug(" already in target\n")
638 638 repo.dirstate.write(repo.currenttransaction())
@@ -641,7 +641,7 b' def rebasenode(repo, rev, p1, base, stat'
641 641 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
642 642 # When collapsing in-place, the parent is the common ancestor, we
643 643 # have to allow merging with it.
644 stats = merge.update(repo, rev, True, True, False, base, collapse,
644 stats = merge.update(repo, rev, True, True, base, collapse,
645 645 labels=['dest', 'source'])
646 646 if collapse:
647 647 copies.duplicatecopies(repo, rev, target)
@@ -958,7 +958,7 b' def abort(repo, originalwd, target, stat'
958 958 if cleanup:
959 959 # Update away from the rebase if necessary
960 960 if needupdate(repo, state):
961 merge.update(repo, originalwd, False, True, False)
961 merge.update(repo, originalwd, False, True)
962 962
963 963 # Strip from the first rebased revision
964 964 rebased = filter(lambda x: x >= 0 and x != target, state.values())
@@ -152,7 +152,7 b' class transplanter(object):'
152 152 if pulls:
153 153 if source != repo:
154 154 exchange.pull(repo, source.peer(), heads=pulls)
155 merge.update(repo, pulls[-1], False, False, None)
155 merge.update(repo, pulls[-1], False, False)
156 156 p1, p2 = repo.dirstate.parents()
157 157 pulls = []
158 158
@@ -216,7 +216,7 b' class transplanter(object):'
216 216 tr.close()
217 217 if pulls:
218 218 exchange.pull(repo, source.peer(), heads=pulls)
219 merge.update(repo, pulls[-1], False, False, None)
219 merge.update(repo, pulls[-1], False, False)
220 220 finally:
221 221 self.saveseries(revmap, merges)
222 222 self.transplants.write()
@@ -183,9 +183,9 b' def dorecord(ui, repo, commitfunc, cmdsu'
183 183 # 3a. apply filtered patch to clean repo (clean)
184 184 if backups:
185 185 # Equivalent to hg.revert
186 choices = lambda key: key in backups
186 m = scmutil.matchfiles(repo, backups.keys())
187 187 mergemod.update(repo, repo.dirstate.p1(),
188 False, True, choices)
188 False, True, matcher=m)
189 189
190 190 # 3b. (apply)
191 191 if dopatch:
@@ -636,8 +636,7 b' def _dobackout(ui, repo, node=None, rev='
636 636 try:
637 637 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
638 638 'backout')
639 stats = mergemod.update(repo, parent, True, True, False,
640 node, False)
639 stats = mergemod.update(repo, parent, True, True, node, False)
641 640 repo.setparents(op1, op2)
642 641 dsguard.close()
643 642 hg._showstats(repo, stats)
@@ -637,7 +637,7 b' def updaterepo(repo, node, overwrite):'
637 637 When overwrite is set, changes are clobbered, merged else
638 638
639 639 returns stats (see pydoc mercurial.merge.applyupdates)"""
640 return mergemod.update(repo, node, False, overwrite, None,
640 return mergemod.update(repo, node, False, overwrite,
641 641 labels=['working copy', 'destination'])
642 642
643 643 def update(repo, node):
@@ -662,7 +662,7 b' def clean(repo, node, show_stats=True):'
662 662 def merge(repo, node, force=None, remind=True):
663 663 """Branch merge with node, resolving changes. Return true if any
664 664 unresolved conflicts."""
665 stats = mergemod.update(repo, node, True, force, False)
665 stats = mergemod.update(repo, node, True, force)
666 666 _showstats(repo, stats)
667 667 if stats[3]:
668 668 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges "
@@ -1266,15 +1266,15 b' def recordupdates(repo, actions, branchm'
1266 1266 else:
1267 1267 repo.dirstate.normal(f)
1268 1268
1269 def update(repo, node, branchmerge, force, partial, ancestor=None,
1270 mergeancestor=False, labels=None):
1269 def update(repo, node, branchmerge, force, ancestor=None,
1270 mergeancestor=False, labels=None, matcher=None):
1271 1271 """
1272 1272 Perform a merge between the working directory and the given node
1273 1273
1274 1274 node = the node to update to, or None if unspecified
1275 1275 branchmerge = whether to merge between branches
1276 1276 force = whether to force branch merging or file overwriting
1277 partial = a function to filter file lists (dirstate not updated)
1277 matcher = a matcher to filter file lists (dirstate not updated)
1278 1278 mergeancestor = whether it is merging with an ancestor. If true,
1279 1279 we should accept the incoming changes for any prompts that occur.
1280 1280 If false, merging with an ancestor (fast-forward) is only allowed
@@ -1313,6 +1313,13 b' def update(repo, node, branchmerge, forc'
1313 1313
1314 1314 onode = node
1315 1315 wlock = repo.wlock()
1316 # If we're doing a partial update, we need to skip updating
1317 # the dirstate, so make a note of any partial-ness to the
1318 # update here.
1319 if matcher is None or matcher.always():
1320 partial = False
1321 else:
1322 partial = True
1316 1323 try:
1317 1324 wc = repo[None]
1318 1325 pl = wc.parents()
@@ -1407,6 +1414,10 b' def update(repo, node, branchmerge, forc'
1407 1414 followcopies = True
1408 1415
1409 1416 ### calculate phase
1417 if matcher is None or matcher.always():
1418 partial = False
1419 else:
1420 partial = matcher.matchfn
1410 1421 actionbyfile, diverge, renamedelete = calculateupdates(
1411 1422 repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
1412 1423 followcopies)
@@ -1516,7 +1527,7 b' def graft(repo, ctx, pctx, labels, keepp'
1516 1527 # which local deleted".
1517 1528 mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node())
1518 1529
1519 stats = update(repo, ctx.node(), True, True, False, pctx.node(),
1530 stats = update(repo, ctx.node(), True, True, pctx.node(),
1520 1531 mergeancestor=mergeancestor, labels=labels)
1521 1532
1522 1533 pother = nullid
@@ -17,10 +17,10 b' def addcommit(name, time):'
17 17 commit(name, time)
18 18
19 19 def update(rev):
20 merge.update(repo, rev, False, True, False)
20 merge.update(repo, rev, False, True)
21 21
22 22 def merge_(rev):
23 merge.update(repo, rev, True, False, False)
23 merge.update(repo, rev, True, False)
24 24
25 25 if __name__ == '__main__':
26 26 addcommit("A", 0)
@@ -82,4 +82,3 b" if __name__ == '__main__':"
82 82 print '\nDescendants of 5 and 4'
83 83 for r in repo.changelog.descendants([5, 4]):
84 84 print r,
85
General Comments 0
You need to be logged in to leave comments. Login now