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

login
register
mail settings
Submitter Matt Harbison
Date July 16, 2018, 9:31 p.m.
Message ID <48070b1bc067ac31924c.1531776693@mharbison-pc.attotech.com>
Download mbox | patch
Permalink /patch/32878/
State Accepted
Headers show

Comments

Matt Harbison - July 16, 2018, 9:31 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.

Patch

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))