@@ -365,50 +365,50 @@ def isurl(url):
365
365
return False
366
366
367
367
def init (path = None ):
368
- popen ([hg_cmd , 'init' ] + ([path ] if path else []) + (['-v' ] if verbose else ['-q' ]))
368
+ popen ([hg_cmd , 'init' ] + ([path ] if path else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
369
369
370
370
def clone (url , name = None , depth = None , protocol = None ):
371
- popen ([hg_cmd , 'clone' , formaturl (url , protocol ), name ] + (['-v' ] if verbose else ['-q' ]))
371
+ popen ([hg_cmd , 'clone' , formaturl (url , protocol ), name ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
372
372
373
373
def add (dest ):
374
374
log ("Adding reference \" %s\" " % dest )
375
375
try :
376
- popen ([hg_cmd , 'add' , dest ] + (['-v' ] if verbose else ['-q' ]))
376
+ popen ([hg_cmd , 'add' , dest ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
377
377
except ProcessException :
378
378
pass
379
379
380
380
def remove (dest ):
381
381
log ("Removing reference \" %s\" " % dest )
382
382
try :
383
- popen ([hg_cmd , 'rm' , '-f' , dest ] + (['-v' ] if verbose else ['-q' ]))
383
+ popen ([hg_cmd , 'rm' , '-f' , dest ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
384
384
except ProcessException :
385
385
pass
386
386
387
387
def commit ():
388
- popen ([hg_cmd , 'commit' ] + (['-v' ] if verbose else ['-q' ]))
388
+ popen ([hg_cmd , 'commit' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
389
389
390
390
def publish (all = None ):
391
- popen ([hg_cmd , 'push' ] + (['--new-branch' ] if all else []) + (['-v' ] if verbose else ['-q' ]))
391
+ popen ([hg_cmd , 'push' ] + (['--new-branch' ] if all else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
392
392
393
393
def fetch ():
394
394
log ("Fetching revisions from remote repository to \" %s\" " % os .path .basename (os .getcwd ()))
395
- popen ([hg_cmd , 'pull' ] + (['-v' ] if verbose else ['-q' ]))
395
+ popen ([hg_cmd , 'pull' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
396
396
397
397
def discard ():
398
398
log ("Discarding local changes in \" %s\" " % os .path .basename (os .getcwd ()))
399
- popen ([hg_cmd , 'update' , '-C' ] + (['-v' ] if verbose else ['-q' ]))
399
+ popen ([hg_cmd , 'update' , '-C' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
400
400
401
401
def checkout (rev , clean = False ):
402
402
log ("Checkout \" %s\" in %s to %s" % (rev , os .path .basename (os .getcwd ()), rev ))
403
- popen ([hg_cmd , 'update' ] + (['-C' ] if clean else []) + (['-r' , rev ] if rev else []) + (['-v' ] if verbose else ['-q' ]))
403
+ popen ([hg_cmd , 'update' ] + (['-C' ] if clean else []) + (['-r' , rev ] if rev else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
404
404
405
405
def update (rev = None , clean = False , is_local = False ):
406
406
if not is_local :
407
407
Hg .fetch ()
408
408
Hg .checkout (rev , clean )
409
409
410
410
def status ():
411
- return pquery ([hg_cmd , 'status' ] + (['-v' ] if verbose else ['-q' ]))
411
+ return pquery ([hg_cmd , 'status' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
412
412
413
413
def dirty ():
414
414
return pquery ([hg_cmd , 'status' , '-q' ])
@@ -530,36 +530,36 @@ def isurl(url):
530
530
return False
531
531
532
532
def init (path = None ):
533
- popen ([git_cmd , 'init' ] + ([path ] if path else []) + ([] if verbose else ['-q' ]))
533
+ popen ([git_cmd , 'init' ] + ([path ] if path else []) + ([] if very_verbose else ['-q' ]))
534
534
535
535
def clone (url , name = None , depth = None , protocol = None ):
536
- popen ([git_cmd , 'clone' , formaturl (url , protocol ), name ] + (['--depth' , depth ] if depth else []) + (['-v' ] if verbose else ['-q' ]))
536
+ popen ([git_cmd , 'clone' , formaturl (url , protocol ), name ] + (['--depth' , depth ] if depth else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
537
537
538
538
def add (dest ):
539
539
log ("Adding reference " + dest )
540
540
try :
541
- popen ([git_cmd , 'add' , dest ] + (['-v' ] if verbose else []))
541
+ popen ([git_cmd , 'add' , dest ] + (['-v' ] if very_verbose else []))
542
542
except ProcessException :
543
543
pass
544
544
545
545
def remove (dest ):
546
546
log ("Removing reference " + dest )
547
547
try :
548
- popen ([git_cmd , 'rm' , '-f' , dest ] + ([] if verbose else ['-q' ]))
548
+ popen ([git_cmd , 'rm' , '-f' , dest ] + ([] if very_verbose else ['-q' ]))
549
549
except ProcessException :
550
550
pass
551
551
552
552
def commit ():
553
- popen ([git_cmd , 'commit' , '-a' ] + (['-v' ] if verbose else ['-q' ]))
553
+ popen ([git_cmd , 'commit' , '-a' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
554
554
555
555
def publish (all = None ):
556
556
if all :
557
- popen ([git_cmd , 'push' , '--all' ] + (['-v' ] if verbose else ['-q' ]))
557
+ popen ([git_cmd , 'push' , '--all' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
558
558
else :
559
559
remote = Git .getremote ()
560
560
branch = Git .getbranch ()
561
561
if remote and branch :
562
- popen ([git_cmd , 'push' , remote , branch ] + (['-v' ] if verbose else ['-q' ]))
562
+ popen ([git_cmd , 'push' , remote , branch ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
563
563
else :
564
564
err = "Unable to publish outgoing changes for \" %s\" in \" %s\" .\n " % (os .path .basename (os .getcwd ()), os .getcwd ())
565
565
if not remote :
@@ -569,29 +569,29 @@ def publish(all=None):
569
569
570
570
def fetch ():
571
571
log ("Fetching revisions from remote repository to \" %s\" " % os .path .basename (os .getcwd ()))
572
- popen ([git_cmd , 'fetch' , '--all' ] + (['-v' ] if verbose else ['-q' ]))
572
+ popen ([git_cmd , 'fetch' , '--all' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
573
573
574
574
def discard ():
575
575
log ("Discarding local changes in \" %s\" " % os .path .basename (os .getcwd ()))
576
- popen ([git_cmd , 'reset' , 'HEAD' ] + ([] if verbose else ['-q' ])) # unmarks files for commit
577
- popen ([git_cmd , 'checkout' , '.' ] + ([] if verbose else ['-q' ])) # undo modified files
578
- popen ([git_cmd , 'clean' , '-fdq' ] + ([] if verbose else ['-q' ])) # cleans up untracked files and folders
576
+ pquery ([git_cmd , 'reset' , 'HEAD' ] + ([] if very_verbose else ['-q' ])) # unmarks files for commit
577
+ pquery ([git_cmd , 'checkout' , '.' ] + ([] if very_verbose else ['-q' ])) # undo modified files
578
+ pquery ([git_cmd , 'clean' , '-fdq' ] + ([] if very_verbose else ['-q' ])) # cleans up untracked files and folders
579
579
580
580
def merge (dest ):
581
581
log ("Merging \" %s\" with \" %s\" " % (os .path .basename (os .getcwd ()), dest ))
582
- popen ([git_cmd , 'merge' , dest ] + (['-v' ] if verbose else ['-q' ]))
582
+ popen ([git_cmd , 'merge' , dest ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ]) ))
583
583
584
584
def checkout (rev , clean = False ):
585
585
if not rev :
586
586
return
587
587
log ("Checkout \" %s\" in %s to %s" % (rev , os .path .basename (os .getcwd ()), rev ))
588
- popen ([git_cmd , 'checkout' , rev ] + (['-f' ] if clean else []) + ([] if verbose else ['-q' ]))
588
+ popen ([git_cmd , 'checkout' , rev ] + (['-f' ] if clean else []) + ([] if very_verbose else ['-q' ]))
589
589
if Git .isdetached (): # try to find associated refs to avoid detached state
590
590
refs = Git .getrefs (rev )
591
591
for ref in refs : # re-associate with a local or remote branch (rev is the same)
592
592
branch = re .sub (r'^(.*?)\/(.*?)$' , r'\2' , ref )
593
593
log ("Revision \" %s\" matches a branch \" %s\" reference. Re-associating with branch" % (rev , branch ))
594
- popen ([git_cmd , 'checkout' , branch ] + ([] if verbose else ['-q' ]))
594
+ popen ([git_cmd , 'checkout' , branch ] + ([] if very_verbose else ['-q' ]))
595
595
break
596
596
597
597
def update (rev = None , clean = False , is_local = False ):
@@ -614,7 +614,7 @@ def update(rev=None, clean=False, is_local=False):
614
614
log (err + "Working set is not on a branch." )
615
615
616
616
def status ():
617
- return pquery ([git_cmd , 'status' , '-s' ] + (['-v' ] if verbose else []))
617
+ return pquery ([git_cmd , 'status' , '-s' ] + (['-v' ] if very_verbose else []))
618
618
619
619
def dirty ():
620
620
return pquery ([git_cmd , 'status' , '-uno' , '--porcelain' ])
@@ -948,7 +948,7 @@ def remove(self, dest, *args, **kwargs):
948
948
pass
949
949
return self .scm .remove (dest , * args , ** kwargs )
950
950
951
- def clone (self , url , path , depth = None , protocol = None , ** kwargs ):
951
+ def clone (self , url , path , rev = None , depth = None , protocol = None , ** kwargs ):
952
952
# Sorted so repositories that match urls are attempted first
953
953
sorted_scms = [(scm .isurl (url ), scm ) for scm in scms .values ()]
954
954
sorted_scms = sorted (sorted_scms , key = lambda (m , _ ): not m )
@@ -959,14 +959,17 @@ def clone(self, url, path, depth=None, protocol=None, **kwargs):
959
959
960
960
# Try to clone with cache ref first
961
961
if cache and not os .path .isdir (path ):
962
- log ("Trying to use cached repository in \" %s\" for \" %s \" " % ( cache , path ) )
962
+ log ("Found matching cached repository in \" %s\" " % cache )
963
963
try :
964
964
if os .path .split (path )[0 ] and not os .path .isdir (os .path .split (path )[0 ]):
965
965
os .makedirs (os .path .split (path )[0 ])
966
+
967
+ log ("Carbon copy from \" %s\" to \" %s\" " % (cache , path ))
966
968
shutil .copytree (cache , path )
967
969
968
970
with cd (path ):
969
- scm .update (None , True )
971
+ log ("Update cached copy from remote repository" )
972
+ scm .update (rev , True )
970
973
main = False
971
974
except (ProcessException , IOError ):
972
975
if os .path .isdir (path ):
@@ -1488,7 +1491,7 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
1488
1491
1489
1492
text = "Importing program" if top else "Adding library"
1490
1493
action ("%s \" %s\" from \" %s/\" %s" % (text , relpath (cwd_root , repo .path ), repo .url , ' at ' + (repo .revtype (repo .rev , True ))))
1491
- if repo .clone (repo .url , repo .path , depth = depth , protocol = protocol ):
1494
+ if repo .clone (repo .url , repo .path , rev = repo . rev , depth = depth , protocol = protocol ):
1492
1495
with cd (repo .path ):
1493
1496
Program (repo .path ).set_root ()
1494
1497
try :
@@ -1873,7 +1876,7 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
1873
1876
1874
1877
if supported :
1875
1878
popen (['python' , '-u' , os .path .join (tools_dir , 'make.py' )]
1876
- + (['-S' ] if supported else []) + (['-v' ] if verbose else [])
1879
+ + (['-S' ] if supported else []) + (['-v' ] if very_verbose else [])
1877
1880
+ args ,
1878
1881
env = env )
1879
1882
return
@@ -1890,7 +1893,7 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
1890
1893
popen (['python' , os .path .join (tools_dir , 'get_config.py' )]
1891
1894
+ ['-t' , tchain , '-m' , target ]
1892
1895
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
1893
- + (['-v' ] if verbose else [])
1896
+ + (['-v' ] if very_verbose else [])
1894
1897
+ (list (chain .from_iterable (izip (repeat ('--prefix' ), config_prefix ))) if config_prefix else []),
1895
1898
env = env )
1896
1899
@@ -1905,7 +1908,7 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
1905
1908
+ (['-c' ] if clean else [])
1906
1909
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
1907
1910
+ ['--build' , build ]
1908
- + (['-v' ] if verbose else [])
1911
+ + (['-v' ] if very_verbose else [])
1909
1912
+ args ,
1910
1913
env = env )
1911
1914
else :
@@ -1919,7 +1922,7 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
1919
1922
+ (['-c' ] if clean else [])
1920
1923
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
1921
1924
+ ['--build' , build ]
1922
- + (['-v' ] if verbose else [])
1925
+ + (['-v' ] if very_verbose else [])
1923
1926
+ args ,
1924
1927
env = env )
1925
1928
@@ -1979,7 +1982,7 @@ def test_(toolchain=None, mcu=None, list_compile=False, list_run=False, compile_
1979
1982
cmd += ['--build' , build ]
1980
1983
cmd += ['--test-spec' , test_spec ]
1981
1984
cmd += (['-n' , tests_by_name ] if tests_by_name else [])
1982
- cmd += (['-v' ] if verbose else [])
1985
+ cmd += (['-v' ] if very_verbose else [])
1983
1986
1984
1987
try :
1985
1988
popen (cmd + args , env = env )
@@ -1999,7 +2002,7 @@ def test_(toolchain=None, mcu=None, list_compile=False, list_run=False, compile_
1999
2002
if list_compile :
2000
2003
cmd = ['python' , '-u' , os .path .join (tools_dir , 'test.py' ), '--list' ]
2001
2004
cmd += (['-n' , tests_by_name ] if tests_by_name else [])
2002
- cmd += (['-v' ] if verbose else [])
2005
+ cmd += (['-v' ] if very_verbose else [])
2003
2006
2004
2007
try :
2005
2008
popen (cmd + args , env = env )
0 commit comments