D7698: cmdutil: return underscore-separate name from check_at_most_one_arg()

2019-12-19 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGdfac25883dbf: cmdutil: return underscore-separate name from 
check_at_most_one_arg() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7698?vs=18865=18883

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -265,13 +265,17 @@
 
 Returns the unique argument or None if none of them were specified.
 """
+
+def to_display(name):
+return name.replace(b'_', b'-')
+
 previous = None
 for x in args:
 if opts.get(x):
-x = x.replace(b'_', b'-')
 if previous:
 raise error.Abort(
-_(b'cannot specify both --%s and --%s') % (previous, x)
+_(b'cannot specify both --%s and --%s')
+% (to_display(previous), to_display(x))
 )
 previous = x
 return previous



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7698: cmdutil: return underscore-separate name from check_at_most_one_arg()

2019-12-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As noticed by Yuya, when I changed the function (during review) to
  work with underscore-separated names as input, I forgot to make sure
  the returned name was also underscore-separated. We don't have any
  cases where it matters yet, but it should still clearly be fixed.
  
  Instead of converting the hyphen-separated value we already have in
  `previous`, I'm changing it so we convert to the underscore-separated
  values to be hyphen-separated only when we need to display them. This
  will also help a coming change where we allow the inputs to native
  strings instead only bytes.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -265,13 +265,17 @@
 
 Returns the unique argument or None if none of them were specified.
 """
+
+def to_display(name):
+return name.replace(b'_', b'-')
+
 previous = None
 for x in args:
 if opts.get(x):
-x = x.replace(b'_', b'-')
 if previous:
 raise error.Abort(
-_(b'cannot specify both --%s and --%s') % (previous, x)
+_(b'cannot specify both --%s and --%s')
+% (to_display(previous), to_display(x))
 )
 previous = x
 return previous



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel