status: tell the user the working tree is clean

If there is nothing output at all, tell the user the working tree is
completely clean.  It just gives them a bit more of a warm-fuzzy
feeling knowing repo and until the end.  It also more closely
matches with the output of git status.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2009-04-10 17:41:44 -07:00
parent 68194f42b0
commit 161f445a4d
2 changed files with 11 additions and 3 deletions

View File

@ -352,7 +352,7 @@ class Project(object):
df = self.work_git.DiffZ('diff-files') df = self.work_git.DiffZ('diff-files')
do = self.work_git.LsOthers() do = self.work_git.LsOthers()
if not di and not df and not do: if not di and not df and not do:
return return 'CLEAN'
out = StatusColoring(self.config) out = StatusColoring(self.config)
out.project('project %-40s', self.relpath + '/') out.project('project %-40s', self.relpath + '/')
@ -400,6 +400,7 @@ class Project(object):
else: else:
out.write('%s', line) out.write('%s', line)
out.nl() out.nl()
return 'DIRTY'
def PrintWorkTreeDiff(self): def PrintWorkTreeDiff(self):
"""Prints the status of the repository to stdout. """Prints the status of the repository to stdout.

View File

@ -23,5 +23,12 @@ class Status(PagedCommand):
""" """
def Execute(self, opt, args): def Execute(self, opt, args):
for project in self.GetProjects(args): all = self.GetProjects(args)
project.PrintWorkTreeStatus() clean = 0
for project in all:
state = project.PrintWorkTreeStatus()
if state == 'CLEAN':
clean += 1
if len(all) == clean:
print 'nothing to commit (working directory clean)'