Visit Our UNIX and Linux User Community


gets all files details committed to svn by a particular user [or all users] since a particular date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting gets all files details committed to svn by a particular user [or all users] since a particular date
# 1  
Old 12-22-2011
Tools gets all files details committed to svn by a particular user [or all users] since a particular date

Here is a shell for printing committed person's:
1. Revision number
2. Name
3. Date of commit
4. Files committed.
5. committing comment
6. Date


I just made for my usage. May be helpful for you too.

Do as follows.

create a file
$ vi svn_get_user_committed_files_details.sh
press i
then copy & paste the following as it is. And then make the shell executable with the command chmod.
[Don't forget to change PROJECT path. Smilie]

Usage :
$ sh svn_get_user_committed_files_details.sh anySvnUName
or
$ sh svn_get_user_committed_files_details.sh
Code:
#!/bin/bash
#######Things need to change######### [
PROJECT="/home/smily/workspace/MyProj"
#Date format should be YYYY-MM-DD
DateFrom="2011-12-20"
#DateTo can be in YYYY-MM-DD or HEAD
DateTo="HEAD"
#######Things need to change######### ]

svnfile_log_all="/tmp/svnfile_log_all.txt"
svnListUNames="/tmp/svnListUNames.txt"
svnUserCommitted="/tmp/svnUserCommitted.txt"
uName="$1"

[ $DateTo == "HEAD" ] && DateFromTo="-r {$DateFrom}:HEAD" || DateFromTo="-r {$DateFrom}:{$DateTo}"
[ -f $svnfile_log_all ] && rm -f $svnfile_log_all
[ -f $svnListUNames ] && rm -f $svnListUNames
[ -f $svnUserCommitted ] && rm -f $svnUserCommitted

echo -e "\nPlease wait..\n"
svn log $DateFromTo -v $PROJECT > $svnfile_log_all

if [ -z $uName ]; then
cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./ {print user} ' | grep -v "^$" |sort | uniq >> $svnListUNames
else
  if [ `cat $svnfile_log_all | grep "$uName" | wc -l` -gt "0" ]; then
          echo $uName > $svnListUNames 
  else
          echo -e "\n>>>>>user: $uName not committed any files.<<<<<" 
          exit 0
  fi
fi

echo -e "\n\nRepo Name: `cat $PROJECT/.svn/entries | grep "http://" | head -1`" >> $svnUserCommitted

while read uName
do 
echo -e "\n$uName committed files\n======================" >> $svnUserCommitted
cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./{if (user==uName) {print}}' | grep -E "^   M|^   G|^   A|^   D|^   C|^   U" | awk '{print $2}' | sort >> $svnUserCommitted

echo -e "\n\nIn Detail:\n==========" >> $svnUserCommitted
cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./{if (user==uName) {print}}' >> $svnUserCommitted
echo -e "\n"
done < $svnListUNames

echo -e "Log is in : $svnUserCommitted\n"
cat $svnUserCommitted

Changes / suggestions expected .. Smilie
# 2  
Old 12-22-2011
Very confusing

Are you asking for help to fix something?
Nice to proactively share a script; however, many (most, and maybe all) probably will not understand its purpose. Without input and output, whatever 'magic' this script does is lost.
# 3  
Old 12-22-2011
@linuxadmin,

Thanks for sharing the script.

Some of the changes you need to do for the script.


Code:
Dont use cat and awk together


cat $svnfile_log_all | awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./ {print user} '

change it to

awk -v uName=$uName '/^r[0-9]+ / {user=$3} /./ {print user} ' $svnfile_log_all



Code:
dont use cat and grep

cat $PROJECT/.svn/entries | grep "http://"

change it to

grep "http://" $PROJECT/.svn/entries

Code:
cat, grep , wc --- you can do it by grep -c

`cat $svnfile_log_all | grep "$uName" | wc -l`

change it to

grep -c $uName $svnfile_log_all


Code:
|sort | uniq 

change it to

sort -u

Code:
cat $PROJECT/.svn/entries | grep "http://" | head -1

change it to

awk  '/http:\/\// {print; exit}'  $PROJECT/.svn/entries

# 4  
Old 12-23-2011
@itkamaraj ,

Thanks a lot. I use all the mistakes you told in all my shell. I will change it. Thanks again.

@joeyg,

Yes. You are right; little confusing for those who dont know about it. Neo also told the same thing; about input n output. Here after i will follow it, if i post a script like this.
I am not asking anybody to fix anything. Sorry to confuse you. Just posted this script, as I searched hard to get this info , mostly all about svn and it was a failure, and thinking it may help @least some one!!.

Last edited by linuxadmin; 12-23-2011 at 01:24 AM.. Reason: Added some words...

Previous Thread | Next Thread
Test Your Knowledge in Computers #770
Difficulty: Medium
IBM POWER4 (2001) had off-chip L3 caches of 32 MB per processor, shared among several processors.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Making post down hook script for svn regarding sending emails after an file is committed in svn

Hi Folks , I am asking this question but i apologise please if this is not the correct forum , I have to develop a shell script that i want to place in at hooks/post-commit , that is basically i have to develop a post hook script and the main functionality of that script would be lets say if... (0 Replies)
Discussion started by: sunsun06060606
0 Replies

2. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code: archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (0 Replies)
Discussion started by: rehantayyab82
0 Replies

3. Shell Programming and Scripting

History of all the users in single file with command , date . time , ip and user

HTML Code archive_history() { HISTORYOLD=${HISTFILE}.archive CURTIME=`date` CURTTY=`tty` IP=$(echo $SSH_CLIENT | awk '{print $1}') if ; then echo "#-${HOSTNAME}-- ${CURBASHDATE} - ${CURTIME} ($CURTTY) ${USER} ${IP}----" >> $HISTORYOLD history... (2 Replies)
Discussion started by: rehantayyab82
2 Replies

4. Shell Programming and Scripting

To get the files in a directory for the given date (User entered date)

Need a ksh script to get the files that were created or modified in a directory on a particular date entered by the user. For example if a directory contains files as below : > ll total 41 -rw-rw-r-- 1 psn psn 199 Aug 23 07:06 psn_roll.sh -rw-rw-r-- 1 psn psn ... (10 Replies)
Discussion started by: ramprabhum
10 Replies

5. Solaris

How to integrate SVN client to SVN server repository.

Hi, I am new to SVN configuration on Solaris 10.I have installed SVN client version 1.7. bash-3.00# ./svn --version svn, version 1.7.4 (r1295709) compiled Mar 2 2012, 12:59:36 Here my requirement is how to integrate svn client to One of the SVN server repository. My repository... (0 Replies)
Discussion started by: muraliinfy04
0 Replies

6. UNIX and Linux Applications

SVN user permissions trouble

I am trying to add a user to my SVN server that can only access one of about a dozen repositories I have set up. Here are the files that I think need changed and what I have set them to. No matter what I try with these files I am unable to see the results I am after. In the end I want this new... (0 Replies)
Discussion started by: benn600
0 Replies

7. Solaris

Command History for a user with IP details

Hi We are sharing our envoirnment with our component teams. the plateform is SunOS 5.8 Generic_117350-41 sun4u sparc SUNW,Sun-Fire-V490. All team logs in the domain with same user and perform activities. Now for the system auditing purpose can somebody guide me how can I get the details when... (6 Replies)
Discussion started by: sukhvinder_Tm
6 Replies

8. Shell Programming and Scripting

SVN activity of certain user

Hi there, I'm looking for some help to get a little script done that shows me (or counts) only the added lines from an SVN repository of one specific user. Anybody has an idea? Thanks, Michael (0 Replies)
Discussion started by: MichaelGiese
0 Replies

9. Solaris

user logon details

how can i identifying whose are logged in last few days,time and date also want. what i will do for get that information (2 Replies)
Discussion started by: sijocg
2 Replies

10. Shell Programming and Scripting

Selecting files between a user inputed date range

Hi all! I'm working on a KSH script to select files between a user inputed date range (stored in a variable) and then move them and unzip them. I'm stuck at how to get the files between the user inputed date range selected. Any help would be greatly appreciated! The files are as such: ... (6 Replies)
Discussion started by: kelldan
6 Replies

Featured Tech Videos