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