1#! /usr/bin/env python2.5
2
3import sys
4import os
5
6#for name in os.environ.keys():
7#	print "key " + name + " = " + os.environ[name]
8
9def print_output(cmd, prefix):
10	pipeOut = os.popen3(cmd, mode = 'br')[1]
11	for line in pipeOut:
12		term = ""
13		if os.path.isdir(line.strip()):
14			term = "/"
15		print prefix + line.strip() + term
16	pipeOut.close()
17
18if not os.environ.has_key("COMMAND_LINE"):
19	print "Fancy completion is not supported by your version of tcsh."
20	sys.exit(1)
21
22cmdLine = os.environ["COMMAND_LINE"]
23URL = cmdLine.split()[2]
24dir = "/" + URL.split('/', 3)[3]
25prefix = "file:/"
26
27if dir[-1] != "/":
28	dir = dir.rpartition("/")[0] + "/"
29
30print_output("svn ls " + "file://" + dir, prefix + "/" + dir)
31print_output("ls -d /" + dir + "*", prefix)
32
33