diff --git a/tools/src/main/python/opengrok_tools/scm/mercurial.py b/tools/src/main/python/opengrok_tools/scm/mercurial.py index 61e2d3a4418..a9c2edcee18 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 # @@ -78,10 +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("'max(head() and branch(\".\"))'") + cmd = self.get_command(hg_command, work_dir=self.path, env_vars=self.env, logger=self.logger) cmd.execute()