how can I get the SVN head version number in shell?

后端 未结 1 1987
一生所求
一生所求 2021-01-19 19:15

I use svn in command line. How can I get the head version number in command line. I need the number,not only to see the info . I want to use this number to build my project

1条回答
  •  南方客
    南方客 (楼主)
    2021-01-19 19:33

    Here is simple shell script thingy for you. Execute: svn info -rHEAD | grep Revision | cut -d' ' -f2

    See it in action:

    main$ svn info -rHEAD
    Path: main
    URL: svn://url/trunk/main
    Repository Root: svn://url
    Repository UUID: xxxxx-xxxx-xxxx-xxxx-xxxxxxxx
    Revision: 17042
    Node Kind: directory
    Last Changed Author: Nishant
    Last Changed Rev: 17040
    Last Changed Date: 2012-08-09 11:29:05 +0530 (Thu, 09 Aug 2012)
    
    main$ svn info -rHEAD | grep Revision | cut -d' ' -f2
    17042
    

    Edit1: updated to fetch head rev.

    0 讨论(0)
提交回复
热议问题