Mercurial > hg-stable
view tests/ls-l.py @ 46308:05a1e44b2224
persistent-nodemap: add a revlog.storage.persistent-nodemap.slow-path option
As discussed during the sprint, we want to prevent user to get an unexpected
performance regression when accessing a repository using "persistent-nodemap"
without the associated Rust extension.
We start by adding a config declaration and some documentation.
Since "allow" is the current behavior, we don't need to add any code. The option
possible value will come later.
Note that we already have a `storage.revlog.nodemap.mode` option, but that
option is a bit different. It does some warning and checking at revlog
instantiation time. While we want something done at requirements checking time.
Since we plan for new names and new config value names, we introduce a new
option and will drop the old one later.
Differential Revision: https://phab.mercurial-scm.org/D9758
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 14 Jan 2021 01:25:06 +0100 |
parents | c102b704edb5 |
children | 6000f5b25c9b |
line wrap: on
line source
#!/usr/bin/env python3 # like ls -l, but do not print date, user, or non-common mode bit, to avoid # using globs in tests. from __future__ import absolute_import, print_function import os import stat import sys def modestr(st): mode = st.st_mode result = '' if mode & stat.S_IFDIR: result += 'd' else: result += '-' for owner in ['USR', 'GRP', 'OTH']: for action in ['R', 'W', 'X']: if mode & getattr(stat, 'S_I%s%s' % (action, owner)): result += action.lower() else: result += '-' return result def sizestr(st): if st.st_mode & stat.S_IFREG: return '%7d' % st.st_size else: # do not show size for non regular files return ' ' * 7 os.chdir((sys.argv[1:] + ['.'])[0]) for name in sorted(os.listdir('.')): st = os.stat(name) print('%s %s %s' % (modestr(st), sizestr(st), name))