运行环境:win7 64 位
python :2.7.13
TortoiseSVN 1.9.7, Build 27907 - 64 Bit , 2017/08/08 19:34:38
Subversion 1.9.7, -release
TortoiseSVN 安装的时候:需要手动选中
command line client tools(命令行客户端工具)(见最下面的附图)
安装之后,会自动的添加TortoiseSVN 安装目录到Path环境变量
在目录:C:\Program Files\TortoiseSVN\bin下会看到如下内容:
在SVN客户端版本控制代码 所在 目录下,运行如下脚本:
# -*- coding:utf-8 -*-
import re
import os
t = os.popen('svn info')
var = t.read()
#var = os.popen('svn info').read()
print var
list = var.splitlines()
for str in list:
if str.find('Revision:') >= 0:
version = re.findall("\d+", str)
print version[0]
运行结果:
Path: .
Working Copy Root Path: E:\beidou\src
URL: svn://192.168.1.215/my_python
Relative URL: ^/
Repository Root: svn://192.168.1.215/my_python
Repository UUID: d15854b4-7ff1-4048-a416-f3237be8fa59
Revision: 9
Node Kind: directory
Schedule: normal
Last Changed Author: Jack
Last Changed Rev: 9
Last Changed Date: 2018-02-27 17:10:16 +0800 (�ܶ�, 27 ���� 2018)
9
Process finished with exit code 0
注意其中的 Revision: 9
附图: