@@ -409,7 +409,7 @@ def discard():
409
409
popen ([hg_cmd , 'update' , '-C' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
410
410
411
411
def checkout (rev , clean = False , clean_files = False ):
412
- info ("Checkout \" %s\" in %s to %s " % (rev , os .path .basename (os .getcwd ()), rev ))
412
+ info ("Checkout \" %s\" in %s" % (rev if rev else "latest" , os .path .basename (os .getcwd ())))
413
413
if clean_files :
414
414
files = pquery ([hg_cmd , 'status' , '--no-status' , '-ui' ]).splitlines ()
415
415
for f in files :
@@ -598,7 +598,7 @@ def merge(dest):
598
598
def checkout (rev , clean = False ):
599
599
if not rev :
600
600
return
601
- info ("Checkout \" %s\" in %s to %s " % (rev , os .path .basename (os .getcwd ()), rev ))
601
+ info ("Checkout \" %s\" in %s" % (rev , os .path .basename (os .getcwd ())))
602
602
popen ([git_cmd , 'checkout' , rev ] + (['-f' ] if clean else []) + ([] if very_verbose else ['-q' ]))
603
603
if Git .isdetached (): # try to find associated refs to avoid detached state
604
604
refs = Git .getrefs (rev )
@@ -1286,6 +1286,22 @@ def add_tools(self, path):
1286
1286
rmtree_readonly (tools_dir )
1287
1287
error ("An error occurred while cloning the mbed SDK tools from \" %s\" " % mbed_sdk_tools_url )
1288
1288
1289
+ def update_tools (self , path ):
1290
+ if not os .path .exists (path ):
1291
+ os .mkdir (path )
1292
+ with cd (path ):
1293
+ tools_dir = 'tools'
1294
+ if not os .path .exists (tools_dir ):
1295
+ return self .add_tools (path )
1296
+ else :
1297
+ with cd (tools_dir ):
1298
+ try :
1299
+ action ("Updating the mbed 2.0 SDK tools..." )
1300
+ repo = Repo .fromrepo ()
1301
+ repo .update ()
1302
+ except Exception :
1303
+ error ("An error occurred while update the mbed SDK tools from \" %s\" " % mbed_sdk_tools_url )
1304
+
1289
1305
def get_tools (self ):
1290
1306
mbed_tools_path = self .get_tools_dir ()
1291
1307
if not mbed_tools_path :
@@ -1707,8 +1723,10 @@ def deploy(ignore=False, depth=None, protocol=None, top=True):
1707
1723
repo .ignore (relpath (repo .path , lib .path ))
1708
1724
1709
1725
if top :
1710
- Program (repo .path ).post_action ()
1711
-
1726
+ program = Program (repo .path )
1727
+ program .post_action ()
1728
+ if program .is_classic :
1729
+ program .update_tools ('.temp' )
1712
1730
1713
1731
# Publish command
1714
1732
@subcommand ('publish' ,
@@ -1869,6 +1887,8 @@ def update(rev=None, clean=False, clean_files=False, clean_deps=False, ignore=Fa
1869
1887
program = Program (repo .path )
1870
1888
program .set_root ()
1871
1889
program .post_action ()
1890
+ if program .is_classic :
1891
+ program .update_tools ('.temp' )
1872
1892
1873
1893
1874
1894
# Synch command
0 commit comments