changeset 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
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)