changeset 556:f6c6fa15ff70

Move dirstate.uniq to util.unique -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Move dirstate.uniq to util.unique manifest hash: 8ac613c30a4471f14ae52f14ed0839d66eeaebb7 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCxQAqywK+sNU5EO8RAsTiAJ9E9/cALe+W8ojtfVdiXXre5dB/9gCeOgxr mRnVw/WDplkATW5450Pgsug= =xSfl -----END PGP SIGNATURE-----
author mpm@selenic.com
date Fri, 01 Jul 2005 00:34:50 -0800
parents 39a1cfb03ebd
children b9fee419a1bd
files mercurial/hg.py mercurial/util.py
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Fri Jul 01 00:34:17 2005 -0800
+++ b/mercurial/hg.py	Fri Jul 01 00:34:50 2005 -0800
@@ -296,16 +296,9 @@
         # compare all files by default
         if not files: files = [self.root]
 
-        def uniq(g):
-            seen = {}
-            for f in g:
-                if f not in seen:
-                    seen[f] = 1
-                    yield f
-
         # recursive generator of all files listed
         def walk(files):
-            for f in uniq(files):
+            for f in util.unique(files):
                 f = os.path.join(self.root, f)
                 if os.path.isdir(f):
                     for dir, subdirs, fl in os.walk(f):
@@ -317,7 +310,7 @@
                 else:
                     yield f[len(self.root) + 1:]
 
-        for fn in uniq(walk(files)):
+        for fn in util.unique(walk(files)):
             try: s = os.stat(os.path.join(self.root, fn))
             except: continue
 
--- a/mercurial/util.py	Fri Jul 01 00:34:17 2005 -0800
+++ b/mercurial/util.py	Fri Jul 01 00:34:50 2005 -0800
@@ -7,6 +7,13 @@
 
 import os
 
+def unique(g):
+    seen = {}
+    for f in g:
+        if f not in seen:
+            seen[f] = 1
+            yield f
+
 class CommandError(Exception): pass
 
 def explain_exit(code):