##// END OF EJS Templates
fileset: use decorator to mark a function as fileset predicate...
fileset: use decorator to mark a function as fileset predicate Using decorator can localize changes for adding (or removing) a fileset predicate function in source code. It is also useful to pick predicates up for specific purpose. For example, subsequent patches marks predicates as "call status" or "use existing" via decorator. To avoid (1) redundancy between "predicate name" and (the beginning of) help document, and (2) accidental typo of help document, this patch also makes decorator put predicate declration into the beginning of help.

File last commit:

r22583:23c995ed default
r27460:11286ac3 default
Show More
scmposix.py
33 lines | 902 B | text/x-python | PythonLexer
import sys, os
import osutil
def _rcfiles(path):
rcs = [os.path.join(path, 'hgrc')]
rcdir = os.path.join(path, 'hgrc.d')
try:
rcs.extend([os.path.join(rcdir, f)
for f, kind in osutil.listdir(rcdir)
if f.endswith(".rc")])
except OSError:
pass
return rcs
def systemrcpath():
path = []
if sys.platform == 'plan9':
root = 'lib/mercurial'
else:
root = 'etc/mercurial'
# old mod_python does not set sys.argv
if len(getattr(sys, 'argv', [])) > 0:
p = os.path.dirname(os.path.dirname(sys.argv[0]))
if p != '/':
path.extend(_rcfiles(os.path.join(p, root)))
path.extend(_rcfiles('/' + root))
return path
def userrcpath():
if sys.platform == 'plan9':
return [os.environ['home'] + '/lib/hgrc']
else:
return [os.path.expanduser('~/.hgrc')]