Prettify 'matrix changes' output
authorKalle Vahlman <kalle.vahlman@movial.com>
Fri, 9 Jan 2009 13:25:57 +0000 (15:25 +0200)
committerKalle Vahlman <kalle.vahlman@movial.com>
Fri, 9 Jan 2009 13:28:25 +0000 (15:28 +0200)
matrix/matrix.py
matrix/repositories.py

index 4bf796a..1bbf534 100644 (file)
@@ -282,6 +282,8 @@ def pull(targets):
 def changes(targets):
        changed = False
 
+       print "Searching for changes in components..."
+       print
        for name in targets:
                c = find_component(name)
 
@@ -295,13 +297,12 @@ def changes(targets):
                if not config.force and check_dirty(c):
                        changed = True
 
-       if changed:
-               raise Error()
+       if not changed:
+               print "No local changes in components."
+       print
 
 def check_changes(repo):
        ret = repo.changes()
-       if ret:
-               log.message('Changes in %s' % repo)
        return ret
 
 def check_dirty(c):
index 8f6e535..e9d6339 100644 (file)
@@ -200,13 +200,17 @@ class Repository(object):
                branch, remote = self.__get_branch_remote()
 
                output = git.changes(self.path, "%s/%s" % (remote, branch))
-               if output:
-                       if config.verbose:
-                               print 'Local commits in', self
-                               for line in output:
-                                       print ' ', line
-                               print
-
-                       return True
-               else:
+               if not output:
                        return False
+
+               if config.verbose:
+                       print 'Changes in', str(self) + ":"
+                       for line in output:
+                               print ' ', line
+                       print
+               elif len(output) == 1:
+                       print "One local commit in", str(self)
+               else:
+                       print len(output), "local commits in", str(self)
+
+               return True