Jump to content
Ketarin forum

SVN Update Script


Kerberos
 Share

Recommended Posts

I'm not sure how many people actually compile from source, and of those who do, how many get the source from the SVN, but I thought I'd share how I keep my source up to date. I'm actually quite surprised that it all works correctly.

 

I keep a folder on my desktop that is linked to the SVN and update it periodically to get the latest revision of Ketarin. I also keep a folder that contains the CDBurnerXP source files required by Ketarin, as well as the source files from the Win32 folder. Since I'm constantly working on adding things to Ketarin (just for fun, unless Flo is interested) I need a folder with all of the source files in it that I can do with what I please, and I'd prefer it be separate from the SVN folder. So I keep a third folder that is pretty much a copy of the SVN folder, but also contains any changes I've made.

 

The problem I ran into is that every time I updated the SVN folder, I would have to copy any files I'd worked on from the third folder and delete it, copy the SVN folder to a new third folder, copy all of the missing source files (CDBurnerXP, Win32, etc) in, edit the Ketarin.csproj file to fix the references, and then merge my edited files with the newly updated ones. After doing this manually a few times I decided I needed a faster solution. Also, in the event that Flo likes the sound of any of my additions/modifications, I need a way to precisely determine exactly where each piece of my code is and compile a list of modifications.

 

So I set out to automate this annoyingly repetitive task. This is what I came up with:

 

1) Update SVN folder

2) Backup modified files

3) Delete old working folder

4) Run Patch.bat

 

@echo off
Set /P doit=Patch Ketarin Source?^>
if /I not "%doit%"=="Y" GoTo :END
Set /P rev=What revision?^>
md Ketarin_r%rev%
xcopy /E Ketarin Ketarin_r%rev%
md Ketarin_r%rev%\CDBurnerXP\
copy Ketarin_base\CDBurnerXP\ControlRedrawLock.cs Ketarin_r%rev%\CDBurnerXP\ControlRedrawLock.cs
copy Ketarin_base\CDBurnerXP\FormatFileSize.cs Ketarin_r%rev%\CDBurnerXP\FormatFileSize.cs
copy Ketarin_base\CDBurnerXP\GenericEventArgs.cs Ketarin_r%rev%\CDBurnerXP\GenericEventArgs.cs
copy Ketarin_base\CDBurnerXP\ListView.cs Ketarin_r%rev%\CDBurnerXP\ListView.cs
copy Ketarin_base\CDBurnerXP\ObjectListView.cs Ketarin_r%rev%\CDBurnerXP\ObjectListView.cs
copy Ketarin_base\CDBurnerXP\OwnerDrawnMenu.cs Ketarin_r%rev%\CDBurnerXP\OwnerDrawnMenu.cs
copy Ketarin_base\CDBurnerXP\PathEx.cs Ketarin_r%rev%\CDBurnerXP\PathEx.cs
copy Ketarin_base\CDBurnerXP\PersistentForm.cs Ketarin_r%rev%\CDBurnerXP\PersistentForm.cs
copy Ketarin_base\CDBurnerXP\SafeClipboard.cs Ketarin_r%rev%\CDBurnerXP\SafeClipboard.cs
copy Ketarin_base\CDBurnerXP\Separator.cs Ketarin_r%rev%\CDBurnerXP\Separator.cs
copy Ketarin_base\CDBurnerXP\Settings.cs Ketarin_r%rev%\CDBurnerXP\Settings.cs
copy Ketarin_base\CDBurnerXP\VistaMenu.cs Ketarin_r%rev%\CDBurnerXP\VistaMenu.cs
copy Ketarin_base\CDBurnerXP\WebLink.cs Ketarin_r%rev%\CDBurnerXP\WebLink.cs
md Ketarin_r%rev%\Includes\
copy Ketarin_base\Includes\ Ketarin_r%rev%\Includes\
md Ketarin_r%rev%\Win32\
copy Ketarin_base\Win32\IconReader.cs Ketarin_r%rev%\Win32\IconReader.cs
copy Ketarin_base\Win32\Kernel32.cs Ketarin_r%rev%\Win32\Kernel32.cs
copy Ketarin_base\Win32\Shell32.cs Ketarin_r%rev%\Win32\Shell32.cs
copy Ketarin_base\Win32\User32.cs Ketarin_r%rev%\Win32\User32.cs
copy Ketarin_base\Ketarin.csproj Ketarin_r%rev%\Ketarin.csproj
rd /S /Q Ketarin_r%rev%\.svn
rd /S /Q Ketarin_r%rev%\Forms\.svn
rd /S /Q Ketarin_r%rev%\Icon\.svn
rd /S /Q Ketarin_r%rev%\Properties\.svn
rd /S /Q Ketarin_r%rev%\Resources\.svn
rd /S /Q Ketarin_r%rev%\XmlRpc\.svn
:END

 

5) Merge modified files with updated ones

 

I keep a copy of Ketarin.csproj that has all of the fixed references, which I copy into the new folder along with all of the missing source files. I just need to watch for any new source files to be added so I can modify the new Ketarin.csproj and make it the new backup copy.

 

In the event that I need to compile a list of modifications I decided to use 'diff', so I downloaded and installed diffutils. Then I put together this:

 

diff.bat

@echo off
Set /P changes=Create Changes Diff?^>
if /I not "%changes%"=="Y" GoTo :END
Set /P rev=What Revision?^>
"C:\Program Files\diffutils 2.8.7-1\bin\diff.exe" -r -X ex Ketarin "Ketarin_r%rev%" > changes_diff.txt
:END

 

This one is pretty simple. It asks what revision we're at (or it can find the folder) and then runs diff with a list of exclusions (the CDBurnerXP files and other files that are obviously going to be different than the SVN). I can run this before merging my modifications with the SVN files to see exactly which lines of code have been changed since the last revision I updated to, or I can run if after merging in my modifications to create a list of the changes that I've made.

 

I wasn't sure everything was going to work at first, but it works beautifully! Gotta love batch files! =D

Link to comment
Share on other sites

Hm....I don't see why you are having a problem.

 

You'd to the following:

Checkout Ketarin from SVN

Manually copy the CDBXP source files and link them into the project

 

Then, you can modify all files you want and also use the SVN update command to merge any new changes into your local copy. There shouldn't be any problem with that at all. I suppose that you use TortoiseSVN btw?

Link to comment
Share on other sites

Sure do. I'll admit (even though it's fairly obvious) that I don't know how SVN works very well. I thought that if I did an SVN update, it would overwrite any changes that I made. So you're saying that if I use the SVN folder to do my modifications, and then do a checkout, it will merge your changes with mine?

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...

Hi,

 

I managed to get Ketarin's source with TortoiseSvn, however two things :

 

1. the svn:external property for XmlRpc is obsolete:

Error: URL 'http://xmlrpcnet.googlecode.com/svn/branches/release-2-4-0/src' at

Error: revision 105 doesn't exist

 

I've looked up and the correct address is now:

http://xmlrpcnet.googlecode.com/svn/branches/2-4/src/

 

2. where can I find CDBurnerXP files?

Would it be possible to add a svn:external property for them, like you did for XmlRpc?

This would simplify the update process and remove the dependency on the M:\ drive.

Link to comment
Share on other sites

2) They are included in the CDBurnerXP folder. No externals possible currently.
Sorry to bothers you again, but I don't get.

If I do a checkout in a clean folder, the CDBurnerXp files are missing. There's a solution folder (in VS) called CDBurnerXP, that reference files that are supposed to be on M:\CsLib\... but I miss the actual files.

Or do you mean that CDBurnerXP is also open source and that we can get the sources?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.