Patchwork [2,of,6,stable] cmdutil: add a hook for making custom non-follow log file matchers

login
register
mail settings
Submitter Siddharth Agarwal
Date Aug. 13, 2014, 11:05 p.m.
Message ID <2d22504013642e95deb7.1407971121@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/5381/
State Accepted
Headers show

Comments

Siddharth Agarwal - Aug. 13, 2014, 11:05 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1407968223 25200
#      Wed Aug 13 15:17:03 2014 -0700
# Branch stable
# Node ID 2d22504013642e95deb73811347276b11aefa469
# Parent  a3921b24a97d4f0fa48d58edb6a5cf8c355b7df1
cmdutil: add a hook for making custom non-follow log file matchers

This will be used by largefiles (and basically only by largefiles) in an
upcoming patch.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1519,6 +1519,10 @@ 
 
     return filematcher
 
+def _makenofollowlogfilematcher(repo, pats, opts):
+    '''hook for extensions to override the filematcher for non-follow cases'''
+    return None
+
 def _makelogrevset(repo, pats, opts, revs):
     """Return (expr, filematcher) where expr is a revset string built
     from log options and file patterns or None. If --stat or --patch
@@ -1635,7 +1639,9 @@ 
             filematcher = _makefollowlogfilematcher(repo, match.files(),
                                                     followfirst)
         else:
-            filematcher = lambda rev: match
+            filematcher = _makenofollowlogfilematcher(repo, pats, opts)
+            if filematcher is None:
+                filematcher = lambda rev: match
 
     expr = []
     for op, val in opts.iteritems():