Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 5396:5105b119edd2
Add osutil module, containing a listdir function.
This is similar to os.listdir, only it returns a sorted list of tuples.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri, 05 Oct 2007 15:01:06 -0700 |
parents | b98c377b3c16 |
children | 6d1bd20ae14d |
line wrap: on
line diff
--- a/mercurial/util.py Fri Oct 05 23:40:33 2007 +0200 +++ b/mercurial/util.py Fri Oct 05 15:01:06 2007 -0700 @@ -14,7 +14,7 @@ from i18n import _ import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil -import os, stat, threading, time, calendar, ConfigParser, locale, glob +import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil try: set = set @@ -676,7 +676,7 @@ if os.path.isdir(src): os.mkdir(dst) - for name in os.listdir(src): + for name, kind in osutil.listdir(src): srcname = os.path.join(src, name) dstname = os.path.join(dst, name) copyfiles(srcname, dstname, hardlink) @@ -1060,7 +1060,8 @@ rcs = [os.path.join(path, 'hgrc')] rcdir = os.path.join(path, 'hgrc.d') try: - rcs.extend([os.path.join(rcdir, f) for f in os.listdir(rcdir) + rcs.extend([os.path.join(rcdir, f) + for f, kind in osutil.listdir(rcdir) if f.endswith(".rc")]) except OSError: pass @@ -1653,7 +1654,7 @@ for p in os.environ['HGRCPATH'].split(os.pathsep): if not p: continue if os.path.isdir(p): - for f in os.listdir(p): + for f, kind in osutil.listdir(p): if f.endswith('.rc'): _rcpath.append(os.path.join(p, f)) else: