Patchwork [2,of,9] bookmarks: convert opts to bytes dict early

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 21, 2018, 1:24 p.m.
Message ID <c8d2fd3848a58477e0ce.1537536244@mimosa>
Download mbox | patch
Permalink /patch/34895/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 21, 2018, 1:24 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1536979875 -32400
#      Sat Sep 15 11:51:15 2018 +0900
# Node ID c8d2fd3848a58477e0ce9eb15b62c0e7cc30303e
# Parent  9e58d4b235e42fbf982dd733252e5d442f211422
bookmarks: convert opts to bytes dict early

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -958,12 +958,13 @@  def bookmark(ui, repo, *names, **opts):
 
           hg book -f @
     '''
-    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')
-    active = opts.get(r'active')
+    opts = pycompat.byteskwargs(opts)
+    force = opts.get('force')
+    rev = opts.get('rev')
+    delete = opts.get('delete')
+    rename = opts.get('rename')
+    inactive = opts.get('inactive')
+    active = opts.get('active')
 
     if delete and rename:
         raise error.Abort(_("--delete and --rename are incompatible"))
@@ -1011,7 +1012,6 @@  def bookmark(ui, repo, *names, **opts):
             return 1
         ui.write("%s\n" % book, label=bookmarks.activebookmarklabel)
     else: # show bookmarks
-        opts = pycompat.byteskwargs(opts)
         with ui.formatter('bookmarks', opts) as fm:
             bookmarks.printbookmarks(ui, repo, fm)