OSDN Git Service

GitBlame Use command Line argument to open file
authorFrank Li <lznuaa@gmail.com>
Fri, 16 Jan 2009 01:33:23 +0000 (09:33 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 16 Jan 2009 01:33:23 +0000 (09:33 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseGitBlame/MainFrm.h
src/TortoiseGitBlame/TortoiseGitBlame.vcproj
src/TortoiseGitBlame/TortoiseGitBlame.vcproj.FSL.B20596.user
src/TortoiseGitBlame/TortoiseGitBlameDoc.cpp
src/TortoiseGitBlame/TortoiseGitBlameDoc.h
src/TortoiseGitBlame/TortoiseGitBlameView.cpp

index ff50500..90b5ff8 100644 (file)
@@ -12,7 +12,10 @@ class CMainFrame : public CFrameWndEx
 protected: // create from serialization only\r
        CMainFrame();\r
        DECLARE_DYNCREATE(CMainFrame)\r
 protected: // create from serialization only\r
        CMainFrame();\r
        DECLARE_DYNCREATE(CMainFrame)\r
-\r
+       virtual void OnUpdateFrameTitle(BOOL bAddToTitle)\r
+       {\r
+               CFrameWndEx::OnUpdateFrameTitle( bAddToTitle);\r
+       };\r
 // Attributes\r
 public:\r
 \r
 // Attributes\r
 public:\r
 \r
index 8e8c0f9..075564a 100644 (file)
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\output_wnd.ico"\r
+                               RelativePath=".\res\output_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\output_wnd.ico"\r
+                               RelativePath="..\Resources\blameres\output_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\output_wnd_hc.ico"\r
+                               RelativePath=".\res\output_wnd_hc.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\output_wnd_hc.ico"\r
+                               RelativePath="..\Resources\blameres\output_wnd_hc.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\properties_hc.bmp"\r
+                               RelativePath="..\Resources\blameres\properties_hc.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\properties_hc.bmp"\r
+                               RelativePath=".\res\properties_hc.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\properties_wnd.ico"\r
+                               RelativePath="..\Resources\blameres\properties_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\properties_wnd.ico"\r
+                               RelativePath=".\res\properties_wnd.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\Toolbar.bmp"\r
+                               RelativePath="..\Resources\blameres\Toolbar.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\Toolbar.bmp"\r
+                               RelativePath=".\res\Toolbar.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\Toolbar256.bmp"\r
+                               RelativePath="..\Resources\blameres\Toolbar256.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\Toolbar256.bmp"\r
+                               RelativePath=".\res\Toolbar256.bmp"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
                                </FileConfiguration>\r
                        </File>\r
                        <File\r
                                </FileConfiguration>\r
                        </File>\r
                        <File\r
-                               RelativePath=".\res\TortoiseGitBlameDoc.ico"\r
+                               RelativePath="..\Resources\blameres\TortoiseGitBlameDoc.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath="..\Resources\blameres\TortoiseGitBlameDoc.ico"\r
+                               RelativePath=".\res\TortoiseGitBlameDoc.ico"\r
                                >\r
                        </File>\r
                        <File\r
                                >\r
                        </File>\r
                        <File\r
index ae5c3ce..e7e7f7d 100644 (file)
@@ -11,7 +11,7 @@
                        <DebugSettings\r
                                Command="$(TargetPath)"\r
                                WorkingDirectory=""\r
                        <DebugSettings\r
                                Command="$(TargetPath)"\r
                                WorkingDirectory=""\r
-                               CommandArguments=""\r
+                               CommandArguments="D:\Profiles\b20596\git\alloc.c"\r
                                Attach="false"\r
                                DebuggerType="3"\r
                                Remote="1"\r
                                Attach="false"\r
                                DebuggerType="3"\r
                                Remote="1"\r
@@ -22,7 +22,7 @@
                                SQLDebugging=""\r
                                Environment=""\r
                                EnvironmentMerge="true"\r
                                SQLDebugging=""\r
                                Environment=""\r
                                EnvironmentMerge="true"\r
-                               DebuggerFlavor=""\r
+                               DebuggerFlavor="0"\r
                                MPIRunCommand=""\r
                                MPIRunArguments=""\r
                                MPIRunWorkingDirectory=""\r
                                MPIRunCommand=""\r
                                MPIRunArguments=""\r
                                MPIRunWorkingDirectory=""\r
index 5fececb..32a9a63 100644 (file)
@@ -48,14 +48,20 @@ BOOL CTortoiseGitBlameDoc::OnNewDocument()
 \r
        return TRUE;\r
 }\r
 \r
        return TRUE;\r
 }\r
-\r
 BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName)\r
 {\r
 BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName)\r
 {\r
+       return OnOpenDocument(lpszPathName,_T(""));\r
+}\r
+\r
+BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName,CString Rev)\r
+{\r
        if (!CDocument::OnOpenDocument(lpszPathName))\r
                return FALSE;\r
 \r
        m_CurrentFileName=lpszPathName;\r
 \r
        if (!CDocument::OnOpenDocument(lpszPathName))\r
                return FALSE;\r
 \r
        m_CurrentFileName=lpszPathName;\r
 \r
+       m_Rev=Rev;\r
+\r
        // TODO: add reinitialization code here\r
        // (SDI documents will reuse this document)\r
        if(!CGit::CheckMsysGitDir())\r
        // TODO: add reinitialization code here\r
        // (SDI documents will reuse this document)\r
        if(!CGit::CheckMsysGitDir())\r
@@ -78,7 +84,7 @@ BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName)
                CString cmd;\r
                CTGitPath path;\r
                path.SetFromWin(lpszPathName);\r
                CString cmd;\r
                CTGitPath path;\r
                path.SetFromWin(lpszPathName);\r
-               cmd.Format(_T("git.exe blame -s -l -- \"%s\""),path.GetGitPathString());\r
+               cmd.Format(_T("git.exe blame -s -l %s -- \"%s\""),Rev,path.GetGitPathString());\r
                m_BlameData.Empty();\r
                if(g_Git.Run(cmd,&m_BlameData))\r
                {\r
                m_BlameData.Empty();\r
                if(g_Git.Run(cmd,&m_BlameData))\r
                {\r
@@ -86,13 +92,36 @@ BOOL CTortoiseGitBlameDoc::OnOpenDocument(LPCTSTR lpszPathName)
 \r
                }\r
                CTortoiseGitBlameView *pView=DYNAMIC_DOWNCAST(CTortoiseGitBlameView,GetMainFrame()->GetActiveView());\r
 \r
                }\r
                CTortoiseGitBlameView *pView=DYNAMIC_DOWNCAST(CTortoiseGitBlameView,GetMainFrame()->GetActiveView());\r
-               pView->UpdateInfo();\r
-               \r
+               if(pView == NULL)\r
+               {\r
+                       CWnd* pWnd = GetMainFrame()->GetDescendantWindow(AFX_IDW_PANE_FIRST, TRUE);\r
+                       if (pWnd != NULL && pWnd->IsKindOf(RUNTIME_CLASS(CTortoiseGitBlameView)))\r
+                       {\r
+                               pView = (CTortoiseGitBlameView*)pWnd;\r
+                       }\r
+                       else\r
+                       {\r
+                               return FALSE;\r
+                       }\r
+               }\r
+               pView->UpdateInfo();            \r
        }\r
 \r
        return TRUE;\r
 }\r
 \r
        }\r
 \r
        return TRUE;\r
 }\r
 \r
+void CTortoiseGitBlameDoc::SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU)\r
+{\r
+       CDocument::SetPathName(lpszPathName,bAddToMRU);\r
+\r
+       CString title;\r
+       if(m_Rev.IsEmpty())\r
+               title=CString(lpszPathName)+_T(":HEAD");\r
+       else\r
+               title=CString(lpszPathName)+_T(":")+m_Rev;\r
+\r
+       this->SetTitle(title);\r
+}\r
 \r
 // CTortoiseGitBlameDoc serialization\r
 \r
 \r
 // CTortoiseGitBlameDoc serialization\r
 \r
index a90428d..b69a971 100644 (file)
@@ -25,6 +25,10 @@ public:
        virtual BOOL OnNewDocument();\r
        virtual void Serialize(CArchive& ar);\r
        virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);\r
        virtual BOOL OnNewDocument();\r
        virtual void Serialize(CArchive& ar);\r
        virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);\r
+       virtual BOOL OnOpenDocument(LPCTSTR lpszPathName,CString Rev);\r
+       virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);\r
+       \r
+       \r
 // Implementation\r
 public:\r
        virtual ~CTortoiseGitBlameDoc();\r
 // Implementation\r
 public:\r
        virtual ~CTortoiseGitBlameDoc();\r
@@ -39,7 +43,7 @@ public:
 \r
 protected:\r
        \r
 \r
 protected:\r
        \r
-       \r
+       CString m_Rev;\r
 // Generated message map functions\r
 protected:\r
        DECLARE_MESSAGE_MAP()\r
 // Generated message map functions\r
 protected:\r
        DECLARE_MESSAGE_MAP()\r
index 782a7f1..c5a6796 100644 (file)
@@ -135,7 +135,9 @@ int CTortoiseGitBlameView::OnCreate(LPCREATESTRUCT lpcs)
        m_ToolTip.Create(this->GetParent());    \r
        m_ToolTip.AddTool(this,_T("Test"));\r
        \r
        m_ToolTip.Create(this->GetParent());    \r
        m_ToolTip.AddTool(this,_T("Test"));\r
        \r
+       ::AfxGetApp()->GetMainWnd();\r
        return CView::OnCreate(lpcs);\r
        return CView::OnCreate(lpcs);\r
+       \r
 }\r
 \r
 void CTortoiseGitBlameView::OnSize(UINT nType,int cx, int cy)\r
 }\r
 \r
 void CTortoiseGitBlameView::OnSize(UINT nType,int cx, int cy)\r