comparison hgext3rd/topic/__init__.py @ 2992:db3c85c2cb47

topics: initialize variable with default value instead of assigning later
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 25 Sep 2017 03:06:37 +0530
parents f4956eb3a456
children 725b660d9886
comparison
equal deleted inserted replaced
2991:f4956eb3a456 2992:db3c85c2cb47
816 passed from current time for a topic as keys and topic name as values. 816 passed from current time for a topic as keys and topic name as values.
817 """ 817 """
818 topicstime = {} 818 topicstime = {}
819 curtime = time.time() 819 curtime = time.time()
820 for t in topics: 820 for t in topics:
821 secspassed = -1
821 maxtime = (0, 0) 822 maxtime = (0, 0)
822 trevs = repo.revs("topic(%s)", t) 823 trevs = repo.revs("topic(%s)", t)
823 # Need to check for the time of all changesets in the topic, whether 824 # Need to check for the time of all changesets in the topic, whether
824 # they are obsolete of non-heads 825 # they are obsolete of non-heads
825 # XXX: can we just rely on the max rev number for this 826 # XXX: can we just rely on the max rev number for this
834 obsmarkers = compat.getmarkers(repo, [repo[revs].node()]) 835 obsmarkers = compat.getmarkers(repo, [repo[revs].node()])
835 for marker in obsmarkers: 836 for marker in obsmarkers:
836 rt = marker.date() 837 rt = marker.date()
837 if rt[0] > maxtime[0]: 838 if rt[0] > maxtime[0]:
838 maxtime = rt 839 maxtime = rt
839 # is the topic still yet untouched 840 if trevs:
840 if not trevs:
841 secspassed = -1
842 else:
843 secspassed = (curtime - maxtime[0]) 841 secspassed = (curtime - maxtime[0])
844 try: 842 try:
845 topicstime[secspassed][1].append(t) 843 topicstime[secspassed][1].append(t)
846 except KeyError: 844 except KeyError:
847 topicstime[secspassed] = (maxtime, [t]) 845 topicstime[secspassed] = (maxtime, [t])