List all svn: externals recursively?

How can I get a list of all svn: externals (recursively) in a directory? Is there any usefulness for this?

(I use Windows (and the turtle))

I have a bunch of svn: external links associated with different shared parts of my project, and when I go to branches, I'm usually quite error prone to find all external elements and change them to link to paths in a new branch.

+80
svn tortoisesvn
Mar 25 '09 at 2:30 p.m.
source share
6 answers

Do the following in the root of your working copy:

svn propget svn:externals -R 

As discussed in the comments below, this does not display external external elements.

Note for TortoiseSVN users: the TortoiseSVN installer has an option to install the SVN command-line client. This option is not enabled by default.

+124
Mar 25 '09 at 16:04
source share

Manually changing all these external properties seems tedious. Have you looked at the new functionality for external files added in Subversion 1.5?

Subversion 1.5 takes a huge step in alleviating these frustrations. As mentioned earlier, the URLs used in the new external text definition format can be relative, and Subversion provides syntactic magic for defining several attributes of relative relativity.

../

Regarding the URL of the directory where the svn: externals property is set

^ /

Regarding the root of the repository in which the svn: externals property is versioned

//

Regarding the URL scheme of the directory where the svn: externals property is set

/

Regarding the root URL of the server on which the svn: externals property is versioned

Maybe one of them will help? I think it depends on how you fork and what your repository structure looks like.

+15
Mar 25 '09 at 14:43
source share

My workaround for TortoiseSVN:

Open the "Branch / tag ..." dialog box from the SVN context menu. The lower dialog box displays all external elements, including nested external ones.

+7
Sep 15 '16 at 14:59
source share

Perhaps, as a workaround, you can structure your project so that all external elements are installed in one folder, for example, in the project folder just below Trunk. (This does not mean that all external folders should be at the same depth by the way.) Then you can right-click on the project folder, then Properties ..., then the Subversion tab, then Properties ... then double-click svn : externals.

0
Aug 18 '14 at 9:39 on
source share

I used Wim Cohenen's answer and wrote the following script to create a list of all revisions:

 getSvnRevs() { cd "$1" wcver="$(svnversion)" [ -n "$wcver" ] || panic "Unable to get version for $wcdir" echo "$1: $wcver" svn propget svn:externals -R | while read abcde; do [ -n "$a" ] || continue if [ "$b" = "-" ]; then wcparent="$a" wcdir="$wcparent/$c" [ -z "$e" ] || panic "Invalid format #1" else [ -n "$wcparent" ] || panic "Invalid format #2" wcdir="$wcparent/$a" [ -z "$c" ] || panic "Invalid format #3" fi [ -d "$wcdir" ] || panic "Invalid directory: $wcdir" wcver="$(svnversion "$wcdir")" [ -n "$wcver" ] || panic "Unable to get version for $wcdir" echo "$1/$wcdir: $wcver" done } 

Fortunately, I do not have nested external elements, so I did not have to test this, and I think it will not work. But if you need it, enough to just call this function recursively. In addition, I have never been tested with the names of files that need to slip away. It probably won't work.

DISCLAIMER: I know that the original question was about windows, and the shell script will not work there unless you use cygwin or the like.

0
May 13 '15 at 11:52
source share

I accepted Daniel Alder's answer , removed the svnversion calls and made it recursive (NOTE: read abcde does not work if there is a place or destination in the source). This is a bash script, so you need something like Cygwin or use the Windows Subsystem for Linux .

 getSvnExternals() { svnbase="$1" svnpath="$2" svn propget svn:externals -R "$svnbase/$svnpath" 2> /dev/null | while read abcde; do [ -n "$a" ] || continue if [ "$b" = "-" ]; then wcparent="$a" external="$c" wcdir=$(echo "$wcparent/$d" | sed s#^./##) [ -z "$e" ] || echo "WARNING: Invalid format #1. line='$a $b $c $d $e'" else [ -n "$wcparent" ] || echo "WARNING: Invalid format #2. wcparent=$wcparent" external="$a" wcdir=$(echo "$wcparent/$b" | sed s#^./##) [ -z "$c" ] || echo "WARNING: Invalid format #3. line='$a $b $c $d $e'" fi echo "$1/$wcdir: $external" ## recurse into external directory [ -d "$wcdir" ] && getSvnExternals "$1/$wcdir" done } 
0
Jun 16 '17 at 16:21
source share



All Articles