##// END OF EJS Templates
revlog: make "size" diverge from "rawsize"...
revlog: make "size" diverge from "rawsize" Previously, revlog.size equals to revlog.rawsize. However, the flag processor framework could make a difference - "size" could mean the length of len(revision(raw=False)), while "rawsize" means len(revision(raw=True)). This patch makes it so. This corrects "hg status" output when flag processor is involved. The call stack looks like: basectx.status -> workingctx._buildstatus -> workingctx._dirstatestatus -> workingctx._checklookup -> filectx.cmp -> filelog.cmp -> filelog.size -> revlog.size

File last commit:

r31685:d83e5165 default
r31856:0ab7f469 default
Show More
test-config-env.py
48 lines | 1.2 KiB | text/x-python | PythonLexer
# Test the config layer generated by environment variables
from __future__ import absolute_import, print_function
import os
from mercurial import (
encoding,
rcutil,
ui as uimod,
)
testtmp = encoding.environ['TESTTMP']
# prepare hgrc files
def join(name):
return os.path.join(testtmp, name)
with open(join('sysrc'), 'w') as f:
f.write('[ui]\neditor=e0\n[pager]\npager=p0\n')
with open(join('userrc'), 'w') as f:
f.write('[ui]\neditor=e1')
# replace rcpath functions so they point to the files above
def systemrcpath():
return [join('sysrc')]
def userrcpath():
return [join('userrc')]
rcutil.systemrcpath = systemrcpath
rcutil.userrcpath = userrcpath
os.path.isdir = lambda x: False # hack: do not load default.d/*.rc
# utility to print configs
def printconfigs(env):
encoding.environ = env
rcutil._rccomponents = None # reset cache
ui = uimod.ui.load()
for section, name, value in ui.walkconfig():
source = ui.configsource(section, name)
print('%s.%s=%s # %s' % (section, name, value, source))
print('')
# environment variable overrides
printconfigs({})
printconfigs({'EDITOR': 'e2', 'PAGER': 'p2'})