Skip to content

Commit

Permalink
Update repos.py | Support cm pull repo with branch and SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsuresh authored Nov 23, 2024
1 parent ec9b1b9 commit 6ef3318
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cm/cmind/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,14 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des
# When checkout only, we do not need -b for branch
extra_flag = ' ' if checkout_only else ' -b '

if branch != '':
if branch != '' and checkout != '':
# if both branch and checkout are specified, we do checkout and set remote branch
cmd = "git checkout -b " + branch + " " + checkout + " && git branch --set-upstream-to=origin/"+ branch + " " + branch

elif branch != '':
cmd = 'git fetch && git checkout ' + branch

if checkout!='':
elif checkout!='':
cmd += ' ' + checkout

if console:
Expand Down

0 comments on commit 6ef3318

Please sign in to comment.