[PATCH 04 of 12 misc largefiles] largefiles: make cat on standins do something
Mads Kiilerich
mads at kiilerich.com
Sun Apr 13 11:59:07 CDT 2014
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1367097592 -7200
# Sat Apr 27 23:19:52 2013 +0200
# Node ID ed04503318ac7625cf1bd2292cd7524d0919cb98
# Parent c577232987ac51936517fc2dece1b316a3b8f42b
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.
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1148,9 +1148,11 @@ def overridecat(orig, ui, repo, file1, *
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
@@ -1163,7 +1165,7 @@ def overridecat(orig, ui, repo, file1, *
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'):
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1503,6 +1503,12 @@ Cat a largefile
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
More information about the Mercurial-devel
mailing list