py3: fix kwargs handling for `hg bookmarks`
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 24 Jun 2017 19:55:01 +0530
changeset 38411 d170f59f6f55dedae8746fe4b8b45b09f4b765b4
parent 38410 73dfc72704b6147797b7bfb32a971e8aa9310c33
child 38412 7fed389f9a9fd15456498ee59962483194cbabbe
push id540
push usergszorc@mozilla.com
push dateSun, 02 Jul 2017 02:16:50 +0000
py3: fix kwargs handling for `hg bookmarks`
mercurial/bookmarks.py
mercurial/commands.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -15,16 +15,17 @@ from .node import (
     hex,
     short,
 )
 from . import (
     encoding,
     error,
     lock as lockmod,
     obsolete,
+    pycompat,
     scmutil,
     txnutil,
     util,
 )
 
 # label constants
 # until 3.5, bookmarks.current was the advertised name, not
 # bookmarks.active, so we must use both to avoid breaking old
@@ -766,16 +767,17 @@ def addbookmarks(repo, tr, names, rev=No
     marks.recordchange(tr)
 
 def _printbookmarks(ui, repo, bmarks, **opts):
     """private method to print bookmarks
 
     Provides a way for extensions to control how bookmarks are printed (e.g.
     prepend or postpend names)
     """
+    opts = pycompat.byteskwargs(opts)
     fm = ui.formatter('bookmarks', opts)
     hexfn = fm.hexfunc
     if len(bmarks) == 0 and fm.isplain():
         ui.status(_("no bookmarks set\n"))
     for bmark, (n, prefix, label) in sorted(bmarks.iteritems()):
         fm.startitem()
         if not ui.quiet:
             fm.plain(' %s ' % prefix, label=label)
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -939,22 +939,21 @@ def bookmark(ui, repo, *names, **opts):
       - rename bookmark turkey to dinner::
 
           hg book -m turkey dinner
 
       - move the '@' bookmark from another branch::
 
           hg book -f @
     '''
-    opts = pycompat.byteskwargs(opts)
-    force = opts.get('force')
-    rev = opts.get('rev')
-    delete = opts.get('delete')
-    rename = opts.get('rename')
-    inactive = opts.get('inactive')
+    force = opts.get(r'force')
+    rev = opts.get(r'rev')
+    delete = opts.get(r'delete')
+    rename = opts.get(r'rename')
+    inactive = opts.get(r'inactive')
 
     if delete and rename:
         raise error.Abort(_("--delete and --rename are incompatible"))
     if delete and rev:
         raise error.Abort(_("--rev is incompatible with --delete"))
     if rename and rev:
         raise error.Abort(_("--rev is incompatible with --rename"))
     if not names and (delete or rev):