mercurial/ui.py
changeset 45061 02b17231f6c3
parent 45033 b4b6ff83ed9c
child 45758 14ac6a74e7e7
child 45765 ed84a4d48910
equal deleted inserted replaced
45060:baffdfa5bd1a 45061:02b17231f6c3
  2117             # just restoring ui.quiet config to the previous value is not enough
  2117             # just restoring ui.quiet config to the previous value is not enough
  2118             # as it does not update ui.quiet class member
  2118             # as it does not update ui.quiet class member
  2119             if (b'ui', b'quiet') in overrides:
  2119             if (b'ui', b'quiet') in overrides:
  2120                 self.fixconfig(section=b'ui')
  2120                 self.fixconfig(section=b'ui')
  2121 
  2121 
       
  2122     def estimatememory(self):
       
  2123         """Provide an estimate for the available system memory in Bytes.
       
  2124 
       
  2125         This can be overriden via ui.available-memory. It returns None, if
       
  2126         no estimate can be computed.
       
  2127         """
       
  2128         value = self.config(b'ui', b'available-memory')
       
  2129         if value is not None:
       
  2130             try:
       
  2131                 return util.sizetoint(value)
       
  2132             except error.ParseError:
       
  2133                 raise error.ConfigError(
       
  2134                     _(b"ui.available-memory value is invalid ('%s')") % value
       
  2135                 )
       
  2136         return util._estimatememory()
       
  2137 
  2122 
  2138 
  2123 class paths(dict):
  2139 class paths(dict):
  2124     """Represents a collection of paths and their configs.
  2140     """Represents a collection of paths and their configs.
  2125 
  2141 
  2126     Data is initially derived from ui instances and the config files they have
  2142     Data is initially derived from ui instances and the config files they have