Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r70 - branches/SOPTIM/src/tsvnWizard.pas

delphiaddinfortortoisesvn
Discussion topic

Hide all messages in topic

All messages in topic

svn commit: r70 - branches/SOPTIM/src/tsvnWizard.pas

Author otto_noll
Full name Otto Noll
Date 2009-01-15 05:17:21 PST
Message Author: otto_noll
Date: 2009-01-15 05:17:20-0800
New Revision: 70

Modified:
   branches/SOPTIM/src/​tsvnWizard.pas

Log:
Add "Rename" to context menu.

Modified: branches/SOPTIM/src/​tsvnWizard.pas
Url: http://delphiaddinfo​rtortoisesvn.tigris.​org/source/browse/de​lphiaddinfortortoise​svn/branches/SOPTIM/​src/tsvnWizard.pas?v​iew=diff&pathrev​=70&r1=69&r2​=70
====================​====================​====================​==================
--- branches/SOPTIM/src/​tsvnWizard.pas (original)
+++ branches/SOPTIM/src/​tsvnWizard.pas 2009-01-15 05:17:20-0800
@@ -4,7 +4,7 @@
 
 interface
 
-uses ToolsAPI, SysUtils, Windows, Dialogs, Menus, Registry, ShellApi,
+uses ToolsAPI, SysUtils,StrUtils, Windows, Dialogs, Menus, Registry, ShellApi,
     Classes, Controls, Graphics, ImgList, ExtCtrls, ActnList,Forms;
 type
     ESVNFeature = (
@@ -38,6 +38,7 @@
         SVN_GRAPH,
         SVN_LOCK,
         SVN_LOG,
+ SVN_RENAME,
         SVN_MERGE,
         SVN_PROPERTIES,
         SVN_DELETE,
@@ -294,7 +295,9 @@
   popup: TPopupMenu;
   submenu:TMenuItem;
   files: TStringList;
+ currentfilename:String;
 begin
+ currentfilename := (BorlandIDEServices as IOTAModuleServices).​CurrentModule.ShowFi​lename;
     popup:= sender as TPopupMenu;
     submenu := popup.FindComponent(​'TortoiseSVN_popmenu​') as TMenuItem;
     files:= TStringList.create;
@@ -340,6 +343,10 @@
       (submenu.FindCompone​nt('ESVNFeature_'+in​ttostr(ord(SVN_UPDAT​E))) as TMenuItem).Enabled := true;
       (submenu.FindCompone​nt('ESVNFeature_'+in​ttostr(ord(SVN_UPDAT​E_TO))) as TMenuItem).Enabled := true;
     end;
+ if (files.Count > 0) and not (SVNPath = '') and not (ExtractFileExt(curr​entfilename) = '.dproj') and not (ExtractFileExt(curr​entfilename) = '.dpr') then
+ begin
+ (submenu.FindCompone​nt('ESVNFeature_'+in​ttostr(ord(SVN_RENAM​E))) as TMenuItem).Enabled := true;
+ end;
 end;
 
 destructor TTortoiseSVN.Destroy;
@@ -431,6 +438,8 @@
             Result:= 'unlock';
         SVN_UPDATE:
             Result:= 'update';
+ SVN_RENAME:
+ Result:= 'rename';
         SVN_UPDATE_TO:
             Result:= 'update';
     end;
@@ -515,6 +524,8 @@
             Result:= 'Tag...';
         SVN_UNLOCK:
             Result:= 'Unlock...';
+ SVN_RENAME:
+ Result:= 'Rename...';
         SVN_UPDATE:
             Result:= 'Update...';
         SVN_UPDATE_TO:
@@ -572,6 +583,8 @@
               Result := vsEnabled;
         SVN_ADD:
             ;// this verb state is updated by TTortoiseSVN.CheckOn_Popup
+ SVN_RENAME:
+ ;// this verb state is updated by TTortoiseSVN.CheckOn_Popup
         SVN_BLAME:
             ;// this verb state is updated by TTortoiseSVN.CheckOn_Popup
         SVN_BRANCH:
@@ -695,11 +708,29 @@
 
 procedure TTortoiseSVN.ExecuteVerb(Index: ESVNFeature);
 var project: IOTAProject;
- i: integer;
- filestringbuff: string;
+ i,modulecount: integer;
+ oldfilename,newfilen​ame,filestringbuff: string;
 begin
     project:= GetCurrentProject();
     case index of
+ SVN_RENAME:
+ if project <> nil then
+ begin
+ newfilename:=InputBox('Rename '+GetCurrentModuleFi​leList(TStringList.c​reate)[0],'The file will be saved before rename.'+#13#10+'To Continue insert the new Filename and press Ok','');
+ if not (newfilename = '') then
+ begin
+ SaveForegroundEditorFile();
+ oldfilename:= GetCurrentModuleFile​List(TStringList.cre​ate)[0];
+ newfilename:= ExtractFilePath(oldf​ilename)+newfilename​;
+ modulecount:= (BorlandIDEServices as IOTAModuleServices).​CurrentModule.OwnerM​oduleCount;
+ for i := 0 to modulecount - 1 do
+ begin
+ (BorlandIDEServices as IOTAModuleServices).​CurrentModule.GetOwn​er(i).Rename(oldfile​name,newfilename);
+ end;
+ RenameFile(newfilena​me,oldfilename);
+ SVNExec(' move '+ oldfilename +' '+newfilename );
+ end;
+ end;
         SVN_EXPLORE_SANDBOX:
             if project <> nil then
                 ShellExecute( 0, 'open', pchar( ExtractFilePath(proj​ect.GetFileName) ), '', '', SW_SHOWNORMAL );
Messages per page: