##// END OF EJS Templates
largefiles: changed overridelog to work with graphlog...
Lucas Moscovicz -
r21110:49e13e76 default
parent child Browse files
Show More
@@ -55,6 +55,22 b' def restorematchfn():'
55 restore matchfn to reverse'''
55 restore matchfn to reverse'''
56 scmutil.match = getattr(scmutil.match, 'oldmatch')
56 scmutil.match = getattr(scmutil.match, 'oldmatch')
57
57
58 def installmatchandpatsfn(f):
59 oldmatchandpats = scmutil.matchandpats
60 setattr(f, 'oldmatchandpats', oldmatchandpats)
61 scmutil.matchandpats = f
62 return oldmatchandpats
63
64 def restorematchandpatsfn():
65 '''restores scmutil.matchandpats to what it was before
66 installnormalfilesmatchandpatsfn was called. no-op if scmutil.matchandpats
67 is its original function.
68
69 Note that n calls to installnormalfilesmatchandpatsfn will require n calls
70 to restore matchfn to reverse'''
71 scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats',
72 scmutil.matchandpats)
73
58 def addlargefiles(ui, repo, *pats, **opts):
74 def addlargefiles(ui, repo, *pats, **opts):
59 large = opts.pop('large', None)
75 large = opts.pop('large', None)
60 lfsize = lfutil.getminsize(
76 lfsize = lfutil.getminsize(
@@ -241,19 +257,30 b' def overridedirty(orig, repo, ignoreupda'
241 repo._repo.lfstatus = False
257 repo._repo.lfstatus = False
242
258
243 def overridelog(orig, ui, repo, *pats, **opts):
259 def overridelog(orig, ui, repo, *pats, **opts):
244 def overridematch(ctx, pats=[], opts={}, globbed=False,
260 def overridematchandpats(ctx, pats=[], opts={}, globbed=False,
245 default='relpath'):
261 default='relpath'):
246 """Matcher that merges root directory with .hglf, suitable for log.
262 """Matcher that merges root directory with .hglf, suitable for log.
247 It is still possible to match .hglf directly.
263 It is still possible to match .hglf directly.
248 For any listed files run log on the standin too.
264 For any listed files run log on the standin too.
249 matchfn tries both the given filename and with .hglf stripped.
265 matchfn tries both the given filename and with .hglf stripped.
250 """
266 """
251 match = oldmatch(ctx, pats, opts, globbed, default)
267 matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default)
252 m = copy.copy(match)
268 m, p = copy.copy(matchandpats)
269
270 pats = set(p)
271 # TODO: handling of patterns in both cases below
272 if m._cwd:
273 back = (m._cwd.count('/') + 1) * '../'
274 pats.update(back + lfutil.standin(m._cwd + '/' + f) for f in p)
275 else:
276 pats.update(lfutil.standin(f) for f in p)
277
253 for i in range(0, len(m._files)):
278 for i in range(0, len(m._files)):
254 standin = lfutil.standin(m._files[i])
279 standin = lfutil.standin(m._files[i])
255 if standin in repo[ctx.node()]:
280 if standin in repo[ctx.node()]:
256 m._files[i] = standin
281 m._files[i] = standin
282 pats.add(standin)
283
257 m._fmap = set(m._files)
284 m._fmap = set(m._files)
258 m._always = False
285 m._always = False
259 origmatchfn = m.matchfn
286 origmatchfn = m.matchfn
@@ -264,14 +291,16 b' def overridelog(orig, ui, repo, *pats, *'
264 r = origmatchfn(f)
291 r = origmatchfn(f)
265 return r
292 return r
266 m.matchfn = lfmatchfn
293 m.matchfn = lfmatchfn
267 return m
294
268 oldmatch = installmatchfn(overridematch)
295 return m, pats
296
297 oldmatchandpats = installmatchandpatsfn(overridematchandpats)
269 try:
298 try:
270 repo.lfstatus = True
299 repo.lfstatus = True
271 return orig(ui, repo, *pats, **opts)
300 return orig(ui, repo, *pats, **opts)
272 finally:
301 finally:
273 repo.lfstatus = False
302 repo.lfstatus = False
274 restorematchfn()
303 restorematchandpatsfn()
275
304
276 def overrideverify(orig, ui, repo, *pats, **opts):
305 def overrideverify(orig, ui, repo, *pats, **opts):
277 large = opts.pop('large', False)
306 large = opts.pop('large', False)
@@ -760,8 +760,8 b' Test graph log'
760 $ hg log -qf sub2/large7
760 $ hg log -qf sub2/large7
761 7:daea875e9014
761 7:daea875e9014
762 $ hg log -Gqf sub2/large7
762 $ hg log -Gqf sub2/large7
763 abort: cannot follow file not in parent revision: "sub2/large7"
763 @ 7:daea875e9014
764 [255]
764 |
765 $ cd ..
765 $ cd ..
766 $ hg clone a -r 3 c
766 $ hg clone a -r 3 c
767 adding changesets
767 adding changesets
@@ -1143,6 +1143,8 b' Log on largefiles'
1143 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1143 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1144 @ 9:598410d3eb9a modify normal file largefile in repo d
1144 @ 9:598410d3eb9a modify normal file largefile in repo d
1145 |
1145 |
1146 o 8:a381d2c8c80e modify normal file and largefile in repo b
1147 |
1146 o 6:4355d653f84f edit files yet again
1148 o 6:4355d653f84f edit files yet again
1147 |
1149 |
1148 o 5:9d5af5072dbd edit files again
1150 o 5:9d5af5072dbd edit files again
@@ -1165,6 +1167,8 b' Log on largefiles'
1165 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1167 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1166 @ 9:598410d3eb9a modify normal file largefile in repo d
1168 @ 9:598410d3eb9a modify normal file largefile in repo d
1167 |
1169 |
1170 o 8:a381d2c8c80e modify normal file and largefile in repo b
1171 |
1168 o 6:4355d653f84f edit files yet again
1172 o 6:4355d653f84f edit files yet again
1169 |
1173 |
1170 o 5:9d5af5072dbd edit files again
1174 o 5:9d5af5072dbd edit files again
@@ -2203,6 +2207,12 b' Test actions on largefiles using relativ'
2203 summary: anotherlarge
2207 summary: anotherlarge
2204
2208
2205 $ hg log -G anotherlarge
2209 $ hg log -G anotherlarge
2210 @ changeset: 1:9627a577c5e9
2211 | tag: tip
2212 | user: test
2213 | date: Thu Jan 01 00:00:00 1970 +0000
2214 | summary: anotherlarge
2215 |
2206 $ echo more >> anotherlarge
2216 $ echo more >> anotherlarge
2207 $ hg st .
2217 $ hg st .
2208 M anotherlarge
2218 M anotherlarge
General Comments 0
You need to be logged in to leave comments. Login now