changeset 8854:980f5b7c5fb6

tags: drop nested function
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Jun 2009 23:08:33 -0500
parents e28b7939d430
children f331de880cbb
files mercurial/localrepo.py
diffstat 1 files changed, 16 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jun 18 23:04:54 2009 -0500
+++ b/mercurial/localrepo.py	Thu Jun 18 23:08:33 2009 -0500
@@ -290,26 +290,24 @@
                 globaltags[k] = an, ah
                 tagtypes[k] = tagtype
 
-        def tagctxs():
-            seen = set()
-            f = None
-            ret = []
-            for node in self.heads():
-                try:
-                    fnode = self[node].filenode('.hgtags')
-                except error.LookupError:
-                    continue
-                if fnode not in seen:
-                    seen.add(fnode)
-                    if not f:
-                        f = self.filectx('.hgtags', fileid=fnode)
-                    else:
-                        f = f.filectx(fnode)
-                    ret.append(f)
-            return reversed(ret)
+        seen = set()
+        f = None
+        ctxs = []
+        for node in self.heads():
+            try:
+                fnode = self[node].filenode('.hgtags')
+            except error.LookupError:
+                continue
+            if fnode not in seen:
+                seen.add(fnode)
+                if not f:
+                    f = self.filectx('.hgtags', fileid=fnode)
+                else:
+                    f = f.filectx(fnode)
+                ctxs.append(f)
 
         # read the tags file from each head, ending with the tip
-        for f in tagctxs():
+        for f in reversed(ctxs):
             readtags(f.data().splitlines(), f, "global")
 
         try: