Patchwork extdiff: avoid double backslashes in the displayed tool path on Windows

login
register
mail settings
Submitter Matt Harbison
Date Dec. 3, 2018, 10:44 p.m.
Message ID <c39b92bd16598a3b7ca8.1543877077@mharbison-pc.attotech.com>
Download mbox | patch
Permalink /patch/36936/
State Accepted
Headers show

Comments

Matt Harbison - Dec. 3, 2018, 10:44 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1543859322 18000
#      Mon Dec 03 12:48:42 2018 -0500
# Node ID c39b92bd16598a3b7ca81f9ae0b768b452a88899
# Parent  3984409e144bcfd6a3325aa2ef5b9432a0a9a038
extdiff: avoid double backslashes in the displayed tool path on Windows

This shows the tool path in the help, and changed in 67b180c0e263.  uirepr()
already does the same thing, but that undoes the mangling in its call to repr().
Yuya Nishihara - Dec. 4, 2018, 11:25 a.m.
On Mon, 03 Dec 2018 17:44:37 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1543859322 18000
> #      Mon Dec 03 12:48:42 2018 -0500
> # Node ID c39b92bd16598a3b7ca81f9ae0b768b452a88899
> # Parent  3984409e144bcfd6a3325aa2ef5b9432a0a9a038
> extdiff: avoid double backslashes in the displayed tool path on Windows

Queued, thanks.

Patch

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -383,8 +383,9 @@  class savedcmd(object):
 
     def __init__(self, path, cmdline):
         # We can't pass non-ASCII through docstrings (and path is
-        # in an unknown encoding anyway)
-        docpath = stringutil.escapestr(path)
+        # in an unknown encoding anyway), but avoid double separators on
+        # Windows
+        docpath = stringutil.escapestr(path).replace(b'\\\\', b'\\')
         self.__doc__ %= {r'path': pycompat.sysstr(stringutil.uirepr(docpath))}
         self._cmdline = cmdline