Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting branch creation date from svn

How do i can get creation date of a branch using shell commands. I need only the full date (e.g 2010-06-20 13:05:57 ) that i will use in my script as a variable.

Thank you

like image 654
Zatla00 Avatar asked Jun 24 '14 11:06

Zatla00


People also ask

How to tag svn branch?

Select the folder in your working copy which you want to copy to a branch or tag, then select the command TortoiseSVN → Branch/Tag.... If you can't remember the naming convention you used last time, click the button on the right to open the repository browser so you can view the existing repository structure.

How create a branch in svn?

To create a branch or a tag in a Subversion repository, do the following: From the main menu, choose VCS | Subversion | Branch or Tag. Alternatively, select the source folder in the SVN Repositories tool window and choose the Branch or Tag command from the context menu.


1 Answers

You can grab the revision information containing this data using svn log with --stop-on-copy to omit anything before branch creation, and --limit 1 to omit anything after. --quiet also helps, to remove the log message, since you're not interested in that:

svn log --limit 1 --stop-on-copy --revision 1:HEAD --quiet

This gives you a bunch of stuff in a string with the date, not the date by itself. To trim it, you need to pipe the output into another command. The answers to How can I extract just the formatted date fields using sed or grep? show how you can use sed, grep, perl, or even the "date" command to accomplish this.

like image 107
Ben Avatar answered Sep 19 '22 22:09

Ben