导航:首页 > 编程语言 > pythonsvn库

pythonsvn库

发布时间:2022-05-07 15:43:03

❶ 求助关于python使用svn的问题

你是想使用python操作svn吧,你可以安装svn的第三方库。

https://pypi.python.org/pypi/svn/0.3.25


具体使用:

importsvn.local
importpprint

r=svn.local.LocalClient('/dev/repo')
r.export('/tmp/export')

pprint.pprint(r.info())

importsvn.remote

r=svn.remote.RemoteClient('https://repo.local/svn')
r.checkout('/tmp/working')

如果解决了您的问题请采纳!
如果未解决请继续追问!

❷ python3如何将远端svn上的文件下载到本地

这还不简单, 根本不需要python, A机器上面ssh到B机器上面去, 执行svn up
PS: python也有ssh库, 也可以手动写程序去连

❸ 什么是目前比较常用的Python扩展库管理工具

这个网站左上角有documentation链接的,点进去看看。
像exe,msi如果别人已经编译过了就看不到源码了,说明作者并不希望你看到源码。第三方库开源软件比较多,有网页论坛可以找,所以直接进模块目录就可以看到源码。
元格中输入公式:=RIGHT(A,),确认后即显示

❹ 如何将 SVN 源码库转换为 Mercurial

首先得安装 Subversion 库函数
wget http://mirrors.hust.e.cn/apache/subversion/subversion-1.8.8.tar.gz

tar xzf subversion-1.8.8.tar.bz2

cd subversion-1.8.8

subversion-1.8.8 aliang$ ./autogen.sh
buildcheck: checking installation...
buildcheck: autoconf not found.
You need autoconf version 2.59 or newer installed.

brew install autoconf
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/autoconf-2.69.mavericks.bottle.tar.gz
#################################################### 100.0%
==> Pouring autoconf-2.69.mavericks.bottle.tar.gz
🍺 /usr/local/Cellar/autoconf/2.69: 69 files, 2.0M

./autogen.sh
buildcheck: checking installation...
buildcheck: autoconf version 2.69 (ok)
buildcheck: autoheader version 2.69 (ok)
buildcheck: libtool not found.
You need libtool version 1.4 or newer installed

brew install libtool
Warning: A newer Command Line Tools release is available
Update them from Software Update in the App Store.
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libtool-2.4.2.mavericks.bottle.2.tar.gz
##################################################### 100.0%
==> Pouring libtool-2.4.2.mavericks.bottle.2.tar.gz
==> Caveats
In order to prevent conflicts with Apple''s own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺 /usr/local/Cellar/libtool/2.4.2: 66 files, 2.2M

./autogen.sh
buildcheck: checking installation...
buildcheck: autoconf version 2.69 (ok)
buildcheck: autoheader version 2.69 (ok)
buildcheck: libtool version 2.4.2 (ok)
Copying libtool helper: /usr/local/share/aclocal/libtool.m4
Copying libtool helper: /usr/local/share/aclocal/ltoptions.m4
Copying libtool helper: /usr/local/share/aclocal/ltsugar.m4
Copying libtool helper: /usr/local/share/aclocal/ltversion.m4
Copying libtool helper: /usr/local/share/aclocal/lt~obsolete.m4
Creating build-outputs.mk...
Creating svn_private_config.h.in...
Creating configure...

You can run ./configure now.

Running autogen.sh implies you are a maintainer. You may prefer
to run configure in one of the following ways:

./configure --enable-maintainer-mode
./configure --disable-shared
./configure --enable-maintainer-mode --disable-shared
./configure --disable-optimize --enable-debug
./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'

Note: If you wish to run a Subversion HTTP server, you will need
Apache 2.x. See the INSTALL file for details.

brew install swig
==> Downloading http://downloads.sourceforge.net/project/swig/swig/swig-2.0.11/swig-2.0.11.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/swig/2.0.11
==> make
==> make install
🍺 /usr/local/Cellar/swig/2.0.11: 597 files, 6.2M, built in 10.1 minutes

./configure --with-swig=/usr/local/bin/swig
configure: Configuring Subversion 1.8.8
... ...
==================================================================
WARNING: You have chosen to compile Subversion with a different
compiler than the one used to compile Apache.

Current compiler: gcc
Apache's compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc

This could cause some problems.
==================================================================
... ...

make swig-py
make install
make check-swig-py
sudo make install-swig-py

sudo cp -r /usr/local/lib/svn-python/ /Library/Python/2.7/site-packages/

执行转换命令
mkdir hgpath

cd hgpath

hg init

hg convert -s svn -d hg ${local_path} ./hgpath

注意,这里转换的 SVN 目录只能是仓库目录而不是工作目录

❺ 怎么用python更新SVN、获取SVN版本号、获取SVN两个版本号之间的修改日志。

1) 执行shell命令,最好用popen打开,不过中间会有一些交互,除非事先的鉴权信息保存在系统中了。参考buildbot中对这些版本管理软件的用法。
2)好像有个pySVN的库可以用。

❻ python如何获取svn路径是文件还是文件夹

GetFilesFromSVN.py
#----------------------------------------------
# Author : Jeff Yu
# Date : 2012-8-13
# Function : get files from SVN
#----------------------------------------------

#----------------------------------
# Step1: Get INFO
#----------------------------------
import sys,ConfigParser

try:
configFile = open("config.ini","r")
except IOError:
print "config.ini is not found"
raw_input("")
sys.exit()

config = ConfigParser.ConfigParser()
config.readfp(configFile)
configFile.close()

# get baseurl
try:
baseurl = config.get("INFO","baseurl")

# incase last "/" is missing in baseurl
baseurl = baseurl.rstrip("/")
baseurl = "%s/"%baseurl
except ConfigParser.NoOptionError:
print "baseurl is not found under section INFO in config.ini."
raw_input("")
sys.exit()

# get user
try:
user = config.get("INFO","user")
except ConfigParser.NoOptionError:
meg = "user is not found under section INFO in config.ini."
raw_input("")
sys.exit()

# get passwd
try:
passwd = config.get("INFO","passwd")
except ConfigParser.NoOptionError:
meg = "passwd is not found under section INFO in config.ini."
raw_input("")
sys.exit()

# get fileList
try:
fileList = config.get("INFO","fileList")
except ConfigParser.NoOptionError:
meg = "fileList is not found under section INFO in config.ini."
raw_input("")
sys.exit()

#----------------------------------
# Step2: Auth
#----------------------------------
import urllib2
realm = "Subversion Repositories"
auth = urllib2.HTTPBasicAuthHandler()
auth.add_password(realm, baseurl, user, passwd)
opener = urllib2.build_opener(auth, urllib2.CacheFTPHandler)
urllib2.install_opener(opener)

#----------------------------------
# Step3: Create Folder
#----------------------------------
import os
folderName = "svnFile"
if not os.path.exists(folderName):
os.mkdir(folderName)

#----------------------------------
# Step4: Get Files
#----------------------------------
fr = open(fileList,'r')
for i in fr:
i = i.strip("\n")
i = i.strip(" ")

# ignore the blank line
if i != "":
url = "%s%s"%(baseurl,i)

try:
data = urllib2.urlopen(url)

fw = open("%s/%s"%(folderName,i),'w')
fw.write(data.read())
fw.close()

print "Download: %s."%i

except urllib2.HTTPError, e:
# HTTPError is a subclass of URLError
# need to catch this exception first
mesg = str(e).split(" ")
errCode = mesg[2].rstrip(":")

if errCode == "401":
# HTTP Error 401: basic auth failed
print "Can not login in, please check the user and passwd in config.ini."
break
elif errCode == "404":
# HTTP Error 404: Not Found
print "Not Found: %s"%i
else:
print e
print "Failed to download %s"%i

except urllib2.URLError:
# 1.SVN server is down
# 2.URL is not correct
print "Please check SVN Server status and baseurl in config.ini."
break

fr.close()
raw_input("")
config.ini

[INFO]
baseurl = https://xxx/xxx/xxx/xxx/
user = 用户名
passwd = 密码
fileList= fileList.txt
fileList.txt

aaaaa.txt
bbbbb.txt
ccccc.txt
使用方法:
1.配置config.ini,配置好需要check out文件所在文件夹的URL(baseurl),用户名(user),密码(passwd)和存储文件列表的文件名称(fileList)

2.将要check out的文件列表放在文本文件里面(fileList.txt),每一个文件占一行.

3.双击GetFilesFromSVN.py运行,下载的文件将放在当前文件夹下用过名为svnFile的文件夹里面.

PS:获取realm

在这个脚本中,我hardcode了一段代码(064行) realm = "Subversion Repositories"

关于这个realm,可以使用下面脚本获取:
import urllib2
import sys

url = '这里写URL'

username = '这里写用户名'
password = '这里写密码'

req = urllib2.Request(url)
try:
handle = urllib2.urlopen(req)
except IOError, e:
pass
else:
print "This page isn't protected by authentication."
sys.exit(1)

getrealm = e.headers['www-authenticate']
print getrealm

❼ svn的commit功能,怎么用python实现

真不太清楚你什么意思,好吧照我理解的来,给你个ci的def
def co_file(src):
co_cmd="svn co "+src
os.system(co_cmd)
#function: ci file with log comments
def ci_file():
current_path=os.getcwd()
svn_path=current_path+"/scm"
os.chdir(svn_path)
ci_cmd="svn ci -F comments.txt --force-log"
os.system(ci_cmd)
os.system("rm -f scm/*")
os.chdir(current_path)

❽ python pysvn 怎么使用

pysvn是Python下svn的第三方库。需要安装

1、首先需要安装svn客户端。

2、安装svn之前需要安装apr和apr-util。

3、安装pysvn。

❾ python svn脚本如何进行文件删除

其中实现功能的核心代码写得太过冗长,其实很简单的4行代码就能达到目的,如下:
1 import os
2 for (p,d,f) in os.walk("要删除的目录路径"):
3 if p.find('.svn')>0:
4 os.popen('rd /s /q %s'%p)

❿ 怎么在程序中(java/python)操作eclipse从设定好的svn中更新到最新版本

干嘛要让eclipse来做这件事呢?一般的做法是利用post-commit这个钩子,这个钩子是在SVN服务器端该版本库hooks文件夹内,这个钩子会在每次完成commit操作时被自动执行。
这个钩子实际就是一个批处理文件,你可以在这个钩子里利用SVN的命令行,在服务器端update得到最新版本,然后再传送到你的linux服务器。这样每次有提交,都会传送新版本到测试服务器。

一般我会把SVN服务器和测试服务器放在同一台主机上,这样就省事多了。

阅读全文

与pythonsvn库相关的资料

热点内容
安卓qq邮箱格式怎么写 浏览:429
如何电信租用服务器吗 浏览:188
编程中计算根号的思维 浏览:181
可爱的程序员16集背景音乐 浏览:446
软件代码内容转换加密 浏览:795
什么app看电视不要钱的 浏览:16
乌班图怎么安装c语言编译器 浏览:278
plc通讯块编程 浏览:923
我的世界服务器怎么清地皮 浏览:421
ftp服务器如何批量改名 浏览:314
网易我的世界服务器成员如何传送 浏览:268
公司云服务器远程访问 浏览:633
法哲学pdf 浏览:637
清大阅读app是什么 浏览:447
怎么用qq浏览器整体解压文件 浏览:585
肺组织压缩15 浏览:270
安卓手机为什么换电话卡没反应 浏览:797
诸子集成pdf 浏览:339
php注册框代码 浏览:718
手机加密好还是不加好好 浏览:815