diff hgext/churn.py @ 45650:0356b41fe01d

cmdutil: rewrite walkchangerevs() by using logcmdutil functions cmdutil.walkchangerevs() now takes (revs, makefilematcher) in place of (match, opts), and only provides the "windowing" functionality. Unused classes and functions will be removed by the next patch. "hg grep --follow" (--all-files) is still broken since there is no logic to follow copies while traversing changelog, but at least, it does follow the DAG.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 10 Sep 2020 18:01:43 +0900
parents 3a024d7cd08e
children d1759b2e1888
line wrap: on
line diff
--- a/hgext/churn.py	Thu Sep 10 17:14:03 2020 +0900
+++ b/hgext/churn.py	Thu Sep 10 18:01:43 2020 +0900
@@ -23,7 +23,6 @@
     patch,
     pycompat,
     registrar,
-    scmutil,
 )
 from mercurial.utils import dateutil
 
@@ -76,8 +75,6 @@
     if opts.get(b'date'):
         df = dateutil.matchdate(opts[b'date'])
 
-    m = scmutil.match(repo[None], pats, opts)
-
     def prep(ctx, fmatch):
         rev = ctx.rev()
         if df and not df(ctx.date()[0]):  # doesn't match date format
@@ -99,7 +96,15 @@
 
         progress.increment()
 
-    for ctx in cmdutil.walkchangerevs(repo, m, opts, prep):
+    wopts = logcmdutil.walkopts(
+        pats=pats,
+        opts=opts,
+        revspec=opts[b'rev'],
+        include_pats=opts[b'include'],
+        exclude_pats=opts[b'exclude'],
+    )
+    revs, makefilematcher = logcmdutil.makewalker(repo, wopts)
+    for ctx in cmdutil.walkchangerevs(repo, revs, makefilematcher, prep):
         continue
 
     progress.complete()