changeset 21087:3fb2affb023f

largefiles: make cat on standins do something cat of a standin would silently fail. The use of standins is mostly an implementation detail, but it is already a bit leaking. Being able to see the content of standins might be convenient for debugging.
author Mads Kiilerich <madski@unity3d.com>
date Sat, 27 Apr 2013 23:19:52 +0200
parents 718f56c47414
children e095626e8676
files hgext/largefiles/overrides.py tests/test-largefiles.t
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sun Apr 13 18:45:43 2014 +0200
+++ b/hgext/largefiles/overrides.py	Sat Apr 27 23:19:52 2013 +0200
@@ -1116,9 +1116,11 @@
     m = scmutil.match(ctx, (file1,) + pats, opts)
     origmatchfn = m.matchfn
     def lfmatchfn(f):
+        if origmatchfn(f):
+            return True
         lf = lfutil.splitstandin(f)
         if lf is None:
-            return origmatchfn(f)
+            return False
         notbad.add(lf)
         return origmatchfn(lf)
     m.matchfn = lfmatchfn
@@ -1131,7 +1133,7 @@
         fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
                                  pathname=f)
         lf = lfutil.splitstandin(f)
-        if lf is None:
+        if lf is None or origmatchfn(f):
             # duplicating unreachable code from commands.cat
             data = ctx[f].data()
             if opts.get('decode'):
--- a/tests/test-largefiles.t	Sun Apr 13 18:45:43 2014 +0200
+++ b/tests/test-largefiles.t	Sat Apr 27 23:19:52 2013 +0200
@@ -1506,6 +1506,12 @@
   large4-modified
   $ hg --cwd sub cat -r '.^' ../normal3
   normal3-modified
+Cat a standin
+  $ hg cat .hglf/sub/large4
+  e166e74c7303192238d60af5a9c4ce9bef0b7928
+  $ hg cat .hglf/normal3
+  .hglf/normal3: no such file in rev 598410d3eb9a
+  [1]
 
 Test that renaming a largefile results in correct output for status