Question

I have checked out a working copy from a repository and switched some directories to a different URL but on the same repo (same host and svn server).

How could I list these switched directories?

We use many switching for internal purposes and it would help to easily list all these in a working copy, until this quick-and-dirty usage of switch is eliminated.

Was it helpful?

Solution

(1) The answer provided by @ks1322 is concise and it works fine except for one minor tweak: one should use "^URL" instead of just "URL" because some files will report a Copied from URL line as well. Here is some sample output on my system that shows that minor issue:

URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/commands
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/commands/show%20test.cmd
URL: file:///C:/usr/tmp/SvnSandbox/trunk/commands/subdir
URL: file:///C:/usr/tmp/SvnSandbox/trunk/commands/subdir/stuff.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/commands/reversion_test.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/file-on-branch1.txt
Copied From URL: file:///C:/usr/tmp/SvnSandbox/branches/branch1/file-on-branch1.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/externals
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/file-on-branch-and-subbranch.txt
URL: file:///C:/usr/tmp/SvnSandbox/branches/sub-branch1/file-on-sub-branch1.txt

(2) For those on Windows systems, one equivalent command (using PowerShell) is:

svn info --depth=infinity | Select-String ^URL

(3) But for output with a much higher signal-to-noise ratio try this:

Get-SvnInfo . -Recurse -ContainersOnly Path, URL | 
Format-Table Path, `
    @{ n='Branch'; `
       e={$_.URL -replace ".*(trunk|branches/[^/]*).*", '$1'} }

The output from that sequence shows you at a glance what you need to know. From the same sample tree used in my first example, here is what it reveals:

Path                              Branch
----                              ------
commands                          branches/sub-branch1
externals                         branches/sub-branch1
commands\subdir                   trunk
externals\commonlib               trunk
externals\commonlib\textfiles     trunk

(The Get-SvnInfo cmdlet is available from my open source PowerShell library--see the PowerShell book on my API bookshelf for details.)

OTHER TIPS

You can recursively list URLs of all files and directories in working copy with command like this:

svn info --depth=infinity|grep URL

You will see switched URLs in output and therefore switched directories also.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top