From 6ef3318a5ab57eccac2edeca0779c201526f8d09 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Sat, 23 Nov 2024 15:28:14 +0000 Subject: [PATCH] Update repos.py | Support cm pull repo with branch and SHA --- cm/cmind/repos.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cm/cmind/repos.py b/cm/cmind/repos.py index cfe6baf3e..e2d254a00 100644 --- a/cm/cmind/repos.py +++ b/cm/cmind/repos.py @@ -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: