Patchwork D7066: phabricator: convert phabhunk and phabchange keys to bytes when finalising

login
register
mail settings
Submitter phabricator
Date Oct. 12, 2019, 1:45 p.m.
Message ID <differential-rev-PHID-DREV-zwzbz3hjd2zhzejpwfik-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42261/
State Superseded
Headers show

Comments

phabricator - Oct. 12, 2019, 1:45 p.m.
Kwan created this revision.
Kwan added a comment.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.


  I'd missed out the attrs key conversion needed on py3.

REVISION SUMMARY
  I thought I had included this code already but I'd missed it out.  One of the
  disadvantages of attrs is that all the keys are unicode strings on py3, but we
  need them to be byte strings.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -518,7 +518,7 @@ 
     def addhunk(self, hunk):
         if not isinstance(hunk, phabhunk):
             raise error.Abort(b'phabchange.addhunk only takes phabhunks')
-        self.hunks.append(hunk)
+        self.hunks.append(pycompat.byteskwargs(attr.asdict(hunk)))
         # It's useful to include these stats since the Phab web UI shows them,
         # and uses them to estimate how large a change a Revision is. Also used
         # in email subjects for the [+++--] bit.
@@ -549,7 +549,9 @@ 
     def addchange(self, change):
         if not isinstance(change, phabchange):
             raise error.Abort(b'phabdiff.addchange only takes phabchanges')
-        self.changes[change.currentPath] = change
+        self.changes[change.currentPath] = pycompat.byteskwargs(
+            attr.asdict(change)
+        )
 
 
 def maketext(pchange, ctx, fname):