OSDN Git Service

Add Submodule Sync Command
authorFrank Li <lznuaa@gmail.com>
Sat, 21 Mar 2009 15:05:03 +0000 (23:05 +0800)
committerFrank Li <lznuaa@gmail.com>
Sat, 21 Mar 2009 15:05:03 +0000 (23:05 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/Commands/Command.cpp
src/TortoiseProc/Commands/SubmoduleCommand.cpp
src/TortoiseProc/Commands/SubmoduleCommand.h

index 042925d..ca02b31 100644 (file)
@@ -170,7 +170,8 @@ typedef enum
        cmdStashApply,\r
        cmdStashList,\r
        cmdSubAdd,              \r
-       cmdSubUpdate,   \r
+       cmdSubUpdate,\r
+       cmdSubSync,\r
        cmdRefLog,\r
        \r
 } TGitCommand;\r
@@ -243,6 +244,7 @@ static const struct CommandInfo
        {       cmdStashList,           _T("stashlist")                 },\r
        {       cmdSubAdd,                      _T("subadd")                    },\r
        {       cmdSubUpdate,           _T("subupdate")                 },\r
+       {       cmdSubSync,                     _T("subsync")                   },\r
        {       cmdRefLog,                      _T("reflog")                    }\r
 };\r
 \r
@@ -347,6 +349,8 @@ Command * CommandServer::GetCommand(const CString& sCmd)
                return new SubmoduleUpdateCommand;\r
        case cmdRefLog:\r
                return new RefLogCommand;\r
+       case cmdSubSync:\r
+               return new SubmoduleSyncCommand;\r
 \r
 #if 0\r
 \r
index 15cab4c..d0aa4bd 100644 (file)
@@ -60,7 +60,7 @@ bool SubmoduleAddCommand::Execute()
        return bRet;\r
 }\r
 \r
-bool SubmoduleUpdateCommand::Execute()\r
+bool SubmoduleCommand::Execute(CString cmd,  CString arg)\r
 {\r
        bool bRet = false;\r
        CProgressDlg progress;\r
@@ -86,7 +86,7 @@ bool SubmoduleUpdateCommand::Execute()
 \r
        g_Git.m_CurrentDir=super;\r
        \r
-       progress.m_Title.Format(_T("Submodule update - %s"),super);\r
+       progress.m_Title.Format(_T("Submodule %s - %s"),cmd,super);\r
 \r
        //progress.m_GitCmd.Format(_T("git.exe submodule update --init "));\r
 \r
@@ -95,7 +95,7 @@ bool SubmoduleUpdateCommand::Execute()
        {\r
                if(orgPathList[i].IsDirectory())\r
                {\r
-                       str.Format(_T("git.exe submodule update --init \"%s\""),((CTGitPath &)orgPathList[i]).GetSubPath(CTGitPath(super)).GetGitPathString());\r
+                       str.Format(_T("git.exe submodule %s %s \"%s\""),cmd,arg, ((CTGitPath &)orgPathList[i]).GetSubPath(CTGitPath(super)).GetGitPathString());\r
                        progress.m_GitCmdList.push_back(str);\r
                }\r
        }\r
index fd276c6..71ebf2f 100644 (file)
@@ -28,13 +28,29 @@ public:
        virtual bool                    Execute();\r
 };\r
 \r
-class SubmoduleUpdateCommand : public Command\r
+class SubmoduleCommand:public Command\r
+{\r
+public:\r
+       virtual bool Execute(CString cmd,CString arg=_T(""));\r
+\r
+};\r
+\r
+class SubmoduleUpdateCommand : public SubmoduleCommand\r
 {\r
 public:\r
        /**\r
         * Executes the command.\r
         */\r
-       virtual bool                    Execute();\r
+       virtual bool                    Execute() {return SubmoduleCommand::Execute(_T("update"),_T("--init"));};\r
+};\r
+\r
+class SubmoduleSyncCommand : public SubmoduleCommand\r
+{\r
+public:\r
+       /**\r
+        * Executes the command.\r
+        */\r
+       virtual bool                    Execute() {return SubmoduleCommand::Execute(_T("sync"));};\r
 };\r
 \r
 \r