TortoiseGit日本語言語ファイル作成
Revisión | f27a2b7b04f549ab3ff336359a5098b1e8935706 (tree) |
---|---|
Tiempo | 2010-01-23 19:36:18 |
Autor | Frank Li <lznuaa@gmai...> |
Commiter | Frank Li |
Basic File diff dialog is okay to show prediff command
Signed-off-by: Frank Li <lznuaa@gmail.com>
@@ -403,4 +403,34 @@ void GitRev::DbgPrint() | ||
403 | 403 | TRACE(_T("Parent %i %s"),i, m_ParentHash[i].ToString()); |
404 | 404 | } |
405 | 405 | TRACE(_T("\n")); |
406 | +} | |
407 | + | |
408 | +int GitRev::GetCommitFromHash(CGitHash &hash) | |
409 | +{ | |
410 | + g_Git.CheckAndInitDll(); | |
411 | + | |
412 | + GIT_COMMIT commit; | |
413 | + if(git_get_commit_from_hash( &commit, hash.m_hash)) | |
414 | + return -1; | |
415 | + | |
416 | + this->ParserFromCommit(&commit); | |
417 | + git_free_commit(&commit); | |
418 | + | |
419 | + this->m_CommitHash=hash; | |
420 | + | |
421 | + return 0; | |
422 | + | |
423 | +} | |
424 | + | |
425 | +int GitRev::GetCommit(CString &refname) | |
426 | +{ | |
427 | + g_Git.CheckAndInitDll(); | |
428 | + CStringA rev; | |
429 | + rev= CUnicodeUtils::GetUTF8(refname); | |
430 | + GIT_HASH sha; | |
431 | + | |
432 | + if(git_get_sha1(rev.GetBuffer(),sha)) | |
433 | + return -1; | |
434 | + | |
435 | + GetCommitFromHash(CGitHash((char*)sha)); | |
406 | 436 | } |
\ No newline at end of file |
@@ -77,6 +77,10 @@ public: | ||
77 | 77 | |
78 | 78 | int ParserFromCommit(GIT_COMMIT *commit); |
79 | 79 | int ParserParentFromCommit(GIT_COMMIT *commit); |
80 | + | |
81 | + int GetCommitFromHash(CGitHash &hash); | |
82 | + int GetCommit(CString &Rev); | |
83 | + | |
80 | 84 | public: |
81 | 85 | void DbgPrint(); |
82 | 86 | private: |
@@ -32,7 +32,7 @@ bool DiffCommand::Execute() | ||
32 | 32 | // bool bBlame = !!parser.HasKey(_T("blame")); |
33 | 33 | if (path2.IsEmpty()) |
34 | 34 | { |
35 | - if (cmdLinePath.IsDirectory()) | |
35 | + if (this->orgCmdLinePath.IsDirectory()) | |
36 | 36 | { |
37 | 37 | CChangedDlg dlg; |
38 | 38 | dlg.m_pathList = CTGitPathList(cmdLinePath); |
@@ -24,15 +24,20 @@ | ||
24 | 24 | #include "ChangedDlg.h" |
25 | 25 | #include "LogDlgHelper.h" |
26 | 26 | #include "CommonResource.h" |
27 | +#include "FileDiffDlg.h" | |
27 | 28 | |
28 | 29 | bool PrevDiffCommand::Execute() |
29 | 30 | { |
30 | 31 | bool bRet = false; |
31 | 32 | bool bAlternativeTool = !!parser.HasKey(_T("alternative")); |
32 | - if (cmdLinePath.IsDirectory()) | |
33 | + if (this->orgCmdLinePath.IsDirectory()) | |
33 | 34 | { |
34 | - CChangedDlg dlg; | |
35 | - dlg.m_pathList = CTGitPathList(cmdLinePath); | |
35 | + CFileDiffDlg dlg; | |
36 | + | |
37 | + dlg.m_strRev1 = _T("HEAD") ; | |
38 | + dlg.m_strRev2 = _T("HEAD~1"); | |
39 | + | |
40 | + //dlg.m_pathList = CTGitPathList(cmdLinePath); | |
36 | 41 | dlg.DoModal(); |
37 | 42 | bRet = true; |
38 | 43 | } |
@@ -65,6 +65,8 @@ void CFileDiffDlg::DoDataExchange(CDataExchange* pDX) | ||
65 | 65 | DDX_Control(pDX, IDC_REV1BTN, m_cRev1Btn); |
66 | 66 | DDX_Control(pDX, IDC_REV2BTN, m_cRev2Btn); |
67 | 67 | DDX_Control(pDX, IDC_FILTER, m_cFilter); |
68 | + DDX_Control(pDX, IDC_REV1EDIT, m_ctrRev1Edit); | |
69 | + DDX_Control(pDX, IDC_REV2EDIT, m_ctrRev2Edit); | |
68 | 70 | } |
69 | 71 | |
70 | 72 |
@@ -83,6 +85,8 @@ BEGIN_MESSAGE_MAP(CFileDiffDlg, CResizableStandAloneDialog) | ||
83 | 85 | ON_MESSAGE(WM_FILTEREDIT_CANCELCLICKED, OnClickedCancelFilter) |
84 | 86 | ON_EN_CHANGE(IDC_FILTER, &CFileDiffDlg::OnEnChangeFilter) |
85 | 87 | ON_WM_TIMER() |
88 | + ON_EN_CHANGE(IDC_REV1EDIT, &CFileDiffDlg::OnEnChangeRev1edit) | |
89 | + ON_EN_CHANGE(IDC_REV2EDIT, &CFileDiffDlg::OnEnChangeRev2edit) | |
86 | 90 | END_MESSAGE_MAP() |
87 | 91 | |
88 | 92 |
@@ -199,16 +203,40 @@ BOOL CFileDiffDlg::OnInitDialog() | ||
199 | 203 | AddAnchor(IDC_SWITCHLEFTRIGHT, TOP_RIGHT); |
200 | 204 | AddAnchor(IDC_FIRSTURL, TOP_LEFT, TOP_RIGHT); |
201 | 205 | AddAnchor(IDC_REV1BTN, TOP_RIGHT); |
202 | - AddAnchor(IDC_DIFFSTATIC2, TOP_LEFT, TOP_RIGHT); | |
206 | + //AddAnchor(IDC_DIFFSTATIC2, TOP_LEFT, TOP_RIGHT); | |
203 | 207 | AddAnchor(IDC_SECONDURL, TOP_LEFT, TOP_RIGHT); |
204 | 208 | AddAnchor(IDC_REV2BTN, TOP_RIGHT); |
205 | 209 | AddAnchor(IDC_FILTER, TOP_LEFT, TOP_RIGHT); |
206 | 210 | AddAnchor(IDC_FILELIST, TOP_LEFT, BOTTOM_RIGHT); |
211 | + AddAnchor(IDC_REV1GROUP,TOP_LEFT,TOP_RIGHT); | |
212 | + AddAnchor(IDC_REV2GROUP,TOP_LEFT,TOP_RIGHT); | |
213 | + AddAnchor(IDC_REV1EDIT,TOP_LEFT); | |
214 | + AddAnchor(IDC_REV2EDIT,TOP_LEFT); | |
207 | 215 | |
208 | - SetURLLabels(); | |
209 | - | |
210 | 216 | EnableSaveRestore(_T("FileDiffDlg")); |
211 | 217 | |
218 | + if(this->m_strRev1.IsEmpty()) | |
219 | + this->m_ctrRev1Edit.SetWindowText(this->m_rev1.m_CommitHash.ToString()); | |
220 | + else | |
221 | + { | |
222 | + if(m_rev1.GetCommit(this->m_strRev1)) | |
223 | + this->m_FileListText+=this->m_strRev1 + _T(" is wrong"); | |
224 | + | |
225 | + this->m_ctrRev1Edit.SetWindowText(m_strRev1); | |
226 | + } | |
227 | + | |
228 | + if(this->m_strRev2.IsEmpty()) | |
229 | + this->m_ctrRev2Edit.SetWindowText(this->m_rev2.m_CommitHash.ToString()); | |
230 | + else | |
231 | + { | |
232 | + if(m_rev2.GetCommit(this->m_strRev2)) | |
233 | + this->m_FileListText+=this->m_strRev2 + _T(" is wrong"); | |
234 | + | |
235 | + this->m_ctrRev2Edit.SetWindowText(m_strRev2); | |
236 | + } | |
237 | + | |
238 | + SetURLLabels(); | |
239 | + | |
212 | 240 | InterlockedExchange(&m_bThreadRunning, TRUE); |
213 | 241 | if (AfxBeginThread(DiffThreadEntry, this)==NULL) |
214 | 242 | { |
@@ -216,6 +244,14 @@ BOOL CFileDiffDlg::OnInitDialog() | ||
216 | 244 | CMessageBox::Show(NULL, IDS_ERR_THREADSTARTFAILED, IDS_APPNAME, MB_OK | MB_ICONERROR); |
217 | 245 | } |
218 | 246 | |
247 | + this->m_cRev1Btn.AddEntry(_T("RefBrowse")); | |
248 | + this->m_cRev1Btn.AddEntry(_T("Log")); | |
249 | + this->m_cRev1Btn.AddEntry(_T("RefLog")); | |
250 | + | |
251 | + this->m_cRev2Btn.AddEntry(_T("RefBrowse")); | |
252 | + this->m_cRev2Btn.AddEntry(_T("Log")); | |
253 | + this->m_cRev2Btn.AddEntry(_T("RefLog")); | |
254 | + | |
219 | 255 | // Start with focus on file list |
220 | 256 | GetDlgItem(IDC_FILELIST)->SetFocus(); |
221 | 257 |
@@ -876,6 +912,14 @@ void CFileDiffDlg::OnBnClickedSwitchleftright() | ||
876 | 912 | GitRev rev = m_rev1; |
877 | 913 | m_rev1 = m_rev2; |
878 | 914 | m_rev2 = rev; |
915 | + | |
916 | + CString str1,str2; | |
917 | + this->m_ctrRev1Edit.GetWindowText(str1); | |
918 | + this->m_ctrRev2Edit.GetWindowText(str2); | |
919 | + | |
920 | + this->m_ctrRev1Edit.SetWindowText(str2); | |
921 | + this->m_ctrRev2Edit.SetWindowText(str1); | |
922 | + | |
879 | 923 | SetURLLabels(); |
880 | 924 | |
881 | 925 | } |
@@ -883,11 +927,11 @@ void CFileDiffDlg::OnBnClickedSwitchleftright() | ||
883 | 927 | void CFileDiffDlg::SetURLLabels() |
884 | 928 | { |
885 | 929 | |
886 | - m_cRev1Btn.SetWindowText(m_rev1.m_CommitHash.ToString().Left(6)); | |
887 | - m_cRev2Btn.SetWindowText(m_rev2.m_CommitHash.ToString().Left(6)); | |
930 | +// m_cRev1Btn.SetWindowText(m_rev1.m_CommitHash.ToString().Left(6)); | |
931 | +// m_cRev2Btn.SetWindowText(m_rev2.m_CommitHash.ToString().Left(6)); | |
888 | 932 | |
889 | - SetDlgItemText(IDC_FIRSTURL, m_rev1.m_Subject+CString(_T("\r\n"))+m_rev1.m_CommitHash); | |
890 | - SetDlgItemText(IDC_SECONDURL,m_rev2.m_Subject+CString(_T("\r\n"))+m_rev2.m_CommitHash); | |
933 | + SetDlgItemText(IDC_FIRSTURL, m_rev1.m_CommitHash.ToString().Left(8)+_T(": ")+m_rev1.m_Subject); | |
934 | + SetDlgItemText(IDC_SECONDURL,m_rev2.m_CommitHash.ToString().Left(8)+_T(": ")+m_rev2.m_Subject); | |
891 | 935 | |
892 | 936 | m_tooltips.AddTool(IDC_FIRSTURL, |
893 | 937 | CAppUtils::FormatDateAndTime( m_rev1.m_AuthorDate, DATE_SHORTDATE, false )+_T(" ")+m_rev1.m_AuthorName); |
@@ -1159,3 +1203,23 @@ void CFileDiffDlg::CopySelectionToClipboard() | ||
1159 | 1203 | CStringUtils::WriteAsciiStringToClipboard(sTextForClipboard); |
1160 | 1204 | } |
1161 | 1205 | |
1206 | + | |
1207 | +void CFileDiffDlg::OnEnChangeRev1edit() | |
1208 | +{ | |
1209 | + // TODO: If this is a RICHEDIT control, the control will not | |
1210 | + // send this notification unless you override the CResizableStandAloneDialog::OnInitDialog() | |
1211 | + // function and call CRichEditCtrl().SetEventMask() | |
1212 | + // with the ENM_CHANGE flag ORed into the mask. | |
1213 | + | |
1214 | + // TODO: Add your control notification handler code here | |
1215 | +} | |
1216 | + | |
1217 | +void CFileDiffDlg::OnEnChangeRev2edit() | |
1218 | +{ | |
1219 | + // TODO: If this is a RICHEDIT control, the control will not | |
1220 | + // send this notification unless you override the CResizableStandAloneDialog::OnInitDialog() | |
1221 | + // function and call CRichEditCtrl().SetEventMask() | |
1222 | + // with the ENM_CHANGE flag ORed into the mask. | |
1223 | + | |
1224 | + // TODO: Add your control notification handler code here | |
1225 | +} |
@@ -29,7 +29,7 @@ | ||
29 | 29 | #include "FilterEdit.h" |
30 | 30 | #include "Tooltip.h" |
31 | 31 | #include "ProgressDlg.h" |
32 | - | |
32 | +#include "MenuButton.h" | |
33 | 33 | |
34 | 34 | #define IDT_FILTER 101 |
35 | 35 |
@@ -110,8 +110,8 @@ private: | ||
110 | 110 | |
111 | 111 | CToolTips m_tooltips; |
112 | 112 | |
113 | - CButton m_cRev1Btn; | |
114 | - CButton m_cRev2Btn; | |
113 | + CMenuButton m_cRev1Btn; | |
114 | + CMenuButton m_cRev2Btn; | |
115 | 115 | CFilterEdit m_cFilter; |
116 | 116 | |
117 | 117 | CXPImageButton m_SwitchButton; |
@@ -146,4 +146,16 @@ private: | ||
146 | 146 | |
147 | 147 | static BOOL m_bAscending; |
148 | 148 | static int m_nSortedColumn; |
149 | + | |
150 | + CEdit m_ctrRev1Edit; | |
151 | + CEdit m_ctrRev2Edit; | |
152 | + | |
153 | + CString m_FileListText; | |
154 | +public: | |
155 | + CString m_strRev1; | |
156 | + CString m_strRev2; | |
157 | + | |
158 | +public: | |
159 | + afx_msg void OnEnChangeRev1edit(); | |
160 | + afx_msg void OnEnChangeRev2edit(); | |
149 | 161 | }; |