changeset 3535:4d97184a06ad

Make util.unique return a list
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Oct 2006 14:06:32 -0500
parents 549cb7b640fb
children ece5c53577eb
files hgext/mq.py mercurial/util.py
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Oct 27 12:09:33 2006 -0500
+++ b/hgext/mq.py	Fri Oct 27 14:06:32 2006 -0500
@@ -1015,9 +1015,9 @@
                     del mm[mm.index(x)]
                 dd.append(x)
 
-            m = list(util.unique(mm))
-            r = list(util.unique(dd))
-            a = list(util.unique(aa))
+            m = util.unique(mm)
+            r = util.unique(dd)
+            a = util.unique(aa)
             filelist = filter(matchfn, util.unique(m + r + a))
             if opts.get('git'):
                 self.diffopts().git = True
--- a/mercurial/util.py	Fri Oct 27 12:09:33 2006 -0500
+++ b/mercurial/util.py	Fri Oct 27 14:06:32 2006 -0500
@@ -128,10 +128,12 @@
 def unique(g):
     """return the uniq elements of iterable g"""
     seen = {}
+    l = []
     for f in g:
         if f not in seen:
             seen[f] = 1
-            yield f
+            l.append(f)
+    return l
 
 class Abort(Exception):
     """Raised if a command needs to print an error and exit."""