RFR: 7902611: Add support for Mercurial 5.3
erik.helin at oracle.com
Fri Feb 14 14:29:20 UTC 2020
please review this patch that adds support to jcheck for Mercurial 5.3.
There are two changes to Mercurial's API that affects jcheck:
scmutil: convert status data object from a tuple to an attrs (API)
changectx: add a "maybe filtered" filtered attribute
The first commit changed the class `scmutil.status` to inherit from
`object` instead of `tuple`. The fix for this is easy since
`scmutil.status implements `__iter__` - we can just feed the result of
`repo.status()` to the `tuple` constructor and we have a `tuple` again.
This is backwards compatible with the old API since
`tuple(tuple([1,2,3]))` result in `tuple(1,2,3)` - i.e. applying `tuple`
on a tuple is no-op.
The second commit added an argument with a default value to the
constructor for `context.changectx`. jcheck already has a workaround for
this constructor since it was changed back in 3d35304bd09b , the
jcheck workarouud was introduced in jcheck 4ac08a4210ec . The problem
is that the fix in 4ac08a4210ec was a bit too strict - it expects the
`context.changectx` constructor to take _exactly_ 4 arguments. When the
fifth argument with a defaul value was added, then this workaround
fails. I changed this workaround to first try to use the oldest version
of the `context.changectx` constructor, and if that fails with a
`TypeError`, use the more recent variant of the constructor.
- `make test` passes with hg 4.9 and 5.3
More information about the code-tools-dev