3535
3636
3737# Application version
38- ver = '0.7.14 '
38+ ver = '0.7.17 '
3939
4040# Default paths to Mercurial and Git
4141hg_cmd = 'hg'
@@ -387,8 +387,8 @@ def remove(dest):
387387 def commit ():
388388 popen ([hg_cmd , 'commit' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
389389
390- def publish (all = None ):
391- popen ([hg_cmd , 'push' ] + (['--new-branch' ] if all else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
390+ def publish (all_refs = None ):
391+ popen ([hg_cmd , 'push' ] + (['--new-branch' ] if all_refs else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
392392
393393 def fetch ():
394394 log ("Fetching revisions from remote repository to \" %s\" " % os .path .basename (os .getcwd ()))
@@ -556,8 +556,8 @@ def remove(dest):
556556 def commit ():
557557 popen ([git_cmd , 'commit' , '-a' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
558558
559- def publish (all = None ):
560- if all :
559+ def publish (all_refs = None ):
560+ if all_refs :
561561 popen ([git_cmd , 'push' , '--all' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
562562 else :
563563 remote = Git .getremote ()
@@ -637,7 +637,7 @@ def outgoing():
637637 # Get current branch
638638 branch = Git .getbranch ()
639639 if not branch :
640- # Default to "master" in detached mode
640+ # Default to "master" in detached mode
641641 branch = "master"
642642 try :
643643 # Check if remote branch exists
@@ -1630,15 +1630,15 @@ def deploy(ignore=False, depth=None, protocol=None, top=True):
16301630
16311631# Publish command
16321632@subcommand ('publish' ,
1633- dict (name = ['-A' , '--all' ], action = 'store_true' , help = 'Publish all branches, including new ones. Default: push only the current branch.' ),
1633+ dict (name = ['-A' , '--all' ], dest = 'all_refs' , action = 'store_true' , help = 'Publish all branches, including new ones. Default: push only the current branch.' ),
16341634 help = 'Publish program or library' ,
16351635 description = (
16361636 "Publishes this %s and all dependencies to their associated remote\n repository URLs.\n "
16371637 "This command performs various consistency checks for local uncommitted changes\n "
16381638 "and unpublished revisions and encourages to commit/push them.\n "
16391639 "Online guide about collaboration is available at:\n "
16401640 "www.mbed.com/collab_guide" % cwd_type ))
1641- def publish (all = None , top = True ):
1641+ def publish (all_refs = None , top = True ):
16421642 if top :
16431643 action ("Checking for local modifications..." )
16441644
@@ -1652,7 +1652,7 @@ def publish(all=None, top=True):
16521652 if lib .check_repo ():
16531653 with cd (lib .path ):
16541654 progress ()
1655- publish (False , all )
1655+ publish (False , all_refs )
16561656
16571657 sync (recursive = False )
16581658
@@ -1665,7 +1665,7 @@ def publish(all=None, top=True):
16651665 outgoing = repo .outgoing ()
16661666 if outgoing > 0 :
16671667 action ("Pushing local repository \" %s\" to remote \" %s\" " % (repo .name , repo .url ))
1668- repo .publish (all )
1668+ repo .publish (all_refs )
16691669 except ProcessException as e :
16701670 if e [0 ] != 1 :
16711671 raise e
@@ -1840,14 +1840,14 @@ def sync(recursive=True, keep_refs=False, top=True):
18401840
18411841# List command
18421842@subcommand ('ls' ,
1843- dict (name = ['-a' , '--all' ], action = 'store_true' , help = 'List repository URL and revision pairs' ),
1843+ dict (name = ['-a' , '--all' ], dest = 'detailed' , action = 'store_true' , help = 'List repository URL and revision pairs' ),
18441844 dict (name = ['-I' , '--ignore' ], action = 'store_true' , help = 'Ignore errors related to missing libraries.' ),
18451845 help = 'View dependency tree' ,
18461846 description = (
18471847 "View the dependency tree in this %s." % cwd_type ))
1848- def list_ (all = False , prefix = '' , p_path = None , ignore = False ):
1848+ def list_ (detailed = False , prefix = '' , p_path = None , ignore = False ):
18491849 repo = Repo .fromrepo ()
1850- print prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), '(%s)' % ((repo .url + ('#' + str (repo .rev )[:12 ] if repo .rev else '' ) if all else str (repo .rev )[:12 ]) or 'no revision' )
1850+ print prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), '(%s)' % ((repo .url + ('#' + str (repo .rev )[:12 ] if repo .rev else '' ) if detailed else str (repo .rev )[:12 ]) or 'no revision' )
18511851
18521852 for i , lib in enumerate (sorted (repo .libs , key = lambda l : l .path )):
18531853 if prefix :
@@ -1858,7 +1858,7 @@ def list_(all=False, prefix='', p_path=None, ignore=False):
18581858
18591859 if lib .check_repo (ignore ):
18601860 with cd (lib .path ):
1861- list_ (all , nprefix , repo .path , ignore = ignore )
1861+ list_ (detailed , nprefix , repo .path , ignore = ignore )
18621862
18631863
18641864# Command status for cross-SCM status of repositories
@@ -1893,7 +1893,7 @@ def status_(ignore=False):
18931893 dict (name = ['-S' , '--supported' ], dest = 'supported' , action = 'store_true' , help = 'Shows supported matrix of targets and toolchains' ),
18941894 help = 'Compile code using the mbed build tools' ,
18951895 description = ("Compile this program using the mbed build tools." ))
1896- def compile (toolchain = None , mcu = None , source = False , build = False , compile_library = False , compile_config = False , config_prefix = None , compile_tests = False , clean = False , supported = False ):
1896+ def compile_ (toolchain = None , mcu = None , source = False , build = False , compile_library = False , compile_config = False , config_prefix = None , compile_tests = False , clean = False , supported = False ):
18971897 # Pipe --tests to mbed tests command
18981898 if compile_tests :
18991899 return test_ (toolchain = toolchain , mcu = mcu , source = source , build = build , clean = clean , compile_only = True )
@@ -1985,15 +1985,12 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
19851985 args = remainder
19861986 # Find the root of the program
19871987 program = Program (os .getcwd (), True )
1988- # Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
1989- orig_path = os .getcwd ()
19901988
19911989 target = program .get_mcu (mcu )
19921990 tchain = program .get_toolchain (toolchain )
19931991 macros = program .get_macros ()
19941992 tools_dir = program .get_tools ()
19951993 build_and_run_tests = not compile_list and not run_list and not compile_only and not run_only
1996- relative_orig_path = os .path .relpath (orig_path , program .path )
19971994
19981995 # Prepare environment variables
19991996 env = program .get_env ()
@@ -2006,17 +2003,17 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
20062003 # Setup the build path if not specified
20072004 if not build :
20082005 build = os .path .join (program .path , '.build/tests' , target , tchain )
2009-
2006+
20102007 # Create the path to the test spec file
20112008 test_spec = os .path .join (build , 'test_spec.json' )
2012-
2009+
20132010 if compile_list :
20142011 popen (['python' , '-u' , os .path .join (tools_dir , 'test.py' ), '--list' ]
20152012 + (['-n' , tests_by_name ] if tests_by_name else [])
20162013 + (['-v' ] if verbose else [])
20172014 + args ,
20182015 env = env )
2019-
2016+
20202017 if compile_only or build_and_run_tests :
20212018 popen (['python' , '-u' , os .path .join (tools_dir , 'test.py' )]
20222019 + list (chain .from_iterable (izip (repeat ('-D' ), macros )))
@@ -2029,14 +2026,14 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
20292026 + (['-v' ] if verbose else [])
20302027 + args ,
20312028 env = env )
2032-
2029+
20332030 if run_list :
20342031 popen (['mbedgt' , '--test-spec' , test_spec , '--list' ]
20352032 + (['-n' , tests_by_name ] if tests_by_name else [])
20362033 + (['-V' ] if verbose else [])
20372034 + args ,
20382035 env = env )
2039-
2036+
20402037 if run_only or build_and_run_tests :
20412038 popen (['mbedgt' , '--test-spec' , test_spec ]
20422039 + (['-n' , tests_by_name ] if tests_by_name else [])
0 commit comments