RFR: 7902611: Add support for Mercurial 5.3

Erik Helin erik.helin at oracle.com
Fri Feb 14 14:29:20 UTC 2020

Hi all,

please review this patch that adds support to jcheck for Mercurial 5.3. 
There are two changes to Mercurial's API that affects jcheck:

- c5548b0b6847
   scmutil: convert status data object from a tuple to an attrs (API)

   Review: https://phab.mercurial-scm.org/D7406
   Commit: https://www.mercurial-scm.org/repo/hg/rev/c5548b0b6847

- 1e87851dba63
   changectx: add a "maybe filtered" filtered attribute

   Review: https://phab.mercurial-scm.org/D7483
   Commit: https://www.mercurial-scm.org/repo/hg/rev/1e87851dba63

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 [0], the 
jcheck workarouud was introduced in jcheck 4ac08a4210ec [1]. 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.

- https://bugs.openjdk.java.net/browse/CODETOOLS-7902611

- https://cr.openjdk.java.net/~ehelin/7902611/00/

- `make test` passes with hg 4.9 and 5.3


[0]: https://www.mercurial-scm.org/repo/hg/rev/3d35304bd09b
[1]: https://hg.openjdk.java.net/code-tools/jcheck/rev/4ac08a4210ec

More information about the code-tools-dev mailing list