comparison mercurial/hg.py @ 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 f2442a6a5893
children b9fee419a1bd
comparison
equal deleted inserted replaced
555:39a1cfb03ebd 556:f6c6fa15ff70
294 lookup, changed, added, unknown = [], [], [], [] 294 lookup, changed, added, unknown = [], [], [], []
295 295
296 # compare all files by default 296 # compare all files by default
297 if not files: files = [self.root] 297 if not files: files = [self.root]
298 298
299 def uniq(g):
300 seen = {}
301 for f in g:
302 if f not in seen:
303 seen[f] = 1
304 yield f
305
306 # recursive generator of all files listed 299 # recursive generator of all files listed
307 def walk(files): 300 def walk(files):
308 for f in uniq(files): 301 for f in util.unique(files):
309 f = os.path.join(self.root, f) 302 f = os.path.join(self.root, f)
310 if os.path.isdir(f): 303 if os.path.isdir(f):
311 for dir, subdirs, fl in os.walk(f): 304 for dir, subdirs, fl in os.walk(f):
312 d = dir[len(self.root) + 1:] 305 d = dir[len(self.root) + 1:]
313 if ".hg" in subdirs: subdirs.remove(".hg") 306 if ".hg" in subdirs: subdirs.remove(".hg")
315 fn = util.pconvert(os.path.join(d, fn)) 308 fn = util.pconvert(os.path.join(d, fn))
316 yield fn 309 yield fn
317 else: 310 else:
318 yield f[len(self.root) + 1:] 311 yield f[len(self.root) + 1:]
319 312
320 for fn in uniq(walk(files)): 313 for fn in util.unique(walk(files)):
321 try: s = os.stat(os.path.join(self.root, fn)) 314 try: s = os.stat(os.path.join(self.root, fn))
322 except: continue 315 except: continue
323 316
324 if fn in dc: 317 if fn in dc:
325 c = dc[fn] 318 c = dc[fn]