hgext3rd/topic/__init__.py
changeset 2922 66357d4d03b2
parent 2915 b3abdb3d819e
child 2923 8c2d3c474fc6
equal deleted inserted replaced
2921:23c9600607e7 2922:66357d4d03b2
    77     templatefilters,
    77     templatefilters,
    78     util,
    78     util,
    79 )
    79 )
    80 
    80 
    81 from . import (
    81 from . import (
       
    82     compat,
    82     constants,
    83     constants,
    83     revset as topicrevset,
    84     revset as topicrevset,
    84     destination,
    85     destination,
    85     stack,
    86     stack,
    86     topicmap,
    87     topicmap,
   725             fm.write('lasttouched', '%s', timestr, label='topic.list.time')
   726             fm.write('lasttouched', '%s', timestr, label='topic.list.time')
   726             fm.plain(')')
   727             fm.plain(')')
   727             fm.plain('\n')
   728             fm.plain('\n')
   728     fm.end()
   729     fm.end()
   729 
   730 
   730 getmarkers = None
       
   731 try:
       
   732     from mercurial import obsutil
       
   733     getmarkers = getattr(obsutil, 'getmarkers', None)
       
   734 except ImportError:
       
   735     pass
       
   736 
       
   737 if getmarkers is None:
       
   738     getmarkers = obsolete.getmarkers
       
   739 
       
   740 def _getlasttouched(repo, topics):
   731 def _getlasttouched(repo, topics):
   741     """
   732     """
   742     Calculates the last time a topic was used. Returns a dictionary of seconds
   733     Calculates the last time a topic was used. Returns a dictionary of seconds
   743     passed from current time for a topic as keys and topic name as values.
   734     passed from current time for a topic as keys and topic name as values.
   744     """
   735     """
   756                 # Can store the rev to gather more info
   747                 # Can store the rev to gather more info
   757                 # latesthead = revs
   748                 # latesthead = revs
   758                 maxtime = rt
   749                 maxtime = rt
   759             # looking on the markers also to get more information and accurate
   750             # looking on the markers also to get more information and accurate
   760             # last touch time.
   751             # last touch time.
   761             obsmarkers = getmarkers(repo, [repo[revs].node()])
   752             obsmarkers = compat.getmarkers(repo, [repo[revs].node()])
   762             for marker in obsmarkers:
   753             for marker in obsmarkers:
   763                 rt = marker.date()
   754                 rt = marker.date()
   764                 if rt[0] > maxtime[0]:
   755                 if rt[0] > maxtime[0]:
   765                     maxtime = rt
   756                     maxtime = rt
   766         # is the topic still yet untouched
   757         # is the topic still yet untouched