Mercurial > public > mercurial-scm > hg
diff tests/hghave.py @ 47377:26127236b229
convert-bazaar: use breezy package instead of old bzr one
Breezy is the most recent of the two, and works on Python 3 while being
compatible with the (old) Bazaar file format.
This patch contains a variety of unicode <-> bytes changes, API breakage fixing,
restoring failing imports and changing the executable from `bzr` to `brz`.
I recommend using the debian packages for `brz` and `python3-breezy` (3.1+),
because the pip package seems to be haunted by radioactive dragons.
Differential Revision: https://phab.mercurial-scm.org/D10513
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Mon, 26 Apr 2021 22:59:56 +0200 |
parents | a1e91a87a7c8 |
children | a8e33ab50c4f |
line wrap: on
line diff
--- a/tests/hghave.py Wed Apr 21 10:58:21 2021 +0200 +++ b/tests/hghave.py Mon Apr 26 22:59:56 2021 +0200 @@ -168,35 +168,25 @@ return matchoutput('baz --version 2>&1', br'baz Bazaar version') -@check("bzr", "Canonical's Bazaar client") +@check("bzr", "Breezy library and executable version >= 3.1") def has_bzr(): if not is_not_python2: return False try: - import bzrlib - import bzrlib.bzrdir - import bzrlib.errors - import bzrlib.revision - import bzrlib.revisionspec + # Test the Breezy python lib + import breezy + import breezy.bzr.bzrdir + import breezy.errors + import breezy.revision + import breezy.revisionspec - bzrlib.revisionspec.RevisionSpec - return bzrlib.__doc__ is not None + breezy.revisionspec.RevisionSpec + if breezy.__doc__ is None or breezy.version_info[:2] < (3, 1): + return False except (AttributeError, ImportError): return False - - -@checkvers("bzr", "Canonical's Bazaar client >= %s", (1.14,)) -def has_bzr_range(v): - major, minor = v.split('rc')[0].split('.')[0:2] - try: - import bzrlib - - return bzrlib.__doc__ is not None and bzrlib.version_info[:2] >= ( - int(major), - int(minor), - ) - except ImportError: - return False + # Test the executable + return matchoutput('brz --version 2>&1', br'Breezy \(brz\) ') @check("chg", "running with chg")