递归查找subversion工作副本并更新
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了递归查找subversion工作副本并更新相关的知识,希望对你有一定的参考价值。
Little utility script I wrote to find subversion working copies and update them. If no arguments are given the script starts from the current directory.
#!/usr/bin/env python """ sevenup Created by Clayton Parker http://www.claytron.com """ import os import sys import subprocess # the directories that we want to scan dirs = sys.argv[1:] if not dirs: cur_dir = os.path.abspath(os.curdir) print "Using the current directory (%s) since none have been specified." % cur_dir dirs = [cur_dir] # we will walk each dir structure looking for working copies to_up = [] ta = to_up.append for directory in dirs: directory = os.path.expanduser(directory) # TODO os.walk doesn't follow symlinks... for current_dir, directories, files in os.walk(directory): if '.svn' in directories: ta(current_dir) # delete the subdirs to stop recursion del directories[:] number_of_updates = len(to_up) print "Updating %s working copies... " % number_of_updates scall = subprocess.call # loop through all the paths and svn up them for upper in to_up: print " %s" % upper scall(('svn up %s' % upper).split()) # what just happened? oh... print """ ******* summary ******* The following %s items have been updated: """ % number_of_updates for upper in to_up: print upper
以上是关于递归查找subversion工作副本并更新的主要内容,如果未能解决你的问题,请参考以下文章