Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 2601:00fc88b0b256
move most of tag code to localrepository class.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Wed, 12 Jul 2006 08:59:20 -0700 |
parents | 0875cda033fd |
children | 6c5b1b5cc160 |
line wrap: on
line diff
--- a/mercurial/util.py Wed Jul 12 08:28:00 2006 -0700 +++ b/mercurial/util.py Wed Jul 12 08:59:20 2006 -0700 @@ -378,6 +378,13 @@ if command fails and onerr is None, return status. if ui object, print error message and return status, else raise onerr object as exception.''' + def py2shell(val): + 'convert python object into string that is useful to shell' + if val in (None, False): + return '0' + if val == True: + return '1' + return str(val) oldenv = {} for k in environ: oldenv[k] = os.environ.get(k) @@ -385,7 +392,7 @@ oldcwd = os.getcwd() try: for k, v in environ.iteritems(): - os.environ[k] = str(v) + os.environ[k] = py2shell(v) if cwd is not None and oldcwd != cwd: os.chdir(cwd) rc = os.system(cmd)