# HG changeset patch # User Mads Kiilerich # Date 1359134413 -3600 # Node ID b7da9c042b9e640cedb73d283cf0ca8f41459315 # Parent 877f80599df02b3fe223dfddf96149fb3a9a1699 largefiles: fix cat when using relative paths from subdirectory diff -r 877f80599df0 -r b7da9c042b9e hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Fri Jan 25 16:59:34 2013 +0100 +++ b/hgext/largefiles/overrides.py Fri Jan 25 18:20:13 2013 +0100 @@ -1149,10 +1149,25 @@ def overridecat(orig, ui, repo, file1, *pats, **opts): ctx = scmutil.revsingle(repo, opts.get('rev')) - if not lfutil.standin(file1) in ctx: - result = orig(ui, repo, file1, *pats, **opts) - return result - return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output')) + err = 1 + notbad = set() + m = scmutil.match(ctx, (file1,) + pats, opts) + origmatchfn = m.matchfn + def lfmatchfn(f): + lf = lfutil.splitstandin(f) + if lf is None: + return origmatchfn(f) + notbad.add(lf) + return origmatchfn(lf) + m.matchfn = lfmatchfn + m.bad = lambda f, msg: f not in notbad + for f in ctx.walk(m): + lf = lfutil.splitstandin(f) + if lf is None: + err = orig(ui, repo, f, **opts) + else: + err = lfcommands.catlfile(repo, lf, ctx.rev(), opts.get('output')) + return err def mercurialsinkbefore(orig, sink): sink.repo._isconverting = True diff -r 877f80599df0 -r b7da9c042b9e tests/test-largefiles.t --- a/tests/test-largefiles.t Fri Jan 25 16:59:34 2013 +0100 +++ b/tests/test-largefiles.t Fri Jan 25 18:20:13 2013 +0100 @@ -1412,8 +1412,10 @@ normal3-modified $ hg cat -r '.^' normal3 normal3-modified - $ hg cat -r '.^' sub/large4 + $ hg cat -r '.^' sub/large4 doesntexist large4-modified + doesntexist: no such file in rev a381d2c8c80e + [1] Test that renaming a largefile results in correct output for status @@ -2010,6 +2012,8 @@ $ echo more >> anotherlarge $ hg st . M anotherlarge + $ hg cat anotherlarge + anotherlarge $ hg revert anotherlarge $ hg st ? sub/anotherlarge.orig