fastest way to collect filenames in working dir
Christian Ebert
blacktrash at gmx.net
Fri Oct 19 14:52:51 UTC 2007
* Christian Ebert on Wednesday, October 17, 2007 at 10:32:15 +0200
> This seems to work (until someone points out the flaws):
>
> def myfunc(ui, repo, expand, *pats, **opts):
> cmdutil.bail_if_changed(repo)
^^^^^^^^^^^^^^^
This is the flaw, as it calls status comparing with working
directory, using stat of course. As I need the check, the whole
exercise was mute.
> wlock = lock = None
> try:
> wlock = repo.wlock()
> lock = repo.lock()
> files, match, anypats = cmdutil.matchpats(repo, pats, opts)
> fdict = dict.fromkeys(files)
> fdict.pop('.', None)
> ctx = repo.changectx()
> node = ctx.node()
> man = ctx.manifest()
> mfiles = man.keys()
> mfiles.sort()
> files = []
> for mf in mfiles:
> for ff in fdict:
> if ff == mf or ff.startswith('%s/' % mf):
> files.append(ff)
> del fdict[ff]
> break
> if not mf in files and match(mf):
> files.append(mf)
> files = [f for f in files if mymatcher(f) and not man.linkf(f)]
> ...
Recording embarrassing moments for posterity ;)
c
--
keyword extension for Mercurial (http://selenic.com/mercurial):
<http://www.blacktrash.org/hg/hgkeyword/> (0.9.2 backwards compatible)
Mercurial crew development repository + keyword extension:
<http://www.blacktrash.org/hg/hg-crew-keyword/>
More information about the Mercurial-devel
mailing list