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
+++ b/mercurial/util.py
@@ -378,6 +378,13 @@ def system(cmd, environ={}, cwd=None, on
     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 @@ def system(cmd, environ={}, cwd=None, on
         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)