• R/O
  • HTTP
  • SSH
  • HTTPS

TortoiseGitJp: Commit

TortoiseGit日本語言語ファイル作成


Commit MetaInfo

Revisionec657365f555947333d489e3368340f10b3d8398 (tree)
Time2010-01-24 21:20:52
AuthorFrank Li <lznuaa@gmai...>
CommiterFrank Li

Log Message

Direct Launch external diff when open dialog at file

Signed-off-by: Frank Li <lznuaa@gmail.com>

Change Summary

Incremental Difference

--- a/src/TortoiseProc/GitDiff.cpp
+++ b/src/TortoiseProc/GitDiff.cpp
@@ -5,6 +5,7 @@
55 #include "gittype.h"
66 #include "resource.h"
77 #include "MessageBox.h"
8+#include "FileDiffDlg.h"
89
910 CGitDiff::CGitDiff(void)
1011 {
@@ -230,3 +231,30 @@ int CGitDiff::Diff(CTGitPath * pPath,CTGitPath * pPath2, git_revnum_t & rev1, gi
230231 return 0;
231232 }
232233
234+int CGitDiff::DiffCommit(CTGitPath &path, GitRev *r1, GitRev *r2)
235+{
236+ if( path.GetWinPathString().IsEmpty() || path.IsDirectory() )
237+ {
238+ CFileDiffDlg dlg;
239+ dlg.SetDiff(NULL,*r1,*r2);
240+ dlg.DoModal();
241+ }else
242+ {
243+ Diff(&path,&path,r1->m_CommitHash.ToString(),r2->m_CommitHash.ToString());
244+ }
245+ return 0;
246+}
247+
248+int CGitDiff::DiffCommit(CTGitPath &path, CString &r1, CString &r2)
249+{
250+ if( path.GetWinPathString().IsEmpty() || path.IsDirectory() )
251+ {
252+ CFileDiffDlg dlg;
253+ dlg.SetDiff(NULL,r1,r2);
254+ dlg.DoModal();
255+ }else
256+ {
257+ Diff(&path,&path,r1,r2);
258+ }
259+ return 0;
260+}
\ No newline at end of file
--- a/src/TortoiseProc/GitDiff.h
+++ b/src/TortoiseProc/GitDiff.h
@@ -14,4 +14,6 @@ public:
1414 static int Diff(CTGitPath * pPath1, CTGitPath *pPath2 ,git_revnum_t & rev1, git_revnum_t & rev2, bool blame=false, bool unified=false);
1515 static int SubmoduleDiff(CTGitPath * pPath1, CTGitPath *pPath2 ,git_revnum_t & rev1, git_revnum_t & rev2, bool blame=false, bool unified=false);
1616 static int DiffNull(CTGitPath *pPath, git_revnum_t &rev1,bool bIsAdd=true);
17+ static int DiffCommit(CTGitPath &path, GitRev *r1, GitRev *r2);
18+ static int DiffCommit(CTGitPath &path, CString &r1, CString &r2);
1719 };
--- a/src/TortoiseProc/GitLogListAction.cpp
+++ b/src/TortoiseProc/GitLogListAction.cpp
@@ -48,6 +48,7 @@
4848 #include "FileDiffDlg.h"
4949 #include "CommitDlg.h"
5050 #include "RebaseDlg.h"
51+#include "GitDiff.h"
5152
5253 IMPLEMENT_DYNAMIC(CGitLogList, CHintListCtrl)
5354
@@ -161,9 +162,7 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)
161162 {
162163 GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));
163164 GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));
164- CFileDiffDlg dlg;
165- dlg.SetDiff(NULL,*r1,*r2);
166- dlg.DoModal();
165+ CGitDiff::DiffCommit(this->m_Path, r1,r2);
167166
168167 }
169168 break;
@@ -173,9 +172,8 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)
173172 {
174173 GitRev * r1 = &m_wcRev;
175174 GitRev * r2 = pSelLogEntry;
176- CFileDiffDlg dlg;
177- dlg.SetDiff(NULL,*r1,*r2);
178- dlg.DoModal();
175+
176+ CGitDiff::DiffCommit(this->m_Path, r1,r2);
179177
180178 //user clicked on the menu item "compare with working copy"
181179 //if (PromptShown())
@@ -198,8 +196,8 @@ void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)
198196 if(pSelLogEntry->m_ParentHash.size()>0)
199197 //if(m_logEntries.m_HashMap[pSelLogEntry->m_ParentHash[0]]>=0)
200198 {
201- dlg.SetDiff(NULL,pSelLogEntry->m_CommitHash.ToString(),pSelLogEntry->m_ParentHash[0].ToString());
202- dlg.DoModal();
199+ CGitDiff::DiffCommit(this->m_Path, pSelLogEntry->m_CommitHash.ToString(),pSelLogEntry->m_ParentHash[0].ToString());
200+
203201 }else
204202 {
205203 CMessageBox::Show(NULL,_T("No previous version"),_T("TortoiseGit"),MB_OK);
Show on old repository browser