RE: Command Line Update with TSvn for VS
From: Stuart Celarier <SCelarier_at_corillian.com>
Date: 2005-11-04 18:41:56 CET
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 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.orgReceived on Fri Nov 4 18:42:58 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.