1264 repo.dirstate.add(f) |
1264 repo.dirstate.add(f) |
1265 repo.dirstate.copy(f0, f) |
1265 repo.dirstate.copy(f0, f) |
1266 else: |
1266 else: |
1267 repo.dirstate.normal(f) |
1267 repo.dirstate.normal(f) |
1268 |
1268 |
1269 def update(repo, node, branchmerge, force, partial, ancestor=None, |
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 partial = a function to filter file lists (dirstate not updated) |
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 |
1281 between different named branches. This flag is used by rebase extension |
1281 between different named branches. This flag is used by rebase extension |
1282 as a temporary fix and should be avoided in general. |
1282 as a temporary fix and should be avoided in general. |
1405 pass |
1412 pass |
1406 elif pas[0] and repo.ui.configbool('merge', 'followcopies', True): |
1413 elif pas[0] and repo.ui.configbool('merge', 'followcopies', True): |
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) |
1413 # Convert to dictionary-of-lists format |
1424 # Convert to dictionary-of-lists format |
1414 actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split()) |
1425 actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split()) |
1514 # to copy commits), and 2) informs update that the incoming changes are |
1525 # to copy commits), and 2) informs update that the incoming changes are |
1515 # newer than the destination so it doesn't prompt about "remote changed foo |
1526 # newer than the destination so it doesn't prompt about "remote changed foo |
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, False, pctx.node(), |
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 |
1523 parents = ctx.parents() |
1534 parents = ctx.parents() |
1524 if keepparent and len(parents) == 2 and pctx in parents: |
1535 if keepparent and len(parents) == 2 and pctx in parents: |