# HG changeset patch # User Mads Kiilerich # Date 1358208312 -3600 # Node ID ed23d6100dd385d083b9f06c5b103ee884a608f4 # Parent 8802277c40ee4f67c6d2cc4cb1fc44628392d38e largefiles: make log match largefiles in the non-standin location too Yet another match hack. diff -r 8802277c40ee -r ed23d6100dd3 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Tue Jan 15 01:05:12 2013 +0100 +++ b/hgext/largefiles/overrides.py Tue Jan 15 01:05:12 2013 +0100 @@ -240,11 +240,34 @@ repo._repo.lfstatus = False def overridelog(orig, ui, repo, *pats, **opts): + def overridematch(ctx, pats=[], opts={}, globbed=False, + default='relpath'): + """Matcher that merges root directory with .hglf, suitable for log. + It is still possible to match .hglf directly. + For any listed files run log on the standin too. + matchfn tries both the given filename and with .hglf stripped. + """ + match = oldmatch(ctx, pats, opts, globbed, default) + m = copy.copy(match) + standins = [lfutil.standin(f) for f in m._files] + m._files.extend(standins) + m._fmap = set(m._files) + origmatchfn = m.matchfn + def lfmatchfn(f): + lf = lfutil.splitstandin(f) + if lf is not None and origmatchfn(lf): + return True + r = origmatchfn(f) + return r + m.matchfn = lfmatchfn + return m + oldmatch = installmatchfn(overridematch) try: repo.lfstatus = True return orig(ui, repo, *pats, **opts) finally: repo.lfstatus = False + restorematchfn() def overrideverify(orig, ui, repo, *pats, **opts): large = opts.pop('large', False) diff -r 8802277c40ee -r ed23d6100dd3 tests/test-largefiles.t --- a/tests/test-largefiles.t Tue Jan 15 01:05:12 2013 +0100 +++ b/tests/test-largefiles.t Tue Jan 15 01:05:12 2013 +0100 @@ -987,6 +987,47 @@ $ cat sub2/large7 large7 +Log on largefiles + +- same output + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 + 8:a381d2c8c80e modify normal file and largefile in repo b + 6:4355d653f84f edit files yet again + 5:9d5af5072dbd edit files again + 4:74c02385b94c move files + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4 + 8:a381d2c8c80e modify normal file and largefile in repo b + 6:4355d653f84f edit files yet again + 5:9d5af5072dbd edit files again + 4:74c02385b94c move files + +- .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub + 8:a381d2c8c80e modify normal file and largefile in repo b + 6:4355d653f84f edit files yet again + 5:9d5af5072dbd edit files again + 4:74c02385b94c move files + 1:ce8896473775 edit files + 0:30d30fe6a5be add files + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub + 9:598410d3eb9a modify normal file largefile in repo d + 8:a381d2c8c80e modify normal file and largefile in repo b + 6:4355d653f84f edit files yet again + 5:9d5af5072dbd edit files again + 4:74c02385b94c move files + 1:ce8896473775 edit files + 0:30d30fe6a5be add files + +- globbing gives same result + $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' + 9:598410d3eb9a modify normal file largefile in repo d + 8:a381d2c8c80e modify normal file and largefile in repo b + 6:4355d653f84f edit files yet again + 5:9d5af5072dbd edit files again + 4:74c02385b94c move files + 1:ce8896473775 edit files + 0:30d30fe6a5be add files + Rollback on largefiles. $ echo large4-modified-again > sub/large4