topics: initialize variable with default value instead of assigning later
authorPulkit Goyal <7895pulkit@gmail.com>
Mon, 25 Sep 2017 03:06:37 +0530
changeset 2992 db3c85c2cb47
parent 2991 f4956eb3a456
child 2993 725b660d9886
topics: initialize variable with default value instead of assigning later
hgext3rd/topic/__init__.py
--- a/hgext3rd/topic/__init__.py	Mon Sep 25 03:04:42 2017 +0530
+++ b/hgext3rd/topic/__init__.py	Mon Sep 25 03:06:37 2017 +0530
@@ -818,6 +818,7 @@
     topicstime = {}
     curtime = time.time()
     for t in topics:
+        secspassed = -1
         maxtime = (0, 0)
         trevs = repo.revs("topic(%s)", t)
         # Need to check for the time of all changesets in the topic, whether
@@ -836,10 +837,7 @@
                 rt = marker.date()
                 if rt[0] > maxtime[0]:
                     maxtime = rt
-        # is the topic still yet untouched
-        if not trevs:
-            secspassed = -1
-        else:
+        if trevs:
             secspassed = (curtime - maxtime[0])
         try:
             topicstime[secspassed][1].append(t)