From 1a8577d7338d107f38bd850324f417bf637ef6fc Mon Sep 17 00:00:00 2001 From: Vladimir Kotal Date: Tue, 23 Jul 2024 14:17:25 +0200 Subject: [PATCH 1/2] always update to the tip --- tools/src/main/python/opengrok_tools/scm/mercurial.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/src/main/python/opengrok_tools/scm/mercurial.py b/tools/src/main/python/opengrok_tools/scm/mercurial.py index 61e2d3a4418..af9f6b88fd9 100644 --- a/tools/src/main/python/opengrok_tools/scm/mercurial.py +++ b/tools/src/main/python/opengrok_tools/scm/mercurial.py @@ -18,7 +18,7 @@ # # -# Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. # Portions Copyright (c) 2020, Krystof Tulinger # @@ -82,6 +82,8 @@ def reposync(self): # some servers do not support it. if branch == "default": hg_command.append("--check") + hg_command.append("-r") + hg_command.append("tip") cmd = self.get_command(hg_command, work_dir=self.path, env_vars=self.env, logger=self.logger) cmd.execute() From 1ac6f75ee69c1035dfb6241411bce6310c9b51e8 Mon Sep 17 00:00:00 2001 From: Vladimir Kotal Date: Tue, 23 Jul 2024 16:57:05 +0200 Subject: [PATCH 2/2] use the head on given branch with maximum index --- tools/src/main/python/opengrok_tools/scm/mercurial.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/src/main/python/opengrok_tools/scm/mercurial.py b/tools/src/main/python/opengrok_tools/scm/mercurial.py index af9f6b88fd9..a9c2edcee18 100644 --- a/tools/src/main/python/opengrok_tools/scm/mercurial.py +++ b/tools/src/main/python/opengrok_tools/scm/mercurial.py @@ -78,12 +78,20 @@ def reposync(self): return 1 hg_command = [self.command, "update"] + # # Avoid remote branch lookup for default branches since # some servers do not support it. + # if branch == "default": hg_command.append("--check") + + # + # In a multi-head situation, select the head with the + # biggest index as this is likely the correct one. + # hg_command.append("-r") - hg_command.append("tip") + hg_command.append("'max(head() and branch(\".\"))'") + cmd = self.get_command(hg_command, work_dir=self.path, env_vars=self.env, logger=self.logger) cmd.execute()