From patchwork Wed Nov 12 14:38:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4, of, 6, V3] util.system: use ui.system() in place of optional ui.fout parameter From: Yuya Nishihara X-Patchwork-Id: 6689 Message-Id: To: mercurial-devel@selenic.com Date: Wed, 12 Nov 2014 23:38:03 +0900 # HG changeset patch # User Yuya Nishihara # Date 1415419582 -32400 # Sat Nov 08 13:06:22 2014 +0900 # Node ID d0361d0711b30aecfdc14b702411bebc693c170f # Parent 2a5d6faf78807ab8183bc7fa85a6e609eccc69a9 util.system: use ui.system() in place of optional ui.fout parameter diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -226,7 +226,7 @@ def dodiff(ui, repo, diffcmd, diffopts, cmdline = util.shellquote(diffcmd) + ' ' + args ui.debug('running %r in %s\n' % (cmdline, tmproot)) - util.system(cmdline, cwd=tmproot, out=ui.fout) + ui.system(cmdline, cwd=tmproot) for copy_fn, working_fn, mtime in fns_and_mtime: if os.lstat(copy_fn).st_mtime != mtime: diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -35,7 +35,7 @@ vdiff on hovered and selected revisions. ''' import os -from mercurial import cmdutil, commands, util, patch, revlog, scmutil +from mercurial import cmdutil, commands, patch, revlog, scmutil from mercurial.node import nullid, nullrev, short from mercurial.i18n import _ @@ -349,4 +349,4 @@ def view(ui, repo, *etc, **opts): optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v]) cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc)) ui.debug("running %s\n" % cmd) - util.system(cmd, out=ui.fout) + ui.system(cmd) diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -328,10 +328,9 @@ the hunk is left unchanged. f.close() # Start the editor and wait for it to complete editor = ui.geteditor() - util.system("%s \"%s\"" % (editor, patchfn), - environ={'HGUSER': ui.username()}, - onerr=util.Abort, errprefix=_("edit failed"), - out=ui.fout) + ui.system("%s \"%s\"" % (editor, patchfn), + environ={'HGUSER': ui.username()}, + onerr=util.Abort, errprefix=_("edit failed")) # Remove comment lines patchfp = open(patchfn) ncpatchfp = cStringIO.StringIO() diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -233,13 +233,12 @@ class transplanter(object): fp.close() try: - util.system('%s %s %s' % (filter, util.shellquote(headerfile), - util.shellquote(patchfile)), - environ={'HGUSER': changelog[1], - 'HGREVISION': revlog.hex(node), - }, - onerr=util.Abort, errprefix=_('filter failed'), - out=self.ui.fout) + self.ui.system('%s %s %s' % (filter, util.shellquote(headerfile), + util.shellquote(patchfile)), + environ={'HGUSER': changelog[1], + 'HGREVISION': revlog.hex(node), + }, + onerr=util.Abort, errprefix=_('filter failed')) user, date, msg = self.parselog(file(headerfile))[1:4] finally: os.unlink(headerfile) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -743,9 +743,7 @@ def bisect(ui, repo, rev=None, extra=Non # update state state['current'] = [node] hbisect.save_state(repo, state) - status = util.system(command, - environ={'HG_NODE': hex(node)}, - out=ui.fout) + status = ui.system(command, environ={'HG_NODE': hex(node)}) if status == 125: transition = "skip" elif status == 0: @@ -1573,9 +1571,8 @@ def config(ui, repo, *values, **opts): fp.close() editor = ui.geteditor() - util.system("%s \"%s\"" % (editor, f), - onerr=util.Abort, errprefix=_("edit failed"), - out=ui.fout) + ui.system("%s \"%s\"" % (editor, f), + onerr=util.Abort, errprefix=_("edit failed")) return for f in scmutil.rcpath(): diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -402,7 +402,7 @@ class cmdalias(object): return '' cmd = re.sub(r'\$(\d+|\$)', _checkvar, self.definition[1:]) cmd = aliasinterpolate(self.name, args, cmd) - return util.system(cmd, environ=env, out=ui.fout) + return ui.system(cmd, environ=env) self.fn = fn return diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -301,8 +301,7 @@ def _xmerge(repo, mynode, orig, fcd, fco replace = {'local': a, 'base': b, 'other': c, 'output': out} args = util.interpolate(r'\$', replace, args, lambda s: util.shellquote(util.localpath(s))) - r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env, - out=ui.fout) + r = ui.system(toolpath + ' ' + args, cwd=repo.root, environ=env) return True, r return False, 0 diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -131,7 +131,7 @@ def _exthook(ui, repo, name, cmd, args, cwd = repo.root else: cwd = os.getcwd() - r = util.system(cmd, environ=env, cwd=cwd, out=ui.fout) + r = ui.system(cmd, environ=env, cwd=cwd) duration = time.time() - starttime ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n', diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -52,7 +52,7 @@ class sshpeer(wireproto.wirepeer): util.shellquote("%s init %s" % (_serverquote(remotecmd), _serverquote(self.path)))) ui.debug('running %s\n' % cmd) - res = util.system(cmd, out=ui.fout) + res = ui.system(cmd) if res != 0: self._abort(error.RepoError(_("could not create remote repo")))