diff hgext/largefiles/overrides.py @ 22169:35cc5b07b3fc stable

largefiles: in overridelog, use non-lf matcher for patch generation (issue4334) This has actually been broken since at least Mercurial 2.8 -- hg log --patch with largefiles only used to work when no largefiles existed. Rev 5809d62e7106 exposed this bug for all cases.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 13 Aug 2014 15:18:41 -0700
parents 1b9d0dc1bbe1
children 0e1b02f984c7
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Wed Aug 13 15:13:50 2014 -0700
+++ b/hgext/largefiles/overrides.py	Wed Aug 13 15:18:41 2014 -0700
@@ -299,11 +299,25 @@
 
         return m, pats
 
+    # For hg log --patch, the match object is used in two different senses:
+    # (1) to determine what revisions should be printed out, and
+    # (2) to determine what files to print out diffs for.
+    # The magic matchandpats override should be used for case (1) but not for
+    # case (2).
+    def overridemakelogfilematcher(repo, pats, opts):
+        pctx = repo[None]
+        match, pats = oldmatchandpats(pctx, pats, opts)
+        return lambda rev: match
+
     oldmatchandpats = installmatchandpatsfn(overridematchandpats)
+    oldmakelogfilematcher = cmdutil._makenofollowlogfilematcher
+    setattr(cmdutil, '_makenofollowlogfilematcher', overridemakelogfilematcher)
+
     try:
         return orig(ui, repo, *pats, **opts)
     finally:
         restorematchandpatsfn()
+        setattr(cmdutil, '_makenofollowlogfilematcher', oldmakelogfilematcher)
 
 def overrideverify(orig, ui, repo, *pats, **opts):
     large = opts.pop('large', False)