Skip to content

always update to the correct head of Mercurial repositories #4600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tools/src/main/python/opengrok_tools/scm/mercurial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <k.tulinger@seznam.cz>
#

Expand Down Expand Up @@ -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()
Expand Down
Loading