changeset 38811:64535d43c103

fix: add a monkey-patchable point after all new revisions have been committed Differential Revision: https://phab.mercurial-scm.org/D4048
author Danny Hooper <hooper@google.com>
date Wed, 01 Aug 2018 16:03:32 -0700
parents 4fe8d1f077b8
children 9d49bb117dde
files hgext/fix.py
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fix.py	Thu Aug 02 13:35:13 2018 -0700
+++ b/hgext/fix.py	Wed Aug 01 16:03:32 2018 -0700
@@ -182,8 +182,23 @@
                         replacerev(ui, repo, ctx, filedata[rev], replacements)
                     del filedata[rev]
 
-        replacements = {prec: [succ] for prec, succ in replacements.iteritems()}
-        scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True)
+        cleanup(repo, replacements, bool(filedata[wdirrev]))
+
+def cleanup(repo, replacements, wdirwritten):
+    """Calls scmutil.cleanupnodes() with the given replacements.
+
+    "replacements" is a dict from nodeid to nodeid, with one key and one value
+    for every revision that was affected by fixing. This is slightly different
+    from cleanupnodes().
+
+    "wdirwritten" is a bool which tells whether the working copy was affected by
+    fixing, since it has no entry in "replacements".
+
+    Useful as a hook point for extending "hg fix" with output summarizing the
+    effects of the command, though we choose not to output anything here.
+    """
+    replacements = {prec: [succ] for prec, succ in replacements.iteritems()}
+    scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True)
 
 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs):
     """"Constructs the list of files to be fixed at specific revisions