MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/share/doc/subversion-1.3.2/tools/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/doc/subversion-1.3.2/tools/examples/getfile.py
#!/usr/bin/env python
#
# USAGE: getfile.py [-r REV] repos-path file
#
# gets a file from an SVN repository, puts it to sys.stdout
#

import sys
import os
import getopt

from svn import fs, core, repos

CHUNK_SIZE = 16384

def getfile(path, filename, rev=None):
  #since the backslash on the end of path is not allowed, 
  #we truncate it
  if path[-1] == "/":
     path = path[:-1]

  repos_ptr = repos.open(path)
  fsob = repos.fs(repos_ptr)

  if rev is None:
    rev = fs.youngest_rev(fsob)
    print "Using youngest revision ", rev
    
  root = fs.revision_root(fsob, rev)
  file = fs.file_contents(root, filename)
  while 1:
    data = core.svn_stream_read(file, CHUNK_SIZE)
    if not data:
      break
    sys.stdout.write(data)

def usage():
  print "USAGE: getfile.py [-r REV] repos-path file"
  sys.exit(1)

def main():
  opts, args = getopt.getopt(sys.argv[1:], 'r:')
  if len(args) != 2:
    usage()
  rev = None
  for name, value in opts:
    if name == '-r':
      rev = int(value)
  getfile(args[0], args[1], rev)

if __name__ == '__main__':
  main()

Anon7 - 2021