Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Exclude repositories from ftp browser

There is no need to browse into the repositories on the main website.
It's still possible to browse there directly on the ftp servers of course,
for those that need to debug a repository install and things like that.
  • Loading branch information...
commit 0b4eff93e27cc50a84fcd89025e5b7f2faeabff5 1 parent fdb9858
@mhagander mhagander authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 tools/ftp/spider_ftp.py
View
16 tools/ftp/spider_ftp.py
@@ -13,6 +13,10 @@
import codecs
import urllib2
+# Directories, specified from the root of the ftp tree and down, that
+# will be recursively excluded from the pickle.
+exclude_roots = ['/repos', ]
+
allnodes = {}
def read_file(fn):
@@ -37,11 +41,13 @@ def parse_directory(dirname, rootlen):
'd': os.readlink(fn),
}
else:
- # This is a subdirectory, recurse into it
- parse_directory(fn, rootlen)
- mynode[f] = {
- 't': 'd',
- }
+ # This is a subdirectory, recurse into it, unless it happens
+ # to be on our exclude list.
+ if not fn[rootlen:] in exclude_roots:
+ parse_directory(fn, rootlen)
+ mynode[f] = {
+ 't': 'd',
+ }
else:
# This a file
stat = os.stat(fn)
Please sign in to comment.
Something went wrong with that request. Please try again.