Patchwork D6108: py3: fix a few "dict keys as str instead of bytes" issues in phabricator.py

login
register
mail settings
Submitter phabricator
Date March 10, 2019, 1:50 a.m.
Message ID <20d0b1097700ae970a653cfeb82c0355@localhost.localdomain>
Download mbox | patch
Permalink /patch/39174/
State Not Applicable
Headers show

Comments

phabricator - March 10, 2019, 1:50 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG59bae59b7498: py3: fix a few &quot;dict keys as str instead of bytes&quot; issues in phabricator.py (authored by Kwan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6108?vs=14421&id=14433

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -762,7 +762,7 @@ 
     """
     def fetch(params):
         """params -> single drev or None"""
-        key = (params.get(r'ids') or params.get(r'phids') or [None])[0]
+        key = (params.get(b'ids') or params.get(b'phids') or [None])[0]
         if key in prefetched:
             return prefetched[key]
         drevs = callconduit(repo, b'differential.query', params)
@@ -779,7 +779,7 @@ 
         """given a top, get a stack from the bottom, [id] -> [id]"""
         visited = set()
         result = []
-        queue = [{r'ids': [i]} for i in topdrevids]
+        queue = [{b'ids': [i]} for i in topdrevids]
         while queue:
             params = queue.pop()
             drev = fetch(params)
@@ -923,7 +923,7 @@ 
         # Try to preserve metadata from hg:meta property. Write hg patch
         # headers that can be read by the "import" command. See patchheadermap
         # and extract in mercurial/patch.py for supported headers.
-        meta = getdiffmeta(diffs[str(diffid)])
+        meta = getdiffmeta(diffs[b'%d' % diffid])
         for k in _metanamemap.keys():
             if k in meta:
                 header += b'# %s %s\n' % (_metanamemap[k], meta[k])