简体   繁体   English

产生svn储存库中文件完整URL的命令行?

[英]A command line that yields the complete URL of a file inside the svn repository?

I am inside a directory in svn, I want to tell something another developer about a file there over chat. 我在svn中的目录中,我想通过聊天告诉其他开发人员有关该文件的信息。

Is there an easy command to obtain the full URL to that file - let's say something he can send as a parameter to svn export or something like that. 是否有一个简单的命令来获取该文件的完整URL-假设他可以将其作为参数发送给svn export或类似的东西。

svn info «your_file» | grep URL

You can use svn info --xml to generate an XML dump of all information data. 您可以使用svn info --xml生成所有信息数据的XML转储。 And you can use xmllint --xpath to exactly extract the right data. 您可以使用xmllint --xpath来准确提取正确的数据。 The small wrapper svninfo simplifies the use: 小包装svninfo简化了使用:

svninfo /info/entry/url

For the URL a simple grep might be sufficient, but for other values an exact XPath expression is more reliable than grep . 对于URL,简单的grep可能就足够了,但是对于其他值,精确的XPath表达式比grep更可靠。

Here's what I do. 这是我的工作。 It does the additional step of copying it to the clipboard so you can paste into a browser or email: 它执行将其复制到剪贴板的附加步骤,因此您可以粘贴到浏览器或电子邮件中:

getUrl.bat: getUrl.bat:

@echo off

svn info %1 | grep URL | sed -e s/URL://g | clip

This assumes you've got cygwin and clip.exe installed and on your PATH. 假设您已经在PATH上安装了cygwin和clip.exe。 Clip.exe is in most recent versions of windows (after 2k3 Server) Clip.exe在Windows的最新版本中(在2k3 Server之后)

就像“ svn信息” [文件]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM