From 00316131ecdb813f01af7e438bea4b6609d5c37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 3 Mar 2022 08:25:01 +0100 Subject: [PATCH] vcs: Improve mercurial parameters handling Make sure that all user provided input is handled as expected. --- weblate/vcs/mercurial.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/weblate/vcs/mercurial.py b/weblate/vcs/mercurial.py index 0399c1b0bae2..1131c1abd1e5 100644 --- a/weblate/vcs/mercurial.py +++ b/weblate/vcs/mercurial.py @@ -70,7 +70,7 @@ def check_config(self): @classmethod def _clone(cls, source: str, target: str, branch: str): """Clone repository.""" - cls._popen(["clone", "--branch", branch, source, target]) + cls._popen(["clone", f"--branch={branch}", "--", source, target]) def get_config(self, path): """Read entry from configuration.""" @@ -323,7 +323,7 @@ def on_branch(self, branch): def configure_branch(self, branch): """Configure repository branch.""" if not self.on_branch(branch): - self.execute(["update", branch]) + self.execute(["update", "--", branch]) self.branch = branch def describe(self): @@ -343,7 +343,7 @@ def describe(self): def push(self, branch): """Push given branch to remote repository.""" try: - self.execute(["push", "-b", self.branch]) + self.execute(["push", f"--branch={self.branch}"]) except RepositoryException as error: if error.retcode == 1: # No changes found @@ -363,7 +363,7 @@ def cleanup(self): def update_remote(self): """Update remote repository.""" - self.execute(["pull", "--branch", self.branch]) + self.execute(["pull", f"--branch={self.branch}"]) self.clean_revision_cache() def parse_changed_files(self, lines: List[str]) -> Iterator[str]: