iaav
June 20, 2013, 7:07am
1
Just need the directory name and files changes information in svn log
This is my svn log verbose:
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2
------------------------------------------------------------------------
r133 | testuser1 | 2013-04-02 18:22:28 -0400 (Tue, 02 Apr 2013) | 3 lines
Changed paths:
M /branches/HelloWorld/Batch/test.java
DEMO-13
Testing to lock
------------------------------------------------------------------------
r132 | testuser2 | 2013-04-02 18:20:40 -0400 (Tue, 02 Apr 2013) | 3 lines
Changed paths:
M /branches/HelloWorld/Batch/test.java
DEMO-1
Testing to lock
Desired output:
Batch/test.java
Batch/test.java
Thanks you !!!
What have you tried so far?
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2 | egrep -o "\/.+$" | awk -F"/" '{print $(NF-1) FS $NF}'
iaav
June 20, 2013, 7:26am
4
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2 | awk '$1~/^[AMD]$/{for(i=2;i<=NF;i++)print $i}'
/branches/HelloWorld/Batch/test.java
/branches/HelloWorld/Batch/test.java
Hello,
Could you please try the following code.
Note: I am thinking that it is the log file and in following comand it is te5.
$ cat te5 | grep -i "/branches/HelloWorld" | awk -F "HelloWorld/" '{print$2}'
Batch/test.java
Batch/test.java
$
Thanks,
R. Singh
Try:
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2 |
awk -F/ 'NF>1{print $(NF-1) FS $NF}'
iaav
June 20, 2013, 7:29am
7
@Franklin52 - This gives the comments too.
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2 | awk -F/ 'NF>1{print $(NF-1) FS $NF}'
Batch/test.java
Testing to lock Demo/HelloWorld
Batch/test.java
Testing to lock Demo/HelloWorld
Please post the output of the svn command above and the desired output.
then we can try the following in case java is always there.
cat te5 | awk '/.java/' | awk -F "HelloWorld/" '{print$2}'
R. Singh
---------- Post updated at 06:40 AM ---------- Previous update was at 06:38 AM ----------
Could you please use the following code and let us know if it works.
$ cat te5 | awk '/.java/' | awk -F "HelloWorld/" '{print$2}'
Batch/test.java
Batch/test.java
$
Thanks,
R. Singh
iaav
June 20, 2013, 7:46am
10
Franklin - Re posting the svn command output and desired output
svn log -v http://10.118.19.200:8080/svn/IL_IES_Demo/branches/HelloWorld/Batch/ --limit 2
------------------------------------------------------------------------
r133 | srmula | 2013-04-02 18:22:28 -0400 (Tue, 02 Apr 2013) | 3 lines
Changed paths:
M /branches/HelloWorld/Batch/test.java
DEMO-335
Testing to lock Demo/HelloWorld
------------------------------------------------------------------------
r132 | srmula | 2013-04-02 18:20:40 -0400 (Tue, 02 Apr 2013) | 3 lines
Changed paths:
M /branches/HelloWorld/Batch/test.java
DEMO-335
Testing to lock Demo/HelloWorld
Desired output:
Batch/test.java
Batch/test.java
@Franklin52 - This gives the comments too.
Code:
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2 | awk -F/ 'NF>1{print $(NF-1) FS $NF}'Batch/test.javaTesting to lock Demo/HelloWorldBatch/test.javaTesting to lock Demo/HelloWorld
Could you please use the folloiwng code. Not sure I posted comment previously but not able to see here may be issues with my VPN.
cat te5 | awk '/.java/' | awk -F "HelloWorld/" '{print$2}'
Batch/test.java
Batch/test.java
$
Where te5 is the file which have logs saved in it.
R. Singh
iaav
June 20, 2013, 7:52am
12
@RavinderSingh13 :
The branch information changes "branches/HelloWorld"
Try this:
awk -F/ 'NF>1 && /M \//{print $(NF-1) FS $NF}' file
1 Like
iaav
June 20, 2013, 8:35am
14
Franklin52:
This works but the meta data changes on the commit file --> "AMD"
---------- Post updated at 08:35 AM ---------- Previous update was at 08:13 AM ----------
Output from this: (just need the file info)
Batch/test.java
/HelloWorld
Batch/test.java
/HelloWorld
Is this the output you desire now?
iaav
June 20, 2013, 9:18am
16
Did this:
svn log -v //test/svn/Demo/branches/HelloWorld/Batch --limit 2 | awk '$1~/^[AM]$/{for(i=2;i<=NF;i++)print $i}' | sed 's/\/branches\/HelloWorld\///g'
But do not wish to hard code the branch information. Any better way ?
---------- Post updated at 09:18 AM ---------- Previous update was at 09:15 AM ----------
Franklin52:
Just this -
Batch/test.java
Batch/test.java
Have you tried:
svn log......--limit 2 | awk -F/ 'NF>1 && /M \//{print $(NF-1) FS $NF}'
I don't get the exact content of svn log file. So please let me assume that every line starting with "M" represents modification, every line starting with "A" represents adding, every line starting with "D" represents deletion, and what you need is the modification info.
You can write a script like this:
#!/bin/bash
#scriptname:get_chg_info
#usage: get_chg_info svn_dir
svn log -v $1 --limit 2 | grep '^M ' | gawk 'BEGIN{FS="[ /]";OFS="/"} {print $(NF-1),$NF}'
And you can use it like this:
#./get_chg_info //test/svn/Demo/branches/HelloWorld/Batch
hope it is useful for you.
iaav
June 20, 2013, 9:32am
19
tried this but it's restricted to file path if modified - 'M'. The path can also be 'A' or 'D'
Try:
awk -F/ 'NF>1 && /[MAD] \//{print $(NF-1) FS $NF}'