[cig-commits] commit: 'walkhg' accepts (0|no|false|1|yes|true) as boolean values
Mercurial
hg at geodynamics.org
Mon Nov 24 11:26:56 PST 2008
changeset: 30:ddf24d7eb625
user: Robin Farine <robin.farine at terminus.org>
date: Sun Dec 17 12:17:24 2006 +0100
files: forest.py test-forest
description:
'walkhg' accepts (0|no|false|1|yes|true) as boolean values
diff -r 422907bd754f -r ddf24d7eb625 forest.py
--- a/forest.py Sat Dec 09 13:33:30 2006 +0100
+++ b/forest.py Sun Dec 17 12:17:24 2006 +0100
@@ -29,11 +29,12 @@ This extension recognizes the following
This extension recognizes the following item in the forest
configuration section:
-walkhg = (0|1)
-
- Whether repositories under a .hg directory should be skipped (0) or
- not (1). The default value is 0. Some commands accept the --walkhg
- command-line option to override the behavior selected by this item.
+walkhg = (0|no|false|1|yes|true)
+
+ Whether repositories under a .hg directory should be skipped
+ (0|no|false) or not (1|yes|true). The default value is 0. Some
+ commands accept the --walkhg command-line option to override the
+ behavior selected by this item.
"""
import ConfigParser
@@ -60,8 +61,13 @@ def enumerate_repos(ui, top='', **opts):
"""Generate a lexicographically sorted list of repository roots."""
walkhg = opts['walkhg']
- if walkhg == 2:
- walkhg = ui.configbool('forest', 'walkhg', 0)
+ if walkhg == '':
+ walkhg = ui.config('forest', 'walkhg', 'false')
+ try:
+ walkhg = { '0' : False, 'false' : False, 'no' : False,
+ '1' : True, 'true' : True, 'yes' : True }[walkhg.lower()]
+ except KeyError:
+ raise util.Abort(_("invalid value for 'walkhg': %s" % walkhg))
dirs = ['.']
while dirs:
root = dirs.pop()
@@ -364,8 +370,9 @@ def trees(ui, *unused, **opts):
def uisetup(ui):
global cmdtable
- walkhgopt = ('', 'walkhg', 2,
- _("whether to walk (1) repositories under '.hg' or not (0)"))
+ walkhgopt = ('', 'walkhg', '',
+ _("whether to walk (1|yes|true) repositories under '.hg' or "
+ "not (0|no|false)"))
cmdtable = {
"fclone" :
(clone,
diff -r 422907bd754f -r ddf24d7eb625 test-forest
--- a/test-forest Sat Dec 09 13:33:30 2006 +0100
+++ b/test-forest Sun Dec 17 12:17:24 2006 +0100
@@ -99,6 +99,6 @@ hg ftrees --cwd walkhg
hg ftrees --cwd walkhg
hg ftrees --cwd walkhg --walkhg=1
echo "[forest]" >> walkhg/.hg/hgrc
-echo "walkhg = 1" >> walkhg/.hg/hgrc
+echo "walkhg = Yes" >> walkhg/.hg/hgrc
hg ftrees --cwd walkhg
-hg ftrees --cwd walkhg --walkhg=0
+hg ftrees --cwd walkhg --walkhg=FALSE
More information about the CIG-COMMITS
mailing list