mercurial/util.py
changeset 2601 00fc88b0b256
parent 2579 0875cda033fd
child 2609 6c5b1b5cc160
--- 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)