Get all branch names in SVN

How to get a list of all SVN branches that are older than x years old?

I am using SVN on CentOS , and I have sventon to view the entire repository.

+46
svn
Feb 01 '12 at 22:59
source share
4 answers
  • svn help ls

If you use the URL of the root of the repository repository with verbose output, you will get something like this:

 svn ls http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/ --verbose 28 lazybadg  22 2011 ./ 28 lazybadg  22 2011 Leichtbau-Deutsch/ 26 lazybadg  22 2011 branche-francaise/ 25 lazybadg  14 2010 i18n/ 

The 3 + 4 + 5 field in gawk will give you the last modified date of the branch.

  • svn help log

A slightly more complicated and noisy output with one advantage: readable date,

 svn log http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/ -v -q ------------------------------------------------------------------------ r28 | lazybadger | 2011-02-22 09:24:04 +0600 (, 22  2011) Changed paths: M /branches/Leichtbau-Deutsch/Hello.de.txt ------------------------------------------------------------------------ r27 | lazybadger | 2011-02-22 09:21:41 +0600 (, 22  2011) Changed paths: A /branches/Leichtbau-Deutsch (from /trunk:26) ------------------------------------------------------------------------ r26 | lazybadger | 2011-02-22 06:49:41 +0600 (, 22  2011) Changed paths: A /branches/branche-francaise (from /trunk:25) M /branches/branche-francaise/Hello.fr.txt ------------------------------------------------------------------------ 

| grep -v "|" to exclude the dividing line, with any tool> selected, get the damaged branch from the "Changed Paths" file names, the date from the first line of the scan log.

+73
Feb 02 2018-12-12T00:
source share

You can always use "--xml" instead of "--verbose" respectively. "-v". Allows machine-readable output as opposed to “readable information” received from “--verbose”. No need to remove dividing lines, etc. Extract what you need using xmlstarlet or using a suitable XQuery script (Saxon, ...).

+2
Aug 12 '16 at 6:23
source share

By combining @Lazy's answer and this answer using command substitution, you can put all this into one command:

 svn ls `svn info | grep '^URL' | awk '{sub(/trunk.*$/, "branches", $NF); print}'` -v 

(Depends on your svn repository, so change if necessary.)

+1
Sep 29 '16 at 13:05
source share

I figured out another way to do this, but you need a sventon or other tool that lists all the contents of your SVN repository.

Step 1: From your sventon view, copy the list of branches. This will include the revision, author and date.

Step 2: Open Excel and do a special paste.

Step 3: Filter the date column to show dates in less than x years.

Result: all branches less than x years old. This list is useful for me to do svn delete --targets listofoldbranchnames.txt .

-one
Feb 15 '12 at 18:38
source share



All Articles