[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Command Line Update with TSvn for VS

From: Nick Gilbert <nick_at_x-rm.com>
Date: 2005-11-07 16:06:23 CET

> Here's a script that appeared earlier on one of these mailing lists
> for traversing a file system subtree and renaming _svn to .svn and
> visa versa.

Why would someone spend ages writing a massive javascript file to do
something you can do in 4 lines in a .bat file?:

FOR /R %%f IN (_SVN) DO IF EXIST "%%f" (
     ATTRIB -h "%%f"
     RENAME "%%f" _svn
     ATTRIB +h "%%f"
)

Some people have too much free time on their hands....

Nick...

Stuart Celarier wrote:
> Michael,
>
> Here's a script that appeared earlier on one of these mailing lists for traversing a file system subtree and renaming _svn to .svn and visa versa.
>
> Cheers,
> Stuart
>
> Stuart Celarier | Corillian Corporation
>
> ----
> var response = WScript.StdOut;
> var request = WScript.StdIn;
> var path = ".";
> var showWork = false;
> var toUnderscore = true;
> var toDot = true;
> var toUnderscoreTotal = 0;
> var toDotTotal = 0;
> var fso = new ActiveXObject("Scripting.FileSystemObject");
>
> main();
>
> function main()
> {
> GetArgs();
>
> if(fso.FolderExists(path))
> {
> recurse(fso.GetFolder(path));
> response.WriteLine("");
> if(toUnderscore)
> response.WriteLine(toUnderscoreTotal + " folders renamed to _svn.");
> if(toDot)
> response.WriteLine(toDotTotal + " folders renamed to .svn.");
>
> response.WriteLine("");
> }
> else
> response.WriteLine("Invalid path: " + path);
> }
>
> function GetArgs()
> {
> for(i = 0; i < WScript.Arguments.length; i++)
> {
> var flg = WScript.Arguments(i).toLowerCase();
> switch(flg)
> {
> default :
> path = flg;
> break;
> case ".2_" :
> toUnderscore = true;
> toDot = false;
> break;
> case "_2." :
> toUnderscore = false;
> toDot = true;
> break;
> case "/s" :
> showWork = true;
> break;
> case "/show" :
> showWork = true;
> break;
> case "/?" :
> ShowUsage();
> break;
> case "/h" :
> ShowUsage();
> break;
> case "/help" :
> ShowUsage();
> break;
> case "help" :
> ShowUsage();
> break;
> case "-h" :
> ShowUsage();
> break;
> case "--h" :
> ShowUsage();
> break;
> case "--help" :
> ShowUsage();
> break;
> }
> }
> }
>
> function recurse(dir)
> {
> if(showWork)
> response.WriteLine("Checking: " + dir.Name);
> switch(dir.Name)
> {
> default :
> // Get any sub folders to current directory
> // Loop through sub folders
> for(esub = new Enumerator(dir.SubFolders); !esub.atEnd(); esub.moveNext())
> recurse(fso.GetFolder(esub.item()));
> break;
> case ".svn" :
> if(toUnderscore)
> {
> if(showWork)
> response.WriteLine(dir.Path);
> dir.Move(dir.ParentFolder + "\\_svn");
> toUnderscoreTotal++;
> }
> break;
> case "_svn" :
> if(toDot)
> {
> if(showWork)
> response.WriteLine(dir.Path);
> dir.Move(dir.ParentFolder + "\\.svn");
> toDotTotal++;
> }
> break;
> }
> }
>
> function ShowUsage()
> {
> response.WriteLine("Basic script to rename ?svn folders.");
> response.WriteLine("");
> response.Write(WScript.ScriptName);
> response.Write(" [drive:][path][filename]");
> response.Write(" [ .2_ | _2. ]");
> response.Write(" [ /s(how) ]");
> response.WriteLine("");
> response.WriteLine("");
> response.WriteLine(" [drive:][path][filename]");
> response.WriteLine(" Specifies drive, directory, and/or files to list.");
> response.WriteLine(" .2_");
> response.WriteLine(" Renames .svn to _svn.");
> response.WriteLine(" _2.");
> response.WriteLine(" Renames _svn to .svn.");
> response.WriteLine(" /s /show");
> response.WriteLine(" Displays path of folders being renamed.");
> response.WriteLine("");
> response.WriteLine(" If neither .2_ nor _2. are specified both will be done (toggle).");
> response.WriteLine("");
> WScript.Quit();
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
> For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
>

-- 
________________________________
Nick Gilbert, Software Developer
X-RM Limited, Winchester, UK
W: http://www.x-rm.com/
E: nick@x-rm.com
T: 01962 877237
F: 01962 842346
________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Mon Nov 7 16:08:23 2005

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.