简体   繁体   中英

How to retrieve SVN Repository URL (only) for a file

I want to retrieve the SVN repository URL only from the file which is checked out locally. I know there is a SVN Info command, but it gives too much info along with URL. I only need the URL which I am planning to save to Clipboard on menu click. Is it possible without going into parsing the result of SVN Info command?

Another option on Windows using PowerShell:

[xml]$svninfo = svn info FILENAME --xml;
$svninfo.info.entry.url;

Or without XML:

(svn info FILENAME |select-string "\burl")[0].Line.replace("URL: ","")

The PSCX extensions have an Out-Clipboard cmdlet which will let you dump the string to the clipboard.

I don't think so . But it's quite simple to filter out. Eg, on Windows:

D:\example>svn info foo.php | findstr URL:
URL: https://www.example.com:8443/svn/foo.php

On Unix (untested):

svn info foo.php | grep URL:

I know I'm a few years late to this question, so it is possible that the APIs have changed to allow my answer.

Windows command prompt:

svn info FILENAME --show-item url

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