[PATCH 2 of 4] hook: only print the note about native cmd translation if it actually changes

Matt Harbison mharbison72 at gmail.com
Mon Jul 16 17:31:33 EDT 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1531713103 14400
#      Sun Jul 15 23:51:43 2018 -0400
# Node ID 48070b1bc067ac31924c598686fb0822c6ff9409
# Parent  211dc3185a392d27964fc729c41b7265a98043f6
hook: only print the note about native cmd translation if it actually changes

This makes it so that it will never occur on a non Windows platform.

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -140,8 +140,10 @@ def _exthook(ui, repo, htype, name, cmd,
         env['HG_' + k.upper()] = v
 
     if ui.configbool('hooks', 'tonative.%s' % name, False):
-        ui.note(_('converting hook "%s" to native\n') % name)
+        oldcmd = cmd
         cmd = procutil.shelltonative(cmd, env)
+        if cmd != oldcmd:
+            ui.note(_('converting hook "%s" to native\n') % name)
 
     ui.note(_("running hook %s: %s\n") % (name, cmd))
 


More information about the Mercurial-devel mailing list