diff --git a/tools/src/main/python/opengrok_tools/scm/cvs.py b/tools/src/main/python/opengrok_tools/scm/cvs.py index de382981090..9631a4f4fb9 100644 --- a/tools/src/main/python/opengrok_tools/scm/cvs.py +++ b/tools/src/main/python/opengrok_tools/scm/cvs.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 # @@ -44,7 +44,7 @@ def reposync(self): cmd.execute() self.logger.info("output of {}:".format(cmd)) self.logger.info(cmd.getoutputstr()) - if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED: + if cmd.getstate() != Command.FINISHED or cmd.getretcode() != 0: self.logger.error("failed to perform update: command {}" "in directory {} exited with {}". format(hg_command, self.path, cmd.getretcode())) diff --git a/tools/src/main/python/opengrok_tools/scm/git.py b/tools/src/main/python/opengrok_tools/scm/git.py index 709855cc600..5e2a5b4477a 100644 --- a/tools/src/main/python/opengrok_tools/scm/git.py +++ b/tools/src/main/python/opengrok_tools/scm/git.py @@ -18,7 +18,7 @@ # # -# Copyright (c) 2018, 2022, 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 # @@ -44,7 +44,7 @@ def _configure_git_pull(self): cmd = self.get_command(git_command, work_dir=self.path, env_vars=self.env, logger=self.logger) cmd.execute() - if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED: + if cmd.getstate() != Command.FINISHED or cmd.getretcode() != 0: cmd.log_error("failed to configure git pull.ff") def reposync(self): diff --git a/tools/src/main/python/opengrok_tools/scm/mercurial.py b/tools/src/main/python/opengrok_tools/scm/mercurial.py index 80a7b037bff..640d789dab6 100644 --- a/tools/src/main/python/opengrok_tools/scm/mercurial.py +++ b/tools/src/main/python/opengrok_tools/scm/mercurial.py @@ -45,7 +45,7 @@ def get_branch(self): cmd.execute() self.logger.info("output of {}:".format(cmd)) self.logger.info(cmd.getoutputstr()) - if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED: + if cmd.getstate() != Command.FINISHED or cmd.getretcode() != 0: cmd.log_error("failed to get branch") return None else: @@ -73,7 +73,7 @@ def reposync(self): cmd.execute() self.logger.info("output of {}:".format(cmd)) self.logger.info(cmd.getoutputstr()) - if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED: + if cmd.getstate() != Command.FINISHED or cmd.getretcode() != 0: cmd.log_error("failed to perform pull") return 1 @@ -98,7 +98,7 @@ def reposync(self): cmd.execute() self.logger.info("output of {}:".format(cmd)) self.logger.info(cmd.getoutputstr()) - if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED: + if cmd.getstate() != Command.FINISHED or cmd.getretcode() != 0: cmd.log_error("failed to perform pull and update") return 1 @@ -157,7 +157,7 @@ def strip_outgoing(self): # If the 'hg out' command fails for some reason, it will return 255. # Hence, check for positive value as bail out indication. # - if status > 0: + if cmd.getstate() != Command.FINISHED or status > 0: return False revisions = list(filter(None, cmd.getoutputstr().split("\n"))) diff --git a/tools/src/main/python/opengrok_tools/scm/repository.py b/tools/src/main/python/opengrok_tools/scm/repository.py index cb7578d042e..25c2e0b1fb4 100644 --- a/tools/src/main/python/opengrok_tools/scm/repository.py +++ b/tools/src/main/python/opengrok_tools/scm/repository.py @@ -18,7 +18,7 @@ # # -# Copyright (c) 2018, 2022, 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 # @@ -161,7 +161,7 @@ def _run_command(self, command): cmd = self.get_command(command, work_dir=self.path, env_vars=self.env, logger=self.logger) cmd.execute() - if cmd.getretcode() != 0 or cmd.getstate() != Command.FINISHED: + if cmd.getstate() != Command.FINISHED or cmd.getretcode() != 0: cmd.log_error("failed to perform command {}".format(command)) status = cmd.getretcode() if status == 0 and cmd.getstate() != Command.FINISHED: