]>
code.delx.au - pymsnt/blob - src/svninfo.py
2 # Copyright 2006 James Bunton <james@delx.cjb.net>
3 # Licensed for distribution under the GPL version 2, check COPYING for details
5 from twisted
.words
.xish
.domish
import parseFile
13 def calcRevision(self
, svndir
):
14 entriesFile
= os
.path
.join(svndir
, "entries")
15 doc
= parseFile(entriesFile
)
16 for child
in doc
.elements():
18 num
= int(child
.getAttribute("committed-rev"))
19 self
.version
= max(num
, self
.version
)
23 def traverseDir(self
, dirname
):
24 for file in os
.listdir(dirname
):
25 if os
.path
.islink(file):
27 if os
.path
.isdir(file):
28 path
= os
.path
.join(dirname
, file)
30 self
.calcRevision(path
)
32 self
.traverseDir(path
)
34 def getSVNVersion(dirname
="."):
36 x
.traverseDir(dirname
)
39 if __name__
== "__main__":