Visualizzazione post con etichetta svn. Mostra tutti i post
Visualizzazione post con etichetta svn. Mostra tutti i post

venerdì 14 giugno 2013

Quickly get a list of all svn:externals for a remote svn repository

http://stackoverflow.com/questions/10183426/quickly-get-a-list-of-all-svnexternals-for-a-remote-svn-repository
We have an svn repository with lots of directories and files and our build system needs to be able to find all of the svn:externals properties, recursively for a branch in the repository, before checking it out. Currently we use:
svn propget svn:externals -R http://url.of.repo/Branch
This has proved extremely time consuming I finally came up with a solution. I decided to break up the request into multiple small svn requests and then make each of those a task to be run by a thread pool. This kind of slams the svn server, but in our case the svn server is on the LAN and this query is only made during full builds so it doesn't seem to be an issue.
import os
import sys
import threading
import ThreadPool

thread_pool = ThreadPool.ThreadPool(8)
externs_dict = {}
externs_lock = threading.Lock()

def getExternRev( path, url ):
    cmd = 'svn info "%s"' % url
    pipe = os.popen(cmd, 'r')
    data = pipe.read().splitlines()

    #Harvest last changed rev
    for line in data:
        if "Last Changed Rev" in line:
            revision = line.split(":")[1].strip()
            externs_lock.acquire()
            externs_dict[path] = (url, revision)
            externs_lock.release()

def getExterns(url, base_dir):
    cmd = 'svn propget svn:externals "%s"' % url
    pipe = os.popen(cmd, 'r')
    data = pipe.read().splitlines()
    pipe.close()

    for line in data:
        if line:
            line = line.split()
            path = base_dir + line[0]
            url = line[1]
            thread_pool.add_task( getExternRev, path, url )

def processDir(url, base_dir):
    thread_pool.add_task( getExterns, url, base_dir )

    cmd = 'svn list "%s"' % url
    pipe = os.popen(cmd, 'r')
    listing = pipe.read().splitlines()
    pipe.close()

    dir_list = []
    for node in listing:
        if node.endswith('/'):
            dir_list.append(node)

    for node in dir_list:
        #externs_data.extend( analyzePath( url + node, base_dir + node ) )
        thread_pool.add_task( processDir, url+node, base_dir+node )

def analyzePath(url, base_dir = ''):
    thread_pool.add_task( processDir, url, base_dir )
    thread_pool.wait_completion()


analyzePath( "http://url/to/repository" )
print externs_dict

lunedì 17 settembre 2012

Command Line Subversion

http://code.google.com/p/westmont-risk/wiki/SvnTutorial

Installing Subversion

Subversion is a client-server system. The Subversion repository is maintained on the project web server. Subversion clients run on users' machines and connect to the Subversion server via the Internet. You must have a Subversion client on your local machine to access the Subversion server for projects hosted on this site. Clients are available for nearly all platforms. You can download a client for your operating system from the Subversion project download page .
While some people like using the Subversion command-line client, svn during development, TortoiseSVN is a good choice for users who prefer graphical interfaces. This guide covers instructions for command-line Subversion only.

Export da svn con automation




How can i use svn export command to get a single file from the repository.
I try this
svn export e:\repositories\process\test.txt c:\
but I get this:
svn: e:\repositories\process is not a working copy
share|improve this question

feedback

2 Answers

up vote12down voteaccepted
Guessing from your directory name, you are trying to access the repository on the local filesystem. You still need to use URL syntax to access it:
svn export file:///e:/repositories/process/test.txt c:\test.txt
share|improve this answer
feedback
You don't have to do this locally either. You can do it through a remote repository, for example:
svn export http://<repo>/process/test.txt /path/to/code/
There is a pretty good scenario based tutorial here for these kind of situations:http://www.duchnik.com/tutorials/vc/svn-command-reference
share|improve this answer