Skip to content

Commit c576ffd

Browse files
committed
Updated build.py (and libs) to have extended --status functionality. Note; this needs to be pushed upstream to the codal/ library
1 parent 2c887df commit c576ffd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

build.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
parser.add_option('-M', '--major', dest='update_major', action="store_true", help='With -l, update major version', default=False)
4141
parser.add_option('-V', '--version', dest='version', metavar="VERSION", help='With -l, set the version; use "-V v0.0.1" to bootstrap', default=False)
4242
parser.add_option('-v', '--verbose', dest='verbose', action="store_true", help='Increases verbosity)', default=False)
43-
parser.add_option('-u', '--update', dest='update', action="store_true", help='git pull target and libraries', default=False)
43+
parser.add_option('-u', '--update', dest='update', action="store_true", help='git pull target and libraries, use with "-d/--dev" to update all libraries to their latest master' , default=False)
4444
parser.add_option('-s', '--status', dest='status', action="store_true", help='git status target and libraries', default=False)
4545
parser.add_option('-r', '--revision', dest='revision', action="store", help='Checkout a specific revision of the target', default=False)
4646
parser.add_option('-d', '--dev', dest='dev', action="store_true", help='enable developer mode (does not use target-locked.json)', default=False)
@@ -58,7 +58,7 @@
5858
exit(0)
5959

6060
if options.update:
61-
update()
61+
update(sync_dev = options.dev)
6262
exit(0)
6363

6464
if options.status:

utils/python/codal_utils.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,16 @@ def read_config():
5959
target = read_json("libraries/" + targetdir + "/target.json")
6060
return (codal, targetdir, target)
6161

62-
def update(allow_detached=False):
62+
def update(allow_detached=False, sync_dev=False):
6363
(codal, targetdir, target) = read_config()
6464
dirname = os.getcwd()
6565
for ln in target['libraries']:
6666
os.chdir(dirname + "/libraries/" + ln['name'])
67-
system("git checkout " + ln['branch'])
67+
if sync_dev:
68+
default_branch = list(filter( lambda v: v.strip().startswith('HEAD'), str(subprocess.check_output( ["git", "remote", "show", "origin"] ), "utf8").splitlines()))[0].split(":")[1].strip()
69+
system("git checkout " + default_branch)
70+
else:
71+
system("git checkout " + ln['branch'])
6872
system("git pull")
6973
os.chdir(dirname + "/libraries/" + targetdir)
7074
if ("HEAD detached" in os.popen('git branch').read().strip() and

0 commit comments

Comments
 (0)