Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
47376:a1e91a87a7c8 | 47377:26127236b229 |
---|---|
166 @check("baz", "GNU Arch baz client") | 166 @check("baz", "GNU Arch baz client") |
167 def has_baz(): | 167 def has_baz(): |
168 return matchoutput('baz --version 2>&1', br'baz Bazaar version') | 168 return matchoutput('baz --version 2>&1', br'baz Bazaar version') |
169 | 169 |
170 | 170 |
171 @check("bzr", "Canonical's Bazaar client") | 171 @check("bzr", "Breezy library and executable version >= 3.1") |
172 def has_bzr(): | 172 def has_bzr(): |
173 if not is_not_python2: | 173 if not is_not_python2: |
174 return False | 174 return False |
175 try: | 175 try: |
176 import bzrlib | 176 # Test the Breezy python lib |
177 import bzrlib.bzrdir | 177 import breezy |
178 import bzrlib.errors | 178 import breezy.bzr.bzrdir |
179 import bzrlib.revision | 179 import breezy.errors |
180 import bzrlib.revisionspec | 180 import breezy.revision |
181 | 181 import breezy.revisionspec |
182 bzrlib.revisionspec.RevisionSpec | 182 |
183 return bzrlib.__doc__ is not None | 183 breezy.revisionspec.RevisionSpec |
184 if breezy.__doc__ is None or breezy.version_info[:2] < (3, 1): | |
185 return False | |
184 except (AttributeError, ImportError): | 186 except (AttributeError, ImportError): |
185 return False | 187 return False |
186 | 188 # Test the executable |
187 | 189 return matchoutput('brz --version 2>&1', br'Breezy \(brz\) ') |
188 @checkvers("bzr", "Canonical's Bazaar client >= %s", (1.14,)) | |
189 def has_bzr_range(v): | |
190 major, minor = v.split('rc')[0].split('.')[0:2] | |
191 try: | |
192 import bzrlib | |
193 | |
194 return bzrlib.__doc__ is not None and bzrlib.version_info[:2] >= ( | |
195 int(major), | |
196 int(minor), | |
197 ) | |
198 except ImportError: | |
199 return False | |
200 | 190 |
201 | 191 |
202 @check("chg", "running with chg") | 192 @check("chg", "running with chg") |
203 def has_chg(): | 193 def has_chg(): |
204 return 'CHGHG' in os.environ | 194 return 'CHGHG' in os.environ |