Patchwork [6,of,6] churn: leverage logcmdutil to filter revisions by --date

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 3, 2020, 4:10 a.m.
Message ID <8ecb3d07b901cb14a630.1601698210@mimosa>
Download mbox | patch
Permalink /patch/47373/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 3, 2020, 4:10 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1600659377 -32400
#      Mon Sep 21 12:36:17 2020 +0900
# Node ID 8ecb3d07b901cb14a6303008f053840fa47847ac
# Parent  c02ae0d9e1126c182a09ead972fce7f4a6fedad9
churn: leverage logcmdutil to filter revisions by --date

Patch

diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -24,7 +24,6 @@  from mercurial import (
     pycompat,
     registrar,
 )
-from mercurial.utils import dateutil
 
 cmdtable = {}
 command = registrar.command(cmdtable)
@@ -71,15 +70,9 @@  def countrate(ui, repo, amap, *pats, **o
         _(b'analyzing'), unit=_(b'revisions'), total=len(repo)
     )
     rate = {}
-    df = False
-    if opts.get(b'date'):
-        df = dateutil.matchdate(opts[b'date'])
 
     def prep(ctx, fmatch):
         rev = ctx.rev()
-        if df and not df(ctx.date()[0]):  # doesn't match date format
-            return
-
         key = getkey(ctx).strip()
         key = amap.get(key, key)  # alias remap
         if opts.get(b'changesets'):
@@ -100,6 +93,7 @@  def countrate(ui, repo, amap, *pats, **o
         pats=pats,
         opts=opts,
         revspec=opts[b'rev'],
+        date=opts[b'date'],
         include_pats=opts[b'include'],
         exclude_pats=opts[b'exclude'],
     )