repos: Rename boolean branch variable/argument to is_branch

Makes it clearer that this is a boolean, not the branch name.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2023-05-28 12:44:05 +02:00
parent e9032bc278
commit a317a0e957

View File

@ -308,12 +308,12 @@ class RepoImpl(Repo):
cwd=self.path, fail=False) cwd=self.path, fail=False)
if output: if output:
desired_ref = output.strip() desired_ref = output.strip()
branch = True is_branch = True
else: else:
desired_ref = self.refspec desired_ref = self.refspec
branch = False is_branch = False
run_cmd(self.checkout_cmd(desired_ref, branch), cwd=self.path) run_cmd(self.checkout_cmd(desired_ref, is_branch), cwd=self.path)
async def apply_patches_async(self): async def apply_patches_async(self):
""" """
@ -440,9 +440,9 @@ class GitRepo(RepoImpl):
'origin/{refspec}'. 'origin/{refspec}'.
format(refspec=self.remove_ref_prefix(self.refspec))] format(refspec=self.remove_ref_prefix(self.refspec))]
def checkout_cmd(self, desired_ref, branch): def checkout_cmd(self, desired_ref, is_branch):
cmd = ['git', 'checkout', '-q', self.remove_ref_prefix(desired_ref)] cmd = ['git', 'checkout', '-q', self.remove_ref_prefix(desired_ref)]
if branch: if is_branch:
cmd.extend(['-B', self.remove_ref_prefix(self.refspec)]) cmd.extend(['-B', self.remove_ref_prefix(self.refspec)])
if get_context().force_checkout: if get_context().force_checkout:
cmd.append('--force') cmd.append('--force')
@ -490,7 +490,7 @@ class MercurialRepo(RepoImpl):
# We never need to care about creating tracking branches in mercurial # We never need to care about creating tracking branches in mercurial
return ['false'] return ['false']
def checkout_cmd(self, desired_ref, branch): def checkout_cmd(self, desired_ref, is_branch):
cmd = ['hg', 'checkout', desired_ref] cmd = ['hg', 'checkout', desired_ref]
if get_context().force_checkout: if get_context().force_checkout:
cmd.append('--clean') cmd.append('--clean')