Obtenga todos los nombres de las sucursales en SVN

How do I get the list of all SVN branches which are more than x years old?

I use SVN on CentOS, and I have sventon for viewing all the repository.

preguntado el 01 de febrero de 12 a las 22:02

Out of interest: Do want branches which were "born" x years ago? Or do you look for branches without any activity for x years? -

4 Respuestas

  • svn help ls

If you'll use the URL of the repository branches root with verbose output, you'll 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 papar moscas will give you the branch's last-changed date.

  • svn help log

Slightly more complex and noisy output with a single advantage: a 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 "|" for excluding separation line, with <any tool of choice>, get affected branch from "Changed paths" filenames, date from the first string of the revision log.

Respondido el 03 de enero de 16 a las 22:01

svn ls seems to work for me. svn log has too many details. Can you please tell me how I can grep only those lines from svn ls with date > xx. Thanks - user1164061

this will be great for identifying and building the latest branch in jenkins - ldgorman

Instead of the url you can use the relative path: svn ls ^/branches --verbose - deflomu

You can always use "--xml" instead of "--verbose" resp. "-v". Yields machine readable output as opposed to "human readable output" as yielded by "--verbose". No need to remove separation lines etc. Extract what you need using xmlstarlet or using a proper XQuery script (Saxon, …).

Respondido 12 ago 16, 20:08

Combining @Lazy's answer and esta respuesta using command substitution you could put it all in one command:

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

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

Respondido 13 Abr '17, 15:04

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

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

Paso 2: abierto Excel and do a paste special.

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

Result: All branches which are less than x years old. This list was useful to me to do an svn delete --targets listofoldbranchnames.txt.

Respondido el 03 de enero de 16 a las 22:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.