comparison mercurial/scmutil.py @ 37762:7269b87f817c

scmutil: teach the file prefetch hook to handle multiple commits The remainder of the commands that need prefetch deal with multiple revisions. I initially coded this as a separate hook, but then it needed a list of files to handle `diff` and `grep`, so it didn't seem worth keeping them separate. Not every matcher will emit bad file messages (some are built from a list of files that are known to exist). But it seems better to filter this in one place than to push this on either each caller or each hook implementation.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 14 Apr 2018 18:50:45 -0400
parents 7b2955624777
children 44d1959acb3b
comparison
equal deleted inserted replaced
37761:ff6b0a20849d 37762:7269b87f817c
1355 _reportnewcssource = [ 1355 _reportnewcssource = [
1356 'pull', 1356 'pull',
1357 'unbundle', 1357 'unbundle',
1358 ] 1358 ]
1359 1359
1360 # a list of (repo, ctx, files) functions called by various commands to allow 1360 def prefetchfiles(repo, revs, match):
1361 # extensions to ensure the corresponding files are available locally, before the 1361 """Invokes the registered file prefetch functions, allowing extensions to
1362 # command uses them. 1362 ensure the corresponding files are available locally, before the command
1363 uses them."""
1364 if match:
1365 # The command itself will complain about files that don't exist, so
1366 # don't duplicate the message.
1367 match = matchmod.badmatch(match, lambda fn, msg: None)
1368 else:
1369 match = matchall(repo)
1370
1371 fileprefetchhooks(repo, revs, match)
1372
1373 # a list of (repo, revs, match) prefetch functions
1363 fileprefetchhooks = util.hooks() 1374 fileprefetchhooks = util.hooks()
1364 1375
1365 # A marker that tells the evolve extension to suppress its own reporting 1376 # A marker that tells the evolve extension to suppress its own reporting
1366 _reportstroubledchangesets = True 1377 _reportstroubledchangesets = True
1367 1378