Skip to content

Instantly share code, notes, and snippets.

@nansenat16
Created April 4, 2013 12:39
Show Gist options
  • Save nansenat16/5310034 to your computer and use it in GitHub Desktop.
Save nansenat16/5310034 to your computer and use it in GitHub Desktop.
// this script is a local post-update hook script.
// http://tortoisesvn.googlecode.com/svn/trunk/contrib/hook-scripts/client-side/PostUpdate.js.tmpl
var objArgs,num;
objArgs = WScript.Arguments;
num = objArgs.length;
if (num != 5)
{
WScript.Echo("Usage: [CScript | WScript] PostUpdate.js path/to/pathsfile depth revision error path/to/CWD ");
WScript.Quit(1);
}
var paths = readPaths(objArgs(0));
var rev=objArgs(2);
//WScript.Echo(rev);
var fs = new ActiveXObject("Scripting.FileSystemObject");
var rev_file=paths+"/rev.txt";
/*
WScript.Echo(rev_file);
if(!fs.FileExists(rev_file)){
fs.CreateTextFile(rev_file,true);
}
*/
var f=fs.OpenTextFile(rev_file,2,true);
f.Write(rev);
f.close();
function readPaths(path)
{
var retPaths = new Array();
var fs = new ActiveXObject("Scripting.FileSystemObject");
if (fs.FileExists(path))
{
var a = fs.OpenTextFile(path, 1, false);
var i = 0;
while (!a.AtEndOfStream)
{
var line = a.ReadLine();
retPaths[i] = line;
i = i + 1;
}
a.Close();
}
return retPaths;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment