• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
02.28.13 WANDisco SVN Training: Getting Info Out of SVN
 

02.28.13 WANDisco SVN Training: Getting Info Out of SVN

on

  • 1,929 views

Date: February 28 2013 ...

Date: February 28 2013

Abstract: Need to build a report based on your Subversion project? This free-to-attend online training will share techniques for extracting information from Subversion, for reporting purposes.

Topics include:
- Difference information
- Using Project and User information
- Using Hook scripts to log information

Mike, a 33 year veteran of the software industry, has spent the past 26 years delivering consulting and training services for Subversion and other software configuration management systems. He has taught over 700 classes covering various aspects of implementing and using Subversion and other SCMs.

Mike is currently WANdisco’s Director of Subversion Training.

Statistics

Views

Total Views
1,929
Views on SlideShare
785
Embed Views
1,144

Actions

Likes
0
Downloads
42
Comments
0

5 Embeds 1,144

http://www.wandisco.com 979
http://webstage.wandisco.com 162
http://wwwec2.wandisco.com 1
http://10.2.4.113 1
http://d628.wandisco.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 1 Click
  • 3 Click
  • 1 Click
  • 5 Click
  • 1 Click
  • 1 Click
  • 1 Click
  • 3 Clicks
  • 2 Clicks
  • 3 Clicks
  • 3 Clicks
  • 1 Click

02.28.13 WANDisco SVN Training: Getting Info Out of SVN 02.28.13 WANDisco SVN Training: Getting Info Out of SVN Presentation Transcript

  • Getting Information Out OfSubversion We will begin in a few moments
  • Getting Information Out OfSubversion
  • Outline • Log information • Property information ▫ Log and Properties demonstration • Difference information • Using Project and User information • Using Hook scripts to log information ▫ Hook script demonstration 3
  • This training is done with the latestTortoiseSVN Version http://www.wandisco.com/subversion/os/downloads
  • Extracting information out of the repository Use the log command Use a hook script Use the Subversion API’s Third party tools
  • Subversion API svn_client_proplist3 6
  • Output from Log Command Revision: 29 Author: Mike Date: 3:53:04 PM, Sunday, May 08, 2011 Message: QA Level:Change User Doc: ---- Modified : /BankDocSystem/trunk/auditbuild.asp Revision: 29 Author: Mike Modified : /BankDocSystem/trunk/borrowerdeleteconfirm.asp Date: 3:53:04 PM, Sunday, May 08, 2011 Message: Revision: 28 QA Level:Change User Doc: Author: Mike ---- Modified : /BankDocSystem/trunk/auditbuild.asp Date: 10:44:41 AM, Wednesday, May 04, 2011 Modified : /BankDocSystem/trunk/borrowerdeleteconfirm.asp Message: QA Level:unitChange User Doc:No Revision: 28 Author: Mike ---- Date: 10:44:41 AM, Wednesday, May 04, 2011 Modified : /BankDocSystem/trunk Message: Modified : /BankDocSystem/trunk/Stored Procedures QA Level:unitChange User Doc:No ---- Modified : /BankDocSystem/trunk/images Modified : /BankDocSystem/trunk Modified : /BankDocSystem/trunk/include Modified : /BankDocSystem/trunk/Stored Procedures Modified : /BankDocSystem/trunk/include/javascript : /BankDocSystem/trunk/images Modified Modified : /BankDocSystem/trunk/reports Modified : /BankDocSystem/trunk/include Modified : /BankDocSystem/trunk/include/javascript Modified : /BankDocSystem/trunk/reports Revision: 27 Author: Mike Revision: 27 Author: Mike Date: 10:42:08 AM, Wednesday, May 04, 2011 10:42:08 AM, Wednesday, May 04, 2011 Date: Message: Message: Cntrl added copyright and owner ---- ---- C added copyright and owner Modified : /BankDocSystem/trunk Modified : /BankDocSystem/trunk Modified : /BankDocSystem/trunk/Stored Procedures Modified : /BankDocSystem/trunk/Stored Procedures /BankDocSystem/trunk/images Modified : Copy and place Modified : /BankDocSystem/trunk/images in a text file 7
  • M /BankDocSystem/trunk sourceBankDocSystem>svn log -v M /BankDocSystem/trunk/Stored Procedures M /BankDocSystem/trunk/images M /BankDocSystem/trunk/includeOutput from Command Line Log Command M /BankDocSystem/trunk/include/javascript M /BankDocSystem/trunk/reports QA Level:unit svn log -v Change User Doc:No ------------------------------------------------------------------------ r27 | Mike | 2011-05-04 10:42:08 -0600 (Wed, 04 May 2011) | 1 line Changed paths: M /BankDocSystem/trunk M /BankDocSystem/trunk/Stored Procedures M /BankDocSystem/trunk/images M /BankDocSystem/trunk/include M /BankDocSystem/trunk/include/javascript M /BankDocSystem/trunk/reports added copyright and owner ------------------------------------------------------------------------ r26 | Mike | 2011-05-04 10:40:26 -0600 (Wed, 04 May 2011) | 1 line Changed paths: M /BankDocSystem/trunk M /BankDocSystem/trunk/Stored Procedures M /BankDocSystem/trunk/images M /BankDocSystem/trunk/include M /BankDocSystem/trunk/include/javascript A /BankDocSystem/trunk/privacyPolicy.asp M /BankDocSystem/trunk/reports added a new file 8
  • sourceBankDocSystem>svn log -vOutput from Command Line Log Command The log command can use the option: --with-no-revprops --with-all-revprops --with-revprop AUTHOR svn log file:///c:/bcd/trunk -v svn log file:///c:/bcd/trunk/sort.asp -v svn log file:///c:/bcd/trunk/ sort.asp tune.cpp -v svn log –v 25:18 svn log –v 18:25 9
  • sourceBankDocSystem>svn log -vFiltering the log command by date range C:UsersMike>svn log file:///c:/devvc -r {2011-05-11}:{2011-03-13} ------------------------------------------------------------------------ You can specify r25 | Mike | 2011-03-13 07:00:04 -0600 (Sun, 13 Mar 2011) | 1 line a date range Fixed Bug #284 ------------------------------------------------------------------------ r24 | Mike | 2011-03-13 06:59:11 -0600 (Sun, 13 Mar 2011) | 1 line Fixed Bug #2214 ------------------------------------------------------------------------ r23 | Mike | 2011-03-13 06:58:26 -0600 (Sun, 13 Mar 2011) | 2 lines Finished with Enhancement 227F svn log file:///c:/devvc -r {2011-05-11}:{2011-03-13} ------------------------------------------------------------------------ r22 | Mike | 2011-03-13 06:57:42 -0600 (Sun, 13 Mar 2011) | 2 lines Working on db struct Enhancement 227F ------------------------------------------------------------------------ r21 | Mike | 2011-03-13 06:57:01 -0600 (Sun, 13 Mar 2011) | 2 lines Woring on db struct Enhancement 227F ------------------------------------------------------------------------ r20 | Mike | 2011-03-13 06:54:07 -0600 (Sun, 13 Mar 2011) | 1 line Creating branch to update db structure to take advantage of new indexing ------------------------------------------------------------------------ r19 | Mike | 2011-03-13 06:52:09 -0600 (Sun, 13 Mar 2011) | 1 line Fixed Bug #321 ------------------------------------------------------------------------ r18 | Frank | 2011-03-12 09:55:32 -0700 (Sat, 12 Mar 2011) | 1 line Working on Feature #123 ------------------------------------------------------------------------ 10
  • Showing additional columns on “Check for modifications” You can add columns of properties used in any of the objects 11
  • Showing additional columns on “Check for modifications” Select columns to show By default the columns are added to the end of the set of columns – you can drag them anywhere 12
  • Unified-diff format This format is used by many different version control systems.
  • Unified-diff format This format is used by many different version control systems.
  • Repository Information – The log command The LOG command reports on log messages from a repository C:sourcetestpayroll>svn log file:///C:/repository/payroll -v You can filter on ------------------------------------------------------------------------ - Projects r4 | Mike | 2010-11-27 07:16:20 -0700 (Sat, 27 Nov 2010) | 1 line Changed paths: - Revision D /payroll/colors.txt - Date A /payroll/common/emails.txt M /payroll/common/mrtechie.htm Fixed bug #449 ------------------------------------------------------------------------ r3 | Mike | 2010-11-27 07:15:19 -0700 (Sat, 27 Nov 2010) | 2 lines Changed paths: M /payroll/days.txt A /payroll/scluc_3_wd/test.js Modified sort routine German sort now works ------------------------------------------------------------------------ r2 | Mike | 2010-11-27 07:14:30 -0700 (Sat, 27 Nov 2010) | 1 line Changed paths: M /payroll/numbers.txt M /payroll/scluc_3_wd/scl_3_wd.html Fixed bug #442 ------------------------------------------------------------------------
  • Repository Information – Making log info more useful The LOG command output can be made into XML C:sourcetestpayroll>svn log file:///C:/repository/payroll -v --xml <?xml version="1.0"?> <log> <logentry revision="4"> There are many <author>Mike</author> <date>2010-11-27T14:16:20.503414Z</date> ways to import <paths> <path XML into kind="file" databases action="D">/payroll/colors.txt</path> <path kind="file" action="M">/payroll/common/mrtechie.htm</path> <path kind="file" action="A">/payroll/common/emails.txt</path> </paths> <msg>Fixed bug #449</msg> </logentry>
  • Using log info from SQL There are only two tables you need to create CREATE TABLE logentry( revisionNumber int, revisionAuthor nvarchar(50) , revisionDate datetime, dateAdded datetime NULL, revisionLogMsg nvarchar(max) ) ParseSubversion CREATE TABLE path( revisionNumber int , pathKind nchar10) , pathAction nchar(10), pathString nvarchar(max), pathCopyfromPath nvarchar(max), pathCopyfromRev nchar(10) , dateAdded datetime)
  • Using log info from SQL Then you can do any type reporting or analysis you desire
  • Using log info from SQL To see how the number of commits change about a project SELECT MONTH(revisionDate) as Month, YEAR(revisionDate) as Year, COUNT(*) as No. of Revisions FROM logentry GROUP BY MONTH(revisionDate), YEAR(revisionDate)
  • Using log info from SQL To see who is making the most commits SELECT count(*) as # of Commits, revisionAuthor as Author FROM logentry group by revisionAuthor CraigA Number of Commits Frank 400 EliM 300 MathewT 200 SvnIntegra 100 tion Bob 0 Developers Susan
  • Another Output Example – Code Reviews The problem • We have a standard of doing code reviews on development work • We need to mark which code should be reviewed and who should do reviews • We need a report showing • Which code needs to be reviewed • Who should do the reviews • Which code has been marked as “to be reviewed” but no one was assigned to review the code
  • Another Output Example – Code Reviews Mark which code should be reviewed
  • Another Output Example – Code Reviews Mark who should review the code
  • Another Output Example – Code Reviews Mark which code has been reviewed
  • Now we need a report to tell people what to do What has to be reported Which files do not have the properties CodeReviewed and CodeReviewer Which files in the last week (month) changed from CodeReviewed = NO to CodeReviewed = ReadyForReview Which files have been set to CodeReviewed = YES for over 6 weeks
  • Hook script workshopEvery hook script should start with a policy and a procedure Policy : Any changes to Log messages must be logged. Procedure : Contact the Subversion administrator and tell them what was changed. 26
  • Hook script workshop WHY DO WE CARE ABOUT THE POLICY “Any changes to Log or Author properties must be logged.” If we verify changes, and the log Some log information triggers Sometimes people type things messages change how do we events or is moved to incorrectly know if the Audit is valid. Issue/Bug/Planning systems 27
  • Hook script workshop We need to have some way of making sure the changes to Log Messages are OK Options Have Have Periodically Only allow Only allowpermissions Only allowpermissions make lists of administrators administrators change to change administrators to all logs and to change logslogs be to change logs to change logslogs be compare turned on/off turned on/off 28
  • Hook script workshop Or turn the control over to a hook script Steps • Which hook script • What language • Write some code • Test it • Implement it 29
  • Hook script workshop pre-revprop-change Which hook script ? This runs before any changes Must exist and return 0 to allow changes start-commit pre-unlock post-revprop-change pre-revprop-change pre-revprop-change This runs after any changes pre-lock used to create a file Can be This runs before any changes or pre-commit and return 0 to allow changes Must exist Email information post-unlock Will not run unless the pre-revprop-change post-revprop-change hook exists post-lock after any changes This runs post-commit 30
  • Hook Scripts - post-revprop-change post-revprop-change  This is run immediately after the revision property change  Will not run unless the pre-revprop-change hook is run successfully  Input parameters : • Repository path • Name of revision whose property is about to be modified Common Uses • Username attempting the property Send an email change notification that the • Name of the property property has been • Name of change A (added), changed D (deleted), or M (modified) 31
  • Hook script workshop Which language ? Batch file Python Perl Windows script (Javascript) Any EXE As long as it can be passed parameters and return an error code Any code, if initiated by a BAT file 32
  • Hook script workshop Plan your programSubversion Post-revprop-change.bat Post-revprop-change.js Log File Get log message Repository 33
  • Hook script workshop Where does the log file go ?Post-revprop-change.js Log File function writefile(textToWrite,repPath) { var fso=new ActiveXObject("Scripting.FileSystemObject"); var txtFile=fso.OpenTextFile(repPath + "post-reprop-change.log",8,true,0); var str=textToWrite;txtFile.WriteLine(str); txtFile.Close(); } 34
  • Hook script workshop What should the log file output be? ------Sun Feb 27 15:16:27 MST 2011------ Repository path=C:demoAdminLock Revision=7 It also could be User=MIke Modified Property=svn:log Log File Action=M -tab delimited -comma separated Old log message=fixed bug 12321 see feature 1881 New log message=fixed bug 12321 see feature 1889 02272011-15:16:27,”C:demoAdminLock “,7,”MIke “,”svn:log”,”M“,”fixed bug 12321 see feature”,”fixed bug 12321 see feature 1889” ------Sun Feb 27 15:17:49 MST 2011------ Repository path=C:demoAdminLock 02172011-07:12:33,”C:demoAdminLock “,4,”MIke “,”svn:log”,”M“,” made a copy of trunk into Revision=6 tags/rel 1.0”,” made a copy of trunk into tags/rel 1.0/0D/0ARelease sent to QA - 2/23/2011“ User=MIke Modified Property=svn:log Action=M Old log message=made a copy of trunk into tags/rel 1.0 New log message=made a copy of trunk into tags/rel 1.0 Release sent to QA - 2/23/2011 35
  • Edit The File Now you need to do some Check out programming. Going through whatever development steps are Commit Edit your standards. Update And use Subversion for version control. Test Edit Edit Test 36
  • And we have a new policy and procedure Policy : All changes to Log properties must be reviewed weekly. Procedure : The administrator will review the log file for “Changed Log Messages” every week and report anything suspicious to the project leaders. The log files are in ………… Contact the managers by email ……… 37
  • Other hook script output examples Policy : All branches that are classified as READY-TO-MERGE must be tested by the QA department. Policy : All changes to projects classified as inactive must be reviewed by a project manager. 38
  • Conclusions 1. Decide which outputs will help you manage your development efforts. 2. Design procedures or programs to create reports. 3. Train staff on what will be reported. 39
  • Michael LesterCopyright © 2011 Wandisco All rights reserved. 40