RFR: Make ext.py compatible with hg5 api
Jorn Vernee via github.com
duke at openjdk.java.net
Thu Aug 22 12:55:41 UTC 2019
On Thu, 22 Aug 2019 12:46:50 GMT, Erik Duveblad via github.com <duke at openjdk.java.net> wrote:
> On Thu, 22 Aug 2019 12:04:42 GMT, Jorn Vernee via github.com <duke at openjdk.java.net> wrote:
>
>> The HG api changes in version 5 to drop the first 2 parameters to `mercurial.match.exact`, which breaks the extension script.
>>
>> This PR detects whether we're running on hg 5, and if so, calls the function without the first 2 arguments instead.
>>
>> ----------------
>>
>> Commits:
>> - 741ee3e3: Make ext.py compatible with hg5 api
>>
>> Pull request:
>> https://git.openjdk.java.net/skara/pull/67
>>
>> Webrev:
>> https://webrevs.openjdk.java.net/skara/67/webrev.00
>>
>> Patch:
>> https://git.openjdk.java.net/skara/pull/67.diff
>>
>> Fetch command:
>> git fetch https://git.openjdk.java.net/skara pull/67/head:pull/67
>
> vcs/src/main/resources/ext.py line 62:
>
>> 61: Wrapper for mercurial.match.exact that ignores some arguments based on the used version
>> 62: """
>> 63: if mercurial.util.versiontuple() < 5:
>
> Two questions here:
> 1. How does this check work? `versiontuple()` returns a tuple, e.g. `(4, 9, 2)`, how can you compare a tuple to an `int`?
> 2. `mercurial.util.versiontuple()` is fairly new (added 2015) whereas `mercurial.util.version()` has been around since 2009. Is it possible to implement the check using `mercurial.util.version()` instead? Like `mercurial.util.version().startswith("5")`?
>
> PR: https://git.openjdk.java.net/skara/pull/67
1. My bad, supposed to compare the first element, which is not quite what happens when comparing with an `int` (though it works in the specific case I tested).
2. Yeah, I was afraid of that. Will switch to using `version()`. (could also go with the `try ... except` approach if you prefer)
PR: https://git.openjdk.java.net/skara/pull/67
More information about the skara-dev
mailing list