0

How to get svn log but exclude the branch added information? like in below output of 'svn log -v --stop-on-copy' how to avoid -r101 ? I'm trying to redirect this out to a temp file and just get the files added/modified/deleted details. So just need logs details w/o the branch created revision.

 svn log -v local/svn/demo/branches/Fix --stop-on-copy

 ------------------------------------------------------------------------
 r105 | user4 | 2013-05-24 16:27:11 -0400 (Fri, 24 May 2013) | 1 line
 Changed paths:
     M /branches/Fix/Code/Environment/RT/properties/build.properties

 ticket-9 
 ------------------------------------------------------------------------
 r104 | user4 | 2013-05-24 16:27:07 -0400 (Fri, 24 May 2013) | 1 line
 Changed paths:
     M /branches/Fix/Code/Environment/DEV/properties/build.properties

 ticket-7
 ------------------------------------------------------------------------
 r103 | user2 | 2013-05-24 15:27:25 -0400 (Fri, 24 May 2013) | 2 lines
 Changed paths:
     M /branches/Fix/Code/SharedApp/src/gov/illinois/ies/business/rules/ed/CorticonFinIncomeEntiyLoader.java

 ticket-2

 ------------------------------------------------------------------------
 r102 | user1 | 2013-05-24 15:19:54 -0400 (Fri, 24 May 2013) | 2 lines
 Changed paths:
    M /branches/Fix/Code/BEAN/Framework/ejbModule/gov/illinois/ies/business/rules/entities/fin/Income.java

 ticket-2

 ------------------------------------------------------------------------
 r101 | user4 | 2013-05-24 12:46:12 -0400 (Fri, 24 May 2013) | 3 lines
 Changed paths:
    A /branches/Fix (from /tags/2013-05-24T08:00:01.187-04:00_DEV_branch_WP_BUILD:100)

ticket-1

Re-creating the WP_Fix branch for 8AM tag

Updated further: -- Right now i'm running this :::

    svn log "$src_url" --stop-on-copy | grep -B 2 "$ticket" | grep "^r" | cut -d"r" -f2 | cut -d" " -f1 | sort -r

My output is:

   105
   104
   103
   102
   101

Intended output:

   105
   104
   103
   102    
iaav
  • 484
  • 2
  • 9
  • 26

2 Answers2

0

With awk you can use regex range. Something like this to skip over the portion you dont want.

awk '/r101/,/^$/ {next}1' <(svn log -v --stop-on-copy)

This will start skipping from r101 to the next blank line.

Update:

If you just need the list of files then you can do something like this -

awk '($1 == "A" || $1 == "M" || $1 == "D") &&  NF==2' <(svn log -v --stop-on-copy)
Community
  • 1
  • 1
jaypal singh
  • 74,723
  • 23
  • 102
  • 147
0

Picking an appropriate record separator eases matters. Given your sample input, this produces your desired output.

awk -v RS='(^|\n)-+\n' '
    # ignore empty records
    /^$/ {next}
    # assume "A /branches/" is the the pattern for what you want to ignore
    /A \/branches\// {next}
    # print the revision number without its first character
    {print substr($1, 2)}
' 

The regex (^|\n)-+\n means: starting at the beginning of the data or at a newline, match one or more hyphens followed by a newline.

glenn jackman
  • 238,783
  • 38
  • 220
  • 352