comparison hgext/largefiles/overrides.py @ 18491:b7da9c042b9e stable

largefiles: fix cat when using relative paths from subdirectory
author Mads Kiilerich <madski@unity3d.com>
date Fri, 25 Jan 2013 18:20:13 +0100
parents c9db897d5a43
children 139529b0a191 2dc7f63181b9
comparison
equal deleted inserted replaced
18490:877f80599df0 18491:b7da9c042b9e
1147 repo._istransplanting = False 1147 repo._istransplanting = False
1148 return result 1148 return result
1149 1149
1150 def overridecat(orig, ui, repo, file1, *pats, **opts): 1150 def overridecat(orig, ui, repo, file1, *pats, **opts):
1151 ctx = scmutil.revsingle(repo, opts.get('rev')) 1151 ctx = scmutil.revsingle(repo, opts.get('rev'))
1152 if not lfutil.standin(file1) in ctx: 1152 err = 1
1153 result = orig(ui, repo, file1, *pats, **opts) 1153 notbad = set()
1154 return result 1154 m = scmutil.match(ctx, (file1,) + pats, opts)
1155 return lfcommands.catlfile(repo, file1, ctx.rev(), opts.get('output')) 1155 origmatchfn = m.matchfn
1156 def lfmatchfn(f):
1157 lf = lfutil.splitstandin(f)
1158 if lf is None:
1159 return origmatchfn(f)
1160 notbad.add(lf)
1161 return origmatchfn(lf)
1162 m.matchfn = lfmatchfn
1163 m.bad = lambda f, msg: f not in notbad
1164 for f in ctx.walk(m):
1165 lf = lfutil.splitstandin(f)
1166 if lf is None:
1167 err = orig(ui, repo, f, **opts)
1168 else:
1169 err = lfcommands.catlfile(repo, lf, ctx.rev(), opts.get('output'))
1170 return err
1156 1171
1157 def mercurialsinkbefore(orig, sink): 1172 def mercurialsinkbefore(orig, sink):
1158 sink.repo._isconverting = True 1173 sink.repo._isconverting = True
1159 orig(sink) 1174 orig(sink)
1160 1175