chiark / gitweb /
Ignore the gitk exit code in 'stg log -g' (bug #10010)
authorCatalin Marinas <catalin.marinas@gmail.com>
Fri, 7 Dec 2007 21:19:25 +0000 (21:19 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Fri, 7 Dec 2007 21:19:25 +0000 (21:19 +0000)
The patch adds the 'exitcode' boolean argument to Run.run() and
modifies the 'log' command.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/log.py
stgit/run.py

index 39c21182f6f5a3ab099d761eee0df6a5dec1b169..56f7e0abfa2700dd84d5441d0dab123666b4f781 100644 (file)
@@ -21,6 +21,7 @@ from pydoc import pager
 from stgit.commands.common import *
 from stgit import stack, git
 from stgit.out import *
+from stgit.run import Run
 
 help = 'display the patch changelog'
 usage = """%prog [options] [patch]
@@ -140,7 +141,6 @@ def func(parser, options, args):
         raise CmdException, 'No changelog for patch "%s"' % name
 
     if options.graphical:
-        if os.system('gitk %s' % log) != 0:
-            raise CmdException, 'gitk execution failed'
+        Run('gitk', log).run(exitcode = False)
     else:
         show_log(log, options)
index 83bf5f5f356f5ae92dd1b183d57e5fbeac94db5d..be5ff0fc58964e4b824f4c8960d6651c56d8bd10 100644 (file)
@@ -78,7 +78,7 @@ class Run:
         self.__log_end(self.exitcode)
         self.__check_exitcode()
         return outdata
-    def __run_noio(self):
+    def __run_noio(self, exitcode = True):
         """Run without captured IO."""
         assert self.__indata == None
         self.__log_start()
@@ -88,7 +88,8 @@ class Run:
         except OSError, e:
             raise self.exc('%s failed: %s' % (self.__cmd[0], e))
         self.__log_end(self.exitcode)
-        self.__check_exitcode()
+        if exitcode:
+            self.__check_exitcode()
     def returns(self, retvals):
         self.__good_retvals = retvals
         return self
@@ -128,9 +129,9 @@ class Run:
         else:
             raise self.exc('%s produced %d lines, expected 1'
                            % (self.__cmd[0], len(outlines)))
-    def run(self):
+    def run(self, exitcode = True):
         """Just run, with no IO redirection."""
-        self.__run_noio()
+        self.__run_noio(exitcode = exitcode)
     def xargs(self, xargs):
         """Just run, with no IO redirection. The extra arguments are
         appended to the command line a few at a time; the command is