Patchwork D7219: hghave: decode black's version before passing to StrictVersion

login
register
mail settings
Submitter phabricator
Date Nov. 4, 2019, 7:12 p.m.
Message ID <differential-rev-PHID-DREV-w4n6ln4zanswqg5gohkn-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42728/
State Superseded
Headers show

Comments

phabricator - Nov. 4, 2019, 7:12 p.m.
Kwan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  StrictVersion doesn't accept bytes, so test-hghave.t was dying with
  "cannot use a string pattern on a bytes-like object".

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS




To: Kwan, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 4, 2019, 9:21 p.m.
durin42 added a comment.


  This is subtlely wrong on Python 2, and I think D7221 <https://phab.mercurial-scm.org/D7221> is a correct fix.
  
  (I'd previously mailed that patch, but mail is backlogged.)

REPOSITORY
  rHG Mercurial

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

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

To: Kwan, #hg-reviewers
Cc: durin42, mercurial-devel
phabricator - Nov. 4, 2019, 9:35 p.m.
Kwan added a comment.
Kwan abandoned this revision.


  Drop in favour of D7221 <https://phab.mercurial-scm.org/D7221>.

REPOSITORY
  rHG Mercurial

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

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

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

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -987,4 +987,4 @@ 
     version_regex = b'black, version ([0-9a-b.]+)'
     version = matchoutput(blackcmd, version_regex)
     sv = distutils.version.StrictVersion
-    return version and sv(version.group(1)) >= sv('19.10b0')
+    return version and sv(version.group(1).decode()) >= sv('19.10b0')