##// END OF EJS Templates
git: allow force checkouts for git repository
marcink -
r2501:676bf7b7 default
parent child Browse files
Show More
@@ -701,7 +701,7 b' class GitRepository(BaseRepository):'
701 stdout, _ = self.run_git_command(['rev-parse', '--abbrev-ref', 'HEAD'])
701 stdout, _ = self.run_git_command(['rev-parse', '--abbrev-ref', 'HEAD'])
702 return stdout.strip()
702 return stdout.strip()
703
703
704 def _checkout(self, branch_name, create=False):
704 def _checkout(self, branch_name, create=False, force=False):
705 """
705 """
706 Checkout a branch in the working directory.
706 Checkout a branch in the working directory.
707
707
@@ -715,6 +715,8 b' class GitRepository(BaseRepository):'
715 raise RepositoryError('Cannot checkout branches in a bare git repo')
715 raise RepositoryError('Cannot checkout branches in a bare git repo')
716
716
717 cmd = ['checkout']
717 cmd = ['checkout']
718 if force:
719 cmd.append('-f')
718 if create:
720 if create:
719 cmd.append('-b')
721 cmd.append('-b')
720 cmd.append(branch_name)
722 cmd.append(branch_name)
General Comments 0
You need to be logged in to leave comments. Login now