comparison mercurial/ui.py @ 35923:efbd04238029

cmdutil: convert _revertprefetch() to a generic stored file hook (API) This will be used by LFS to fetch required files in a group for multiple commands, prior to being accessed. That avoids the one-at-a-time fetch when the filelog wrapper goes to access it, and it is missing locally (which costs two round trips to the server.) The core command list that needs this is probably at least: - annotate - archive (which is also used by extdiff) - cat - diff - export - grep - verify (sadly) - anything that has the '{data}' template There are no core users of the revert prefetch hook, and never have been since it was introduced in 45e02cfad4bd for remotefilelog. Thanks to Yuya for figuring out a way to reliably trigger the deprecated warning. Unfortunately, it wanted to blame the caller of revert. Passing along an adjusted stack level seemed the least bad choice (although it still blames a core function). One thing to note is that the store lock isn't being held when this is called. I'm not at all familiar with remotefilelog or its locking requirements, so this may not be a big deal. Currently, LFS doesn't hold a lock when downloading files. Even though largefiles doesn't either, I'm starting to think it should, and maybe the .hg/store/lock isn't good enough to cover the globally shared cache. .. api:: The cmdutil._revertprefetch() hook point for prefetching stored files has been replaced by the command agnostic cmdutil._prefetchfiles(). The new function takes a list of files, instead of a list of lists of files.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 04 Feb 2018 14:14:28 -0500
parents 704095e27c5c
children fd54846e1f8e
comparison
equal deleted inserted replaced
35922:0b79f99fd7b0 35923:efbd04238029
1612 % ((msg,) + calframe[stacklevel][1:4])) 1612 % ((msg,) + calframe[stacklevel][1:4]))
1613 self.log('develwarn', '%s at: %s:%s (%s)\n', 1613 self.log('develwarn', '%s at: %s:%s (%s)\n',
1614 msg, *calframe[stacklevel][1:4]) 1614 msg, *calframe[stacklevel][1:4])
1615 curframe = calframe = None # avoid cycles 1615 curframe = calframe = None # avoid cycles
1616 1616
1617 def deprecwarn(self, msg, version): 1617 def deprecwarn(self, msg, version, stacklevel=2):
1618 """issue a deprecation warning 1618 """issue a deprecation warning
1619 1619
1620 - msg: message explaining what is deprecated and how to upgrade, 1620 - msg: message explaining what is deprecated and how to upgrade,
1621 - version: last version where the API will be supported, 1621 - version: last version where the API will be supported,
1622 """ 1622 """
1623 if not (self.configbool('devel', 'all-warnings') 1623 if not (self.configbool('devel', 'all-warnings')
1624 or self.configbool('devel', 'deprec-warn')): 1624 or self.configbool('devel', 'deprec-warn')):
1625 return 1625 return
1626 msg += ("\n(compatibility will be dropped after Mercurial-%s," 1626 msg += ("\n(compatibility will be dropped after Mercurial-%s,"
1627 " update your code.)") % version 1627 " update your code.)") % version
1628 self.develwarn(msg, stacklevel=2, config='deprec-warn') 1628 self.develwarn(msg, stacklevel=stacklevel, config='deprec-warn')
1629 1629
1630 def exportableenviron(self): 1630 def exportableenviron(self):
1631 """The environment variables that are safe to export, e.g. through 1631 """The environment variables that are safe to export, e.g. through
1632 hgweb. 1632 hgweb.
1633 """ 1633 """