diff mercurial/ui.py @ 31124:fbce78c58f1e

chg: refactor ui.system() to be partly overridden Since fd598149112b changed the signature of ui.system(), chgui.system() should have been updated. This patch factors out the util.system() call so that chg can override how a shell command is executed.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 19 Feb 2017 01:00:10 +0900
parents a185b903bda3
children 3f8f53190d6a
line wrap: on
line diff
--- a/mercurial/ui.py	Tue Feb 21 18:22:07 2017 +0100
+++ b/mercurial/ui.py	Sun Feb 19 01:00:10 2017 +0900
@@ -1288,8 +1288,14 @@
         if any(s[1] for s in self._bufferstates):
             out = self
         with self.timeblockedsection(blockedtag):
-            return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
-                               errprefix=errprefix, out=out)
+            return self._runsystem(cmd, environ=environ, cwd=cwd, onerr=onerr,
+                                   errprefix=errprefix, out=out)
+
+    def _runsystem(self, cmd, environ, cwd, onerr, errprefix, out):
+        """actually execute the given shell command (can be overridden by
+        extensions like chg)"""
+        return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
+                           errprefix=errprefix, out=out)
 
     def traceback(self, exc=None, force=False):
         '''print exception traceback if traceback printing enabled or forced.