Skip to content

Commit

Permalink
Remove reference to TortoiseSVN (issue #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansani committed Nov 21, 2022
1 parent c777c2c commit 24ad285
Showing 1 changed file with 14 additions and 42 deletions.
56 changes: 14 additions & 42 deletions shareaza/revision.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,30 @@
// This scipt compares current directory revision and revision saved in
// revision.h file using TortoiseSVN COM-interface.

// #TODO: Fix the revision

var fso = WScript.CreateObject( "Scripting.FileSystemObject" );
var fpath = fso.GetAbsolutePathName( "." )
var fname = fso.GetAbsolutePathName( "revision.h" );

var revision, date, changed;
try
{
var rev = new ActiveXObject( "SubWCRev.object" );
rev.GetWCInfo( fpath, 0, 0 );
revision = rev.Revision;
changed = rev.HasModifications;
revision += changed ? "M" : "";
date = rev.Date;
WScript.Echo( "Current revision \"" + revision + "\" at \"" + date + "\"");
}
catch(e)
{
WScript.Echo( "TortoiseSVN COM-interface failed. (Re)Install it from: http://tortoisesvn.net/" );
WScript.Quit( 1 );
}
var date = Date.now;
var revision = "TODO:FIX"

var modified;
try
{
var tsr = fso.OpenTextFile( fname, 1, false );
modified = tsr.ReadLine().substr( 7 ); // Parsing "// rev.XXXXX"
tsr.Close();
var tsw = fso.OpenTextFile( fname, 2, true );
tsw.WriteLine( "// rev." + revision );
tsw.WriteLine( "" );
tsw.WriteLine( "#pragma once" );
tsw.WriteLine( "" );
tsw.WriteLine( "#define __REVISION__\t\t\"" + revision + "\"" );
tsw.WriteLine( "#define __REVISION_DATE__\t\"" + date + "\"" );
tsw.Close();
}
catch(e)
{
WScript.Echo( "Update failed: \"" + fname + "\"" );
WScript.Quit( 1 );
}
if ( revision != modified )
{
WScript.Echo( "Updating from \"" + modified + "\" to \"" + revision + "\"...");
try
{
var tsw = fso.OpenTextFile( fname, 2, true );
tsw.WriteLine( "// rev." + revision );
tsw.WriteLine( "" );
tsw.WriteLine( "#pragma once" );
tsw.WriteLine( "" );
tsw.WriteLine( "#define __REVISION__\t\t\"" + revision + "\"" );
tsw.WriteLine( "#define __REVISION_DATE__\t\"" + date + "\"" );
tsw.Close();
}
catch(e)
{
WScript.Echo( "Update failed: \"" + fname + "\"" );
WScript.Quit( 1 );
}
}
else
WScript.Echo( "Already up to date." );

WScript.Quit( 0 );

0 comments on commit 24ad285

Please sign in to comment.