Angel Ezquerra committed 0ed1875

csinfo: add "obsolete" field

This field can show the obsolete "state" of a changeset. By "obsolete state" we
refer to any obsolete/changeset evolution related "flag", such as whether the
revision is obsolete, extinct or has some obsolete "trouble" (such as it being
divergent, bumped or unstable).

The list of "states" is shown as a list of strings, each with a light red

This is not used yet, but it will be enabled in a following changeset.

Comments (0)

Files changed (1)


 from tortoisehg.hgqt import qtlib, thgrepo
 PANEL_DEFAULT = ('rev', 'summary', 'user', 'dateage', 'branch', 'close',
-                 'tags', 'graft', 'transplant', 'p4', 'svn', 'converted')
+                 'tags', 'graft', 'transplant', 'obsolete',
+                 'p4', 'svn', 'converted',)
 def create(repo, target=None, style=None, custom=None, **kargs):
     return Factory(repo, custom, style, target, **kargs)()
               'tags': _('Tags:'), 'rawbranch': _('Branch:'),
               'rawtags': _('Tags:'), 'graft': _('Graft:'),
               'transplant': _('Transplant:'),
+              'obsolete': _('Obsolete state:'),
               'p4': _('Perforce:'), 'svn': _('Subversion:'),
               'converted': _('Converted From:'), 'shortuser': _('User:')}
                 except KeyError:
                 return None
+            elif item == 'obsolete':
+                obsoletestate = []
+                if ctx.obsolete():
+                    obsoletestate.append('obsolete')
+                if ctx.extinct():
+                    obsoletestate.append('extinct')
+                obsoletestate += ctx.troubles()
+                if obsoletestate:
+                    return obsoletestate
+                return None
             elif item == 'p4':
                 extra = ctx.extra()
                 p4cl = extra.get('p4', None)
                 return qtlib.markup(value)
             elif item == 'dateage':
                 return qtlib.markup('%s (%s)' % value)
+            elif item == 'obsolete':
+                opts = dict(fg='black', bg='#ff8566')
+                obsoletestates = [qtlib.markup(' %s ' % state, **opts)
+                                  for state in value]
+                return ' '.join(obsoletestates)
             raise UnknownItem(item)
         value = self.get_data(item, *args)
         if value is None: