[PATCH] .hgskip support
Michael Fetterman
Michael.Fetterman at cl.cam.ac.uk
Wed Jul 6 12:57:14 UTC 2005
Xen workspaces typically have multiple large directory trees generated by
the build process. These trees are not managed by any revision control
system; they are completely generated. Because they are large, they cause
hg to slow down as it scans them...
This patch introduces .hgskip.
If the file ".hgskip" exists in a directory, hg will now skip this
directory whenever it is scanning for files. This enables us to add
.hgskip files to our generated directories, and thus keep hg running
nice and fast.
In a typical xen workspace with a couple of linux kernels built in it,
these files make the difference between "hg diff" taking 0-2 seconds
and 30+ seconds.
Michael Fetterman
# HG changeset patch
# User maf46 at burn.cl.cam.ac.uk
# Node ID a29e442ab9566e003eeff648e832319222cbde15
# Parent 8b8f710bb65875d588044c3615cf42180aee23ff
Added .hgskip support
If the file ".hgskip" exists in a directory, hg will now
skip this directory whenever it is scanning for files.
Adding .hgskip files to (large) generated directories
prevents hg from wasting its time scanning those
directories, thus keeping hg running nice and fast.
diff -r 8b8f710bb658 -r a29e442ab956 mercurial/hg.py
--- a/mercurial/hg.py Wed Jul 6 02:23:56 2005
+++ b/mercurial/hg.py Wed Jul 6 12:49:29 2005
@@ -297,7 +297,11 @@
if os.path.isdir(f):
for dir, subdirs, fl in os.walk(f):
d = dir[len(self.root) + 1:]
- if ".hg" in subdirs: subdirs.remove(".hg")
+ if ".hg" in subdirs:
+ subdirs.remove(".hg")
+ if ".hgskip" in fl:
+ del subdirs[:]
+ continue
for fn in fl:
fn = util.pconvert(os.path.join(d, fn))
yield fn
More information about the Mercurial
mailing list