Patchwork D7699: cmdutil: allow native string as input to check_at_most_one_arg()

login
register
mail settings
Submitter phabricator
Date Dec. 18, 2019, 7:39 p.m.
Message ID <differential-rev-PHID-DREV-go2c5roznrxmeqyuixo7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43979/
State Superseded
Headers show

Comments

phabricator - Dec. 18, 2019, 7:39 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We seem to always convert **opts args to use bytes as keys early on in
  Mercurial core, but I'm not sure we have good reason to do that, and
  not all extensions do that. It's therefore helpful to be able to pass
  in a native string to check_at_most_one_arg().

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 19, 2019, 5:12 p.m.
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  I hope one day we have a clear understanding of what is bytes and what is not in core.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -267,7 +267,7 @@ 
     """
 
     def to_display(name):
-        return name.replace(b'_', b'-')
+        return pycompat.sysbytes(name).replace(b'_', b'-')
 
     previous = None
     for x in args: