OSDN Git Service

Fixed issue #183: Append svn:ignore settings to the default git exclude file
authorFrank Li <lznuaa@gmail.com>
Sun, 27 Sep 2009 08:58:09 +0000 (16:58 +0800)
committerFrank Li <lznuaa@gmail.com>
Sun, 27 Sep 2009 08:58:09 +0000 (16:58 +0800)
Add shell extension command to import svn ignore settings.
Need press "Shift" key to show "import svn ignore" command.

Signed-off-by: Frank Li <lznuaa@gmail.com>
13 files changed:
src/Resources/TortoiseProcENG.rc
src/TortoiseProc/Commands/Command.cpp
src/TortoiseProc/Commands/SVNIgnoreCommand.cpp [new file with mode: 0644]
src/TortoiseProc/Commands/SVNIgnoreCommand.h [new file with mode: 0644]
src/TortoiseProc/SVNIgnoreTypeDlg.cpp [new file with mode: 0644]
src/TortoiseProc/SVNIgnoreTypeDlg.h [new file with mode: 0644]
src/TortoiseProc/TortoiseProc.vcproj
src/TortoiseProc/resource.h
src/TortoiseShell/ContextMenu.cpp
src/TortoiseShell/Globals.h
src/TortoiseShell/ShellExt.h
src/TortoiseShell/resource.h
src/TortoiseShell/resourceshell.rc

index 5a942e3..bf0974a 100644 (file)
Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ
index 9f8fc52..fd47660 100644 (file)
@@ -68,6 +68,7 @@
 #include "UpdateCheckCommand.h"\r
 #include "PasteCopyCommand.h"\r
 #include "PasteMoveCommand.h"\r
+#include "SVNIgnoreCommand.h"\r
 \r
 #if 0\r
 \r
@@ -185,6 +186,7 @@ typedef enum
        cmdRefBrowse,\r
        cmdSVNDCommit,\r
        cmdSVNRebase,\r
+       cmdSVNIgnore,\r
        cmdSync,\r
        \r
 } TGitCommand;\r
@@ -264,6 +266,7 @@ static const struct CommandInfo
        {       cmdRefBrowse,           _T("refbrowse")                 },\r
        {       cmdSVNDCommit,          _T("svndcommit")                },\r
        {       cmdSVNRebase,           _T("svnrebase")                 },\r
+       {       cmdSVNIgnore,           _T("svnignore")                 },\r
        {       cmdSync,                        _T("sync")                              },\r
 };\r
 \r
@@ -390,6 +393,8 @@ Command * CommandServer::GetCommand(const CString& sCmd)
                return new PasteCopyCommand;\r
        case cmdPasteMove:\r
                return new PasteMoveCommand;\r
+       case cmdSVNIgnore:\r
+               return new SVNIgnoreCommand;\r
 \r
 #if 0\r
 \r
diff --git a/src/TortoiseProc/Commands/SVNIgnoreCommand.cpp b/src/TortoiseProc/Commands/SVNIgnoreCommand.cpp
new file mode 100644 (file)
index 0000000..d142ad1
--- /dev/null
@@ -0,0 +1,65 @@
+// TortoiseGit - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2007-2008 - TortoiseGit\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#include "StdAfx.h"\r
+#include "SVNIgnoreCommand.h"\r
+\r
+#include "SysProgressDlg.h"\r
+#include "ProgressDlg.h"\r
+#include "MessageBox.h"\r
+#include "RenameDlg.h"\r
+#include "Git.h"\r
+#include "ShellUpdater.h"\r
+#include "CommonResource.h"\r
+#include "SVNIgnoreTypeDlg.h"\r
+\r
+bool SVNIgnoreCommand::Execute()\r
+{\r
+       CSVNIgnoreTypeDlg dlg;\r
+       CProgressDlg progress;\r
+       \r
+       if( dlg.DoModal() == IDOK)\r
+       {\r
+               switch (dlg.m_SVNIgnoreType)\r
+               {\r
+               case 0:\r
+                       progress.m_GitCmd=_T("git.exe svn show-ignore");\r
+                       progress.m_LogFile=g_Git.m_CurrentDir+_T("\\.git\\info\\exclude");\r
+                       progress.m_bShowCommand=false;\r
+                       progress.m_PreText=_T("git.exe svn show-ignore > .git\\info\\exclude");\r
+                       break;\r
+               case 1:\r
+                       progress.m_GitCmd=_T("git.exe svn create-ignore");\r
+                       break;\r
+               default:\r
+                       CMessageBox::Show(NULL,_T("Unkown SVN Ignore Type"),_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                       return FALSE;\r
+               \r
+               }\r
+       }\r
+       \r
+       if(progress.DoModal()==IDOK)\r
+       {\r
+               if( dlg.m_SVNIgnoreType == 0 )\r
+               {\r
+\r
+               }\r
+               return progress.m_GitStatus == 0;\r
+       }\r
+       return false;\r
+}\r
diff --git a/src/TortoiseProc/Commands/SVNIgnoreCommand.h b/src/TortoiseProc/Commands/SVNIgnoreCommand.h
new file mode 100644 (file)
index 0000000..ca9bceb
--- /dev/null
@@ -0,0 +1,35 @@
+// TortoiseGit - a Windows shell extension for easy version control\r
+\r
+// Copyright (C) 2007 - TortoiseGit\r
+\r
+// This program is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU General Public License\r
+// as published by the Free Software Foundation; either version 2\r
+// of the License, or (at your option) any later version.\r
+\r
+// This program is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+// GNU General Public License for more details.\r
+\r
+// You should have received a copy of the GNU General Public License\r
+// along with this program; if not, write to the Free Software Foundation,\r
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+//\r
+#pragma once\r
+#include "Command.h"\r
+\r
+/**\r
+ * \ingroup TortoiseProc\r
+ * Copies dropped items.\r
+ */\r
+class SVNIgnoreCommand : public Command\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute();\r
+};\r
+\r
+\r
diff --git a/src/TortoiseProc/SVNIgnoreTypeDlg.cpp b/src/TortoiseProc/SVNIgnoreTypeDlg.cpp
new file mode 100644 (file)
index 0000000..6c92618
--- /dev/null
@@ -0,0 +1,52 @@
+// SVNIgnoreTypeDlg.cpp : implementation file\r
+//\r
+\r
+#include "stdafx.h"\r
+#include "TortoiseProc.h"\r
+#include "SVNIgnoreTypeDlg.h"\r
+\r
+\r
+// CSVNIgnoreTypeDlg dialog\r
+\r
+IMPLEMENT_DYNAMIC(CSVNIgnoreTypeDlg, CResizableStandAloneDialog)\r
+\r
+CSVNIgnoreTypeDlg::CSVNIgnoreTypeDlg(CWnd* pParent /*=NULL*/)\r
+       : CResizableStandAloneDialog(CSVNIgnoreTypeDlg::IDD, pParent)\r
+       , m_SVNIgnoreType(0)\r
+{\r
+\r
+}\r
+\r
+CSVNIgnoreTypeDlg::~CSVNIgnoreTypeDlg()\r
+{\r
+}\r
+\r
+void CSVNIgnoreTypeDlg::DoDataExchange(CDataExchange* pDX)\r
+{\r
+       CDialog::DoDataExchange(pDX);\r
+       DDX_Radio(pDX, IDC_RADIO_EXCLUDE, m_SVNIgnoreType);\r
+}\r
+\r
+\r
+BEGIN_MESSAGE_MAP(CSVNIgnoreTypeDlg, CResizableStandAloneDialog)\r
+END_MESSAGE_MAP()\r
+\r
+\r
+// CSVNIgnoreTypeDlg message handlers\r
+\r
+BOOL CSVNIgnoreTypeDlg::OnInitDialog()\r
+{\r
+       CResizableStandAloneDialog::OnInitDialog();\r
+\r
+       // TODO:  Add extra initialization here\r
+       AddAnchor(IDC_RADIO_EXCLUDE,  TOP_LEFT);\r
+       AddAnchor(IDC_RADIO_GITIGNORE,TOP_LEFT);\r
+       AddAnchor(IDC_GROUP_TYPE,TOP_LEFT, BOTTOM_RIGHT);\r
+\r
+       AddAnchor(IDOK,BOTTOM_RIGHT);\r
+       AddAnchor(IDCANCEL,BOTTOM_RIGHT);\r
+\r
+\r
+       return TRUE;  // return TRUE unless you set the focus to a control\r
+       // EXCEPTION: OCX Property Pages should return FALSE\r
+}\r
diff --git a/src/TortoiseProc/SVNIgnoreTypeDlg.h b/src/TortoiseProc/SVNIgnoreTypeDlg.h
new file mode 100644 (file)
index 0000000..266ff6c
--- /dev/null
@@ -0,0 +1,24 @@
+#pragma once\r
+#include "StandAloneDlg.h"\r
+\r
+// CSVNIgnoreTypeDlg dialog\r
+\r
+class CSVNIgnoreTypeDlg : public CResizableStandAloneDialog\r
+{\r
+       DECLARE_DYNAMIC(CSVNIgnoreTypeDlg)\r
+\r
+public:\r
+       CSVNIgnoreTypeDlg(CWnd* pParent = NULL);   // standard constructor\r
+       virtual ~CSVNIgnoreTypeDlg();\r
+\r
+// Dialog Data\r
+       enum { IDD = IDD_SVNIGNORE };\r
+\r
+protected:\r
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
+\r
+       DECLARE_MESSAGE_MAP()\r
+public:\r
+       int m_SVNIgnoreType;\r
+       virtual BOOL OnInitDialog();\r
+};\r
index 28f0c99..e29bd60 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\copy.ico"\r
+                               RelativePath=".\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\copy.ico"\r
+                               RelativePath="..\Resources\copy.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\explorer.ico"\r
+                               RelativePath="..\Resources\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\explorer.ico"\r
+                               RelativePath=".\explorer.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\newfolder.ico"\r
+                               RelativePath=".\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\newfolder.ico"\r
+                               RelativePath="..\Resources\newfolder.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\refresh.ico"\r
+                               RelativePath=".\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\refresh.ico"\r
+                               RelativePath="..\Resources\refresh.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\save.ico"\r
+                               RelativePath="..\Resources\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\save.ico"\r
+                               RelativePath=".\save.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\up.ico"\r
+                               RelativePath=".\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\up.ico"\r
+                               RelativePath="..\Resources\up.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                        >\r
                                </File>\r
                                <File\r
+                                       RelativePath=".\Commands\SVNIgnoreCommand.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\Commands\SVNIgnoreCommand.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\SVNIgnoreTypeDlg.cpp"\r
+                                       >\r
+                               </File>\r
+                               <File\r
+                                       RelativePath=".\SVNIgnoreTypeDlg.h"\r
+                                       >\r
+                               </File>\r
+                               <File\r
                                        RelativePath=".\Commands\SVNRebaseCommand.cpp"\r
                                        >\r
                                </File>\r
index a366ee2..2c4545d 100644 (file)
Binary files a/src/TortoiseProc/resource.h and b/src/TortoiseProc/resource.h differ
index 83ae0e2..5261b4c 100644 (file)
@@ -65,6 +65,9 @@ CShellExt::MenuInfo CShellExt::menuInfo[] =
        { ShellMenuGitSVNRebase,                                MENUSVNREBASE,          IDI_REBASE,                             IDS_MENUSVNREBASE,                              IDS_MENUSVNREBASE_DESC,\r
        ITEMIS_INSVN|ITEMIS_GITSVN, 0, ITEMIS_FOLDERINSVN|ITEMIS_GITSVN, 0, 0, 0, 0, 0},\r
 \r
+       { ShellMenuGitSVNIgnore,                                MENUSVNIGNORE,          IDI_IGNORE,                             IDS_MENUSVNIGNORE,                              IDS_MENUSVNIGNORE_DESC,\r
+       ITEMIS_INSVN|ITEMIS_GITSVN|ITEMIS_EXTENDED, 0, ITEMIS_FOLDERINSVN|ITEMIS_GITSVN|ITEMIS_EXTENDED, 0, 0, 0, 0, 0},\r
+\r
        { ShellSeparator, 0, 0, 0, 0, 0, 0, 0, 0},\r
 \r
        { ShellMenuDiff,                                                MENUDIFF,                       IDI_DIFF,                               IDS_MENUDIFF,                           IDS_MENUDESCDIFF,\r
@@ -1838,6 +1841,14 @@ STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
                                        svnCmd += folder_;\r
                                svnCmd += _T("\"");\r
                                break;\r
+                       case ShellMenuGitSVNIgnore:\r
+                               svnCmd += _T("svnignore /path:\"");\r
+                               if (files_.size() > 0)\r
+                                       svnCmd += files_.front();\r
+                               else\r
+                                       svnCmd += folder_;\r
+                               svnCmd += _T("\"");\r
+                               break;  \r
                        case ShellMenuRebase:\r
                                svnCmd += _T("rebase /path:\"");\r
                                if (files_.size() > 0)\r
index 85b07d9..b0828f1 100644 (file)
@@ -48,7 +48,7 @@
 #define MENUSVNREBASE          0x0000000008000000\r
 #define MENUSVNDCOMMIT         0x0000000010000000\r
 #define MENUPROPERTIES         0x0000000020000000\r
-//#define MENUURLDIFF          0x0000000040000000\r
+#define MENUSVNIGNORE      0x0000000040000000\r
 #define MENUDELUNVERSIONED     0x0000000080000000\r
 #define MENUMERGEALL           0x0000000100000000\r
 #define MENUPREVDIFF           0x0000000200000000\r
index 0d0b29f..adefbf2 100644 (file)
@@ -167,6 +167,7 @@ protected:
                ShellMenuSendMail,\r
                ShellMenuGitSVNRebase,\r
                ShellMenuGitSVNDCommit,\r
+               ShellMenuGitSVNIgnore,      //import svn ignore\r
                ShellMenuSync,\r
                ShellMenuLastEntry                      // used to mark the menu array end\r
        };\r
index 3355da1..f993179 100644 (file)
 #define IDS_MENUSYNC                    339\r
 #define IDS_MENUDESCSYNC                340\r
 #define IDS_MENUSTASHPOP                341\r
+#define IDS_MENUSVNIGNORE               342\r
+#define IDS_MENUSVNIGNORE_DEST          343\r
+#define IDS_MENUSVNIGNORE_DESC          343\r
 #define IDC_REVISION                    1001\r
 #define IDC_LOCKED                      1002\r
 #define IDC_REPOURL                     1003\r
index f500f50..a2ecbc8 100644 (file)
@@ -436,6 +436,8 @@ BEGIN
     IDS_MENUSYNC            "Sync..."\r
     IDS_MENUDESCSYNC        "Sync remote Remote Repostory, include pull, push,email patch and so on"\r
     IDS_MENUSTASHPOP        "Stash Pop"\r
+    IDS_MENUSVNIGNORE       "Import SVN Ignore ..."\r
+    IDS_MENUSVNIGNORE_DESC  "Import SVN Ignore"\r
 END\r
 \r
 #endif    // English (U.S.) resources\r