开发者

Scan subversion repository for active branches

开发者 https://www.devze.com 2023-02-14 03:40 出处:网络
I have a dozen projects in the repository. The repository structure looks like below: / ------- + project1

I have a dozen projects in the repository. The repository structure looks like below:

/ -------
   + project1 
       +------- trunk
       +------- tags
       +------- branches
   + project2

Our policy requires any active branch to be deleted after 30 day inactivity. However, there is no automatic to detect such bra开发者_JAVA技巧nch. Occasionally I have some branch left out for too many days.

Is there a script to list branches, as well as their last check in date?


Have you tried:

svn ls -v http://your.svn.server/path/branches

That will print the branches with the last revision that affected them, the user and the date.


I eventually wrote a script to do it. For those who are interested, you can achieve this through a one liner

svn list -v REPO_URL | grep -E "\/branches\/[0-9a-zA-Z_.-]+\/$"

My repository is quite big so that this one liner runs too slow. I had to optimize the script not to step into tags and trunk, and not go more than two levels deep.


The way I'd do it is I'd write a script to get a list of all branches and then for each branch, get the most recent commit using "svn log -l 1 -q" (Show only the last commit and be quiet about it), parse the date and do some date math. I don't know of any script/tool that already does this but the approach should work regardless of your branching patterns.

0

精彩评论

暂无评论...
验证码 换一张
取 消