diff mercurial/merge.py @ 33321:d09e948dc303

sparse: move pruning of temporary includes into core This was our last method on the custom repo type, meaning we could remove that custom type and inline the 2 lines of code into reposetup(). As part of the move, instead of wrapping merge.update() from the sparse extension, we inline the function call. The ported function now no-ops if sparse isn't enabled, making it safe to always call. The call site in update() may not be the most appropriate. But it matches the previous behavior, which is the safest thing to do. It can be improved later.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 06 Jul 2017 14:33:18 -0700
parents f8f716da90fa
children 252500520d60
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Jul 06 17:41:45 2017 -0700
+++ b/mercurial/merge.py	Thu Jul 06 14:33:18 2017 -0700
@@ -1514,6 +1514,8 @@
 
     Return the same tuple as applyupdates().
     """
+    # Avoid cycle.
+    from . import sparse
 
     # This function used to find the default destination if node was None, but
     # that's now in destutil.py.
@@ -1703,6 +1705,11 @@
                 if not branchmerge:
                     repo.dirstate.setbranch(p2.branch())
 
+    # If we're updating to a location, clean up any stale temporary includes
+    # (ex: this happens during hg rebase --abort).
+    if not branchmerge:
+        sparse.prunetemporaryincludes(repo)
+
     if not partial:
         repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
     return stats