# HG changeset patch
# User Adrian Buehlmann <adr...@cadifra.com>
# Date 1253188970 -7200
# Node ID b4f989f9f04fb4799a5940dabb37c8aa3a08d44f
# Parent  1ce6b7a126e862b25bd286dffa9b669d27a77b15
status: refactor get_status_types (step 2)

use single initialization statement allchecks table

diff --git a/tortoisehg/hgtk/status.py b/tortoisehg/hgtk/status.py
--- a/tortoisehg/hgtk/status.py
+++ b/tortoisehg/hgtk/status.py
@@ -471,15 +471,20 @@ class GStatus(gdialog.GDialog):
     ### End of overrides ###
 
     def get_status_types(self):
-        # Tuple: (ctype, translated label)
-        checks = (('modified', _('M: modified')),
-                  ('added',    _('A: added')),
-                  ('removed',  _('R: removed')))
-        if self.count_revs() <= 1:
-            checks += (('deleted', _('!: deleted')),
-                       ('unknown', _('?: unknown')),
-                       ('clean',   _('C: clean')),
-                       ('ignored', _('I: ignored')))
+        # Tuple: (onmerge, ctype, translated label)
+        allchecks = [(True,  'modified', _('M: modified')),
+                     (True,  'added',    _('A: added')),
+                     (True,  'removed',  _('R: removed')),
+                     (False, 'deleted',  _('!: deleted')),
+                     (False, 'unknown',  _('?: unknown')),
+                     (False, 'clean',    _('C: clean')),
+                     (False, 'ignored',  _('I: ignored')) ]
+
+        checks = []
+        nomerge = (self.count_revs() <= 1)
+        for onmerge, button, text in allchecks:
+            if onmerge or nomerge:
+                checks.append((button, text))
 
         table = gtk.Table(rows=2, columns=3)
         table.set_col_spacings(8)

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to