简体   繁体   中英

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.

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.

svn info «your_file» | grep URL

You can use svn info --xml to generate an XML dump of all information data. And you can use xmllint --xpath to exactly extract the right data. The small wrapper svninfo simplifies the use:

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 .

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:

@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. Clip.exe is in most recent versions of windows (after 2k3 Server)

就像“ svn信息” [文件]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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