Patchwork D7375: py3: replace "%r" by"'%s'% for py3-compatible (and clearer) quoting in chg

login
register
mail settings
Submitter phabricator
Date Nov. 13, 2019, 6:28 p.m.
Message ID <differential-rev-PHID-DREV-d4v2ev2sjs42qgpylctc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43159/
State Superseded
Headers show

Comments

phabricator - Nov. 13, 2019, 6:28 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7375

AFFECTED FILES
  mercurial/chgserver.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 13, 2019, 10:59 p.m.
durin42 added a comment.


  I feel obligated to point out that this will result in different (wrong!) quoting if `path` contains a `'`, but that's also probably fine since it's just a log.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7375/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7375

To: martinvonz, #hg-reviewers
Cc: durin42, mercurial-devel
phabricator - Nov. 13, 2019, 11:07 p.m.
martinvonz added a comment.


  In D7375#108431 <https://phab.mercurial-scm.org/D7375#108431>, @durin42 wrote:
  
  > I feel obligated to point out that this will result in different (wrong!) quoting if `path` contains a `'`, but that's also probably fine since it's just a log.
  
  Oh, good to know! I had no idea that `%r` does escaping too.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7375/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7375

To: martinvonz, #hg-reviewers
Cc: durin42, mercurial-devel

Patch

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -505,7 +505,7 @@ 
         path = self._readstr()
         if not path:
             return
-        self.ui.log(b'chgserver', b'chdir to %r\n', path)
+        self.ui.log(b'chgserver', b"chdir to '%s'\n", path)
         os.chdir(path)
 
     def setumask(self):