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-----
--- 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):