RFR: 1452: Can never notify on first commit [v6]

Guoxiong Li gli at openjdk.org
Fri Oct 7 16:47:52 UTC 2022

On Fri, 7 Oct 2022 13:05:02 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> vcs/src/main/java/org/openjdk/skara/vcs/hg/HgRepository.java line 1501:
>>> 1499:     public int commitCount() throws IOException {
>>> 1500:         try (var p = capture("hg", "id", "--num", "--rev", "tip")) {
>>> 1501:             return Integer.parseInt(await(p).stdout().get(0)) + 1;
>> A question: Is the plus one `+ 1` intentional? I don't know HG well.
> Yes, in Mercurial every commit is assigned an ever increasing numerical ID. The "tip" is defined as the commit with the highest ID number. The first commit has ID 0, so to get the total count we add one to the ID number of "tip". (There are situations where this will not be strictly correct, but counting like this is good enough for this purpose)

Thanks for the nice explanation.


PR: https://git.openjdk.org/skara/pull/1385

More information about the skara-dev mailing list