hgext/fix.py
changeset 48913 f254fc73d956
parent 48875 6000f5b25c9b
child 48946 642e31cb55f0
equal deleted inserted replaced
48912:a0674e916fb6 48913:f254fc73d956
   375     fixing, since it has no entry in "replacements".
   375     fixing, since it has no entry in "replacements".
   376 
   376 
   377     Useful as a hook point for extending "hg fix" with output summarizing the
   377     Useful as a hook point for extending "hg fix" with output summarizing the
   378     effects of the command, though we choose not to output anything here.
   378     effects of the command, though we choose not to output anything here.
   379     """
   379     """
   380     replacements = {
   380     replacements = {prec: [succ] for prec, succ in replacements.items()}
   381         prec: [succ] for prec, succ in pycompat.iteritems(replacements)
       
   382     }
       
   383     scmutil.cleanupnodes(repo, replacements, b'fix', fixphase=True)
   381     scmutil.cleanupnodes(repo, replacements, b'fix', fixphase=True)
   384 
   382 
   385 
   383 
   386 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs):
   384 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs):
   387     """Constructs a list of files to fix and which revisions each fix applies to
   385     """Constructs a list of files to fix and which revisions each fix applies to
   690     exits with code zero. The fixer tool's working directory is the repository's
   688     exits with code zero. The fixer tool's working directory is the repository's
   691     root.
   689     root.
   692     """
   690     """
   693     metadata = {}
   691     metadata = {}
   694     newdata = fixctx[path].data()
   692     newdata = fixctx[path].data()
   695     for fixername, fixer in pycompat.iteritems(fixers):
   693     for fixername, fixer in fixers.items():
   696         if fixer.affects(opts, fixctx, path):
   694         if fixer.affects(opts, fixctx, path):
   697             ranges = lineranges(
   695             ranges = lineranges(
   698                 opts, path, basepaths, basectxs, fixctx, newdata
   696                 opts, path, basepaths, basectxs, fixctx, newdata
   699             )
   697             )
   700             command = fixer.command(ui, path, ranges)
   698             command = fixer.command(ui, path, ranges)
   768     update/merge, and means that the working directory simply isn't affected
   766     update/merge, and means that the working directory simply isn't affected
   769     unless the --working-dir flag is given.
   767     unless the --working-dir flag is given.
   770 
   768 
   771     Directly updates the dirstate for the affected files.
   769     Directly updates the dirstate for the affected files.
   772     """
   770     """
   773     for path, data in pycompat.iteritems(filedata):
   771     for path, data in filedata.items():
   774         fctx = ctx[path]
   772         fctx = ctx[path]
   775         fctx.write(data, fctx.flags())
   773         fctx.write(data, fctx.flags())
   776 
   774 
   777     oldp1 = repo.dirstate.p1()
   775     oldp1 = repo.dirstate.p1()
   778     newp1 = replacements.get(oldp1, oldp1)
   776     newp1 = replacements.get(oldp1, oldp1)