[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn --version should give: 0.15.0 (build <revision>)

From: Edward S. Marshall <esm_at_logic.net>
Date: 2002-11-26 23:41:59 CET

On Tue, 2002-11-26 at 15:49, cmpilato@collab.net wrote:
> "Edward S. Marshall" <esm@logic.net> writes:
>
> > How about:
> >
> > find . -type d -name .svn -exec fgrep ' revision="' {}/entries \; | \
> > sed -e 's/.*"\(.*\)"\/>/\1/' | uniq | wc -l
> >
> > Crude, but effective. ;-)
>
> Great. Now do it on Windows.

Is that a problem? ;-) Okay, reimplement it in Python then:

import os, string

found = { }
def findsvn(path):
  for i in os.listdir(path):
    if os.path.isdir(i):
      if i == '.svn':
        fp = open(os.path.join(path, i, 'entries'))
        while 1:
          line = fp.readline()
          if not line:
            break
          idx = string.find(line, ' revision="')
          if idx != -1:
            found[str(line[13:-4])] = 1
      else:
        findsvn(os.path.join(path, i))

if __name__ == '__main__':
  findsvn(os.curdir)
  for i in found.keys():
    print i

Again, crude, but it works (faster too). :-)

-- 
Edward S. Marshall <esm@logic.net>
http://esm.logic.net/

Received on Tue Nov 26 23:42:43 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.