diff hgext/churn.py @ 45650:3a024d7cd08e

cmdutil: make walkchangerevs() call prepare with matcher instead of filenames Prepares for migrating walkchangerevs() to logcmdutil's logic, which provides matcher-based interface.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 10 Sep 2020 16:14:48 +0900
parents 0d119802242b
children 0356b41fe01d
line wrap: on
line diff
--- a/hgext/churn.py	Thu Sep 10 18:40:01 2020 +0900
+++ b/hgext/churn.py	Thu Sep 10 16:14:48 2020 +0900
@@ -36,9 +36,8 @@
 testedwith = b'ships-with-hg-core'
 
 
-def changedlines(ui, repo, ctx1, ctx2, fns):
+def changedlines(ui, repo, ctx1, ctx2, fmatch):
     added, removed = 0, 0
-    fmatch = scmutil.matchfiles(repo, fns)
     diff = b''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch))
     for l in diff.split(b'\n'):
         if l.startswith(b"+") and not l.startswith(b"+++ "):
@@ -79,7 +78,7 @@
 
     m = scmutil.match(repo[None], pats, opts)
 
-    def prep(ctx, fns):
+    def prep(ctx, fmatch):
         rev = ctx.rev()
         if df and not df(ctx.date()[0]):  # doesn't match date format
             return
@@ -95,7 +94,7 @@
                 return
 
             ctx1 = parents[0]
-            lines = changedlines(ui, repo, ctx1, ctx, fns)
+            lines = changedlines(ui, repo, ctx1, ctx, fmatch)
             rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)]
 
         progress.increment()