hgext/evolve.py
branchstable
changeset 513 4602104b190d
parent 512 8b25e9cf76fd
child 514 ea667749ccd1
--- a/hgext/evolve.py	Sat Aug 25 08:30:02 2012 +0200
+++ b/hgext/evolve.py	Sat Aug 25 08:51:37 2012 +0200
@@ -931,22 +931,20 @@
 
 @eh.wrapcommand("summary")
 def obssummary(orig, ui, repo, *args, **kwargs):
+    def write(fmt, count):
+        s = fmt % count
+        if count:
+            ui.write(s)
+        else:
+            ui.note(s)
+
     ret = orig(ui, repo, *args, **kwargs)
     nbunstable = len(getobscache(repo, 'unstable'))
     nblatecomer = len(getobscache(repo, 'latecomer'))
     nbconflicting = len(getobscache(repo, 'unstable'))
-    if nbunstable:
-        ui.write('unstable: %i changesets\n' % nbunstable)
-    else:
-        ui.note('unstable: 0 changesets\n')
-    if nblatecomer:
-        ui.write('latecomer: %i changesets\n' % nblatecomer)
-    else:
-        ui.note('latecomer: 0 changesets\n')
-    if nbconflicting:
-        ui.write('conflicting: %i changesets\n' % nbconflicting)
-    else:
-        ui.note('conflicting: 0 changesets\n')
+    write('unstable: %i changesets\n', nbunstable)
+    write('latecomer: %i changesets\n', nblatecomer)
+    write('conflicting: %i changesets\n', nbconflicting)
     return ret