comparison hgext/fix.py @ 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 260c17eaf3f7
children 257c9846b532
comparison
equal deleted inserted replaced
38810:4fe8d1f077b8 38811:64535d43c103
180 writeworkingdir(repo, ctx, filedata[rev], replacements) 180 writeworkingdir(repo, ctx, filedata[rev], replacements)
181 else: 181 else:
182 replacerev(ui, repo, ctx, filedata[rev], replacements) 182 replacerev(ui, repo, ctx, filedata[rev], replacements)
183 del filedata[rev] 183 del filedata[rev]
184 184
185 replacements = {prec: [succ] for prec, succ in replacements.iteritems()} 185 cleanup(repo, replacements, bool(filedata[wdirrev]))
186 scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True) 186
187 def cleanup(repo, replacements, wdirwritten):
188 """Calls scmutil.cleanupnodes() with the given replacements.
189
190 "replacements" is a dict from nodeid to nodeid, with one key and one value
191 for every revision that was affected by fixing. This is slightly different
192 from cleanupnodes().
193
194 "wdirwritten" is a bool which tells whether the working copy was affected by
195 fixing, since it has no entry in "replacements".
196
197 Useful as a hook point for extending "hg fix" with output summarizing the
198 effects of the command, though we choose not to output anything here.
199 """
200 replacements = {prec: [succ] for prec, succ in replacements.iteritems()}
201 scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True)
187 202
188 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs): 203 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs):
189 """"Constructs the list of files to be fixed at specific revisions 204 """"Constructs the list of files to be fixed at specific revisions
190 205
191 It is up to the caller how to consume the work items, and the only 206 It is up to the caller how to consume the work items, and the only