gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS homebrew announcements > Windows SVN/CVS rename batch script

#140033 - Vich - Wed Sep 12, 2007 10:54 pm

I just created a batch script for renaming files in your repository from the commandline in Windows. I needed this to rename the case of a filename, as TortoiseSVN didn't allow me to do this through its GUI.

You can edit the batch file to make it work with CVS. Just change "projecttype" and "applicationpath". I didn't test it yet with CVS, but it should work.

This script:
- Sets the necessary paths for the cvs/svn application
- Sets the editor for cvs/svn
- Commits the rename change with the info about what was renamed
- Displays a help file when started with ? or --help
- Is completely public domain :)

Usage:
rensfsvn [project_name] [from_path] [to_path]
Sample:
rensfsvn cow trunk/document.TXT trunk/document.txt

This is rensfsvn.bat:
Code:
@echo off

rem ----- configuration -----

  rem Changing the next line to cvs will change the command executed and the target server's path

  set projecttype=svn
  set version=1.0
  set applicationpath=C:\Program Files\Subversion\bin


rem ----- initial comandline checks -----

if %1==? (goto info)
if %1==--help (goto info)
goto main

rem ----- main program -----

:main

echo Setting environment variables ...
set path=%path%;%applicationpath%
set server=https://%1.%projecttype%.sourceforge.net/%projecttype%root/%1/trunk
set SVN_EDITOR=notepad
set EDITOR=notepad

echo Moving:
echo   "%server%/%2"
echo to:
echo   "%server%/%3"
pause
echo Renaming ...
%projecttype% mv %server%/%2 %server%/%3 --message "Renamed %2 to %3" --non-interactive
goto end

rem ----- program info text -----

:info

echo rensfsvn v%version%
echo by Ken Van Hoeylandt
echo.
echo  usage:
echo.
echo    rensfsvn [project_name] [from_path] [to_path]
echo      To ren a SourceForge file.
echo      eg. rensfsvn my_project trunk/Document.txt trunk/Readme.txt
echo.
echo    rensfsvn [? / --help]
echo      To display this help.
echo.

rem ----- program end -----

:end

_________________
[project website] [personal website]