Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN list sorted by creation date

Tags:

svn

If I run svn list svn://repo.example.com/tags, the listing is:

REL_1.9.0/
REL_1.9.1/
REL_1.9.10/
REL_1.9.11/
REL_1.9.12/
REL_1.9.13/
REL_1.9.14/
REL_1.9.15/
REL_1.9.16/
REL_1.9.2/
REL_1.9.3/
REL_1.9.4/
REL_1.9.5/
REL_1.9.6/
REL_1.9.7/
REL_1.9.8/
REL_1.9.9/

What I would like to get is:

REL_1.9.0/
REL_1.9.1/
REL_1.9.2/
REL_1.9.3/
REL_1.9.4/
REL_1.9.5/
REL_1.9.6/
REL_1.9.7/
REL_1.9.8/
REL_1.9.9/
REL_1.9.10/
REL_1.9.11/
REL_1.9.12/
REL_1.9.13/
REL_1.9.14/
REL_1.9.15/
REL_1.9.16/

So that I can get the most recent tag by tailing like this: svn ... | tail -1

How can I get the tags sorted by creation date, rather than alphabetic order.

Thanks!

like image 978
Dan Avatar asked Dec 16 '22 19:12

Dan


1 Answers

The version of sort I have (cygwin) has this option

 -V, --version-sort          natural sort of (version) numbers within text
$ cat test.txt | sort -V
REL_1.9.0/
REL_1.9.1/
REL_1.9.2/
REL_1.9.3/
REL_1.9.4/
REL_1.9.5/
REL_1.9.6/
REL_1.9.7/
REL_1.9.8/
REL_1.9.9/
REL_1.9.10/
REL_1.9.11/
REL_1.9.12/
REL_1.9.13/
REL_1.9.14/
REL_1.9.15/
REL_1.9.16/

So give svn list ... | sort -V | tail -1 a try

like image 97
karoberts Avatar answered Dec 30 '22 16:12

karoberts