递归查找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.
  1. #!/usr/bin/env python
  2. """
  3. sevenup
  4.  
  5. Created by Clayton Parker
  6. http://www.claytron.com
  7. """
  8.  
  9. import os
  10. import sys
  11. import subprocess
  12.  
  13. # the directories that we want to scan
  14. dirs = sys.argv[1:]
  15. if not dirs:
  16. cur_dir = os.path.abspath(os.curdir)
  17. print "Using the current directory (%s) since none have been specified." % cur_dir
  18. dirs = [cur_dir]
  19. # we will walk each dir structure looking for working copies
  20. to_up = []
  21. ta = to_up.append
  22. for directory in dirs:
  23. directory = os.path.expanduser(directory)
  24. # TODO os.walk doesn't follow symlinks...
  25. for current_dir, directories, files in os.walk(directory):
  26. if '.svn' in directories:
  27. ta(current_dir)
  28. # delete the subdirs to stop recursion
  29. del directories[:]
  30. number_of_updates = len(to_up)
  31. print "Updating %s working copies... " % number_of_updates
  32. scall = subprocess.call
  33. # loop through all the paths and svn up them
  34. for upper in to_up:
  35. print " %s" % upper
  36. scall(('svn up %s' % upper).split())
  37. # what just happened? oh...
  38. print """
  39. *******
  40. summary
  41. *******
  42.  
  43. The following %s items have been updated:
  44.  
  45. """ % number_of_updates
  46. for upper in to_up:
  47. print upper
  48. print

以上是关于递归查找subversion工作副本并更新的主要内容,如果未能解决你的问题,请参考以下文章

如何在存储库位置更改时更新工作副本

Subversion简介

源代码管理最佳实践 - 定期从存储库更新工作副本

导入subversion工作副本中的所有新文件

将subversion工作副本指向移动的存储库URL

如何结合使用 Subversion 和 Eclipse