summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/cvsfiles.py
blob: 21e72ee386e0dabf6c935485d7369b6b4a39101f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/env python

"""Create a list of files that are mentioned in CVS directories."""

import os
import sys
import string

def main():
    args = sys.argv[1:]
    if args:
	for arg in args:
	    process(arg)
    else:
	process(".")

def process(dir):
    cvsdir = 0
    subdirs = []
    names = os.listdir(dir)
    for name in names:
	fullname = os.path.join(dir, name)
	if name == "CVS":
	    cvsdir = fullname
	else:
	    if os.path.isdir(fullname):
		if not os.path.islink(fullname):
		    subdirs.append(fullname)
    if cvsdir:
	entries = os.path.join(cvsdir, "Entries")
	for e in open(entries).readlines():
	    words = string.split(e, '/')
	    if words[0] == '' and words[1:]:
		name = words[1]
		print os.path.join(dir, name)
    for sub in subdirs:
	process(sub)

main()