summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/project.py b/project.py
index 4cef856b..9d98041f 100644
--- a/project.py
+++ b/project.py
@@ -650,13 +650,18 @@ class Project(object):
650 650
651 return False 651 return False
652 652
653 def PrintWorkTreeStatus(self): 653 def PrintWorkTreeStatus(self, output_redir=None):
654 """Prints the status of the repository to stdout. 654 """Prints the status of the repository to stdout.
655
656 Args:
657 output: If specified, redirect the output to this object.
655 """ 658 """
656 if not os.path.isdir(self.worktree): 659 if not os.path.isdir(self.worktree):
657 print '' 660 if output_redir == None:
658 print 'project %s/' % self.relpath 661 output_redir = sys.stdout
659 print ' missing (run "repo sync")' 662 print >>output_redir, ''
663 print >>output_redir, 'project %s/' % self.relpath
664 print >>output_redir, ' missing (run "repo sync")'
660 return 665 return
661 666
662 self.work_git.update_index('-q', 667 self.work_git.update_index('-q',
@@ -671,6 +676,8 @@ class Project(object):
671 return 'CLEAN' 676 return 'CLEAN'
672 677
673 out = StatusColoring(self.config) 678 out = StatusColoring(self.config)
679 if not output_redir == None:
680 out.redirect(output_redir)
674 out.project('project %-40s', self.relpath + '/') 681 out.project('project %-40s', self.relpath + '/')
675 682
676 branch = self.CurrentBranch 683 branch = self.CurrentBranch
@@ -720,6 +727,7 @@ class Project(object):
720 else: 727 else:
721 out.write('%s', line) 728 out.write('%s', line)
722 out.nl() 729 out.nl()
730
723 return 'DIRTY' 731 return 'DIRTY'
724 732
725 def PrintWorkTreeDiff(self): 733 def PrintWorkTreeDiff(self):