OSDN Git Service

Add Reset Command
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / GitLogListAction.cpp
1 // GitLogList.cpp : implementation file\r
2 //\r
3 /*\r
4         Description: qgit revision list view\r
5 \r
6         Author: Marco Costalba (C) 2005-2007\r
7 \r
8         Copyright: See COPYING file that comes with this distribution\r
9 \r
10 */\r
11 #include "stdafx.h"\r
12 #include "TortoiseProc.h"\r
13 #include "GitLogList.h"\r
14 #include "GitRev.h"\r
15 //#include "VssStyle.h"\r
16 #include "IconMenu.h"\r
17 // CGitLogList\r
18 #include "cursor.h"\r
19 #include "InputDlg.h"\r
20 #include "PropDlg.h"\r
21 #include "SVNProgressDlg.h"\r
22 #include "ProgressDlg.h"\r
23 //#include "RepositoryBrowser.h"\r
24 //#include "CopyDlg.h"\r
25 //#include "StatGraphDlg.h"\r
26 #include "Logdlg.h"\r
27 #include "MessageBox.h"\r
28 #include "Registry.h"\r
29 #include "AppUtils.h"\r
30 #include "PathUtils.h"\r
31 #include "StringUtils.h"\r
32 #include "UnicodeUtils.h"\r
33 #include "TempFile.h"\r
34 //#include "GitInfo.h"\r
35 //#include "GitDiff.h"\r
36 #include "IconMenu.h"\r
37 //#include "RevisionRangeDlg.h"\r
38 //#include "BrowseFolder.h"\r
39 //#include "BlameDlg.h"\r
40 //#include "Blame.h"\r
41 //#include "GitHelpers.h"\r
42 #include "GitStatus.h"\r
43 //#include "LogDlgHelper.h"\r
44 //#include "CachedLogInfo.h"\r
45 //#include "RepositoryInfo.h"\r
46 //#include "EditPropertiesDlg.h"\r
47 #include "FileDiffDlg.h"\r
48 \r
49 IMPLEMENT_DYNAMIC(CGitLogList, CHintListCtrl)\r
50 \r
51 void CGitLogList::ContextMenuAction(int cmd,int FirstSelect, int LastSelect)\r
52 {       \r
53         POSITION pos = GetFirstSelectedItemPosition();\r
54         int indexNext = GetNextSelectedItem(pos);\r
55         if (indexNext < 0)\r
56                 return;\r
57 \r
58         GitRev* pSelLogEntry = reinterpret_cast<GitRev*>(m_arShownList.GetAt(indexNext));\r
59 \r
60         theApp.DoWaitCursor(1);\r
61         bool bOpenWith = false;\r
62 \r
63         switch (cmd)\r
64                 {\r
65                         case ID_GNUDIFF1:\r
66                         {\r
67                                 CString tempfile=GetTempFile();\r
68                                 CString cmd;\r
69                                 GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
70                                 cmd.Format(_T("git.exe diff-tree -r -p --stat %s"),r1->m_CommitHash);\r
71                                 g_Git.RunLogFile(cmd,tempfile);\r
72                                 CAppUtils::StartUnifiedDiffViewer(tempfile,r1->m_CommitHash.Left(6)+_T(":")+r1->m_Subject);\r
73                         }\r
74                         break;\r
75 \r
76                         case ID_GNUDIFF2:\r
77                         {\r
78                                 CString tempfile=GetTempFile();\r
79                                 CString cmd;\r
80                                 GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
81                                 GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
82                                 cmd.Format(_T("git.exe diff-tree -r -p --stat %s %s"),r1->m_CommitHash,r2->m_CommitHash);\r
83                                 g_Git.RunLogFile(cmd,tempfile);\r
84                                 CAppUtils::StartUnifiedDiffViewer(tempfile,r1->m_CommitHash.Left(6)+_T(":")+r2->m_CommitHash.Left(6));\r
85 \r
86                         }\r
87                         break;\r
88 \r
89                 case ID_COMPARETWO:\r
90                         {\r
91                                 GitRev * r1 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(FirstSelect));\r
92                                 GitRev * r2 = reinterpret_cast<GitRev*>(m_arShownList.GetAt(LastSelect));\r
93                                 CFileDiffDlg dlg;\r
94                                 dlg.SetDiff(NULL,*r1,*r2);\r
95                                 dlg.DoModal();\r
96                                 \r
97                         }\r
98                         break;\r
99                 \r
100 \r
101                 case ID_COMPARE:\r
102                         {\r
103                                 GitRev * r1 = &m_wcRev;\r
104                                 GitRev * r2 = pSelLogEntry;\r
105                                 CFileDiffDlg dlg;\r
106                                 dlg.SetDiff(NULL,*r1,*r2);\r
107                                 dlg.DoModal();\r
108 \r
109                                 //user clicked on the menu item "compare with working copy"\r
110                                 //if (PromptShown())\r
111                                 //{\r
112                                 //      GitDiff diff(this, m_hWnd, true);\r
113                                 //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
114                                 //      diff.SetHEADPeg(m_LogRevision);\r
115                                 //      diff.ShowCompare(m_path, GitRev::REV_WC, m_path, revSelected);\r
116                                 //}\r
117                                 //else\r
118                                 //      CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_WC, m_path, revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
119                         }\r
120                         break;\r
121 \r
122                 case ID_COMPAREWITHPREVIOUS:\r
123                         {\r
124 \r
125                                 CFileDiffDlg dlg;\r
126                                 \r
127                                 if(pSelLogEntry->m_ParentHash.size()>0)\r
128                                 //if(m_logEntries.m_HashMap[pSelLogEntry->m_ParentHash[0]]>=0)\r
129                                 {\r
130                                         dlg.SetDiff(NULL,pSelLogEntry->m_CommitHash,pSelLogEntry->m_ParentHash[0]);\r
131                                         dlg.DoModal();\r
132                                 }else\r
133                                 {\r
134                                         CMessageBox::Show(NULL,_T("No previous version"),_T("TortoiseGit"),MB_OK);      \r
135                                 }\r
136                                 //if (PromptShown())\r
137                                 //{\r
138                                 //      GitDiff diff(this, m_hWnd, true);\r
139                                 //      diff.SetAlternativeTool(!!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
140                                 //      diff.SetHEADPeg(m_LogRevision);\r
141                                 //      diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected);\r
142                                 //}\r
143                                 //else\r
144                                 //      CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, !!(GetAsyncKeyState(VK_SHIFT) & 0x8000));\r
145                         }\r
146                         break;\r
147                 case ID_COPYCLIPBOARD:\r
148                         {\r
149                                 CopySelectionToClipBoard();\r
150                         }\r
151                         break;\r
152                 case ID_COPYHASH:\r
153                         {\r
154                                 CopySelectionToClipBoard(TRUE);\r
155                         }\r
156                         break;\r
157                 case ID_EXPORT:\r
158                         CAppUtils::Export(&pSelLogEntry->m_CommitHash);\r
159                         break;\r
160                 case ID_CREATE_BRANCH:\r
161                         CAppUtils::CreateBranchTag(FALSE,&pSelLogEntry->m_CommitHash);\r
162                         m_HashMap.clear();\r
163                         g_Git.GetMapHashToFriendName(m_HashMap);\r
164                         Invalidate();                   \r
165                         break;\r
166                 case ID_CREATE_TAG:\r
167                         CAppUtils::CreateBranchTag(TRUE,&pSelLogEntry->m_CommitHash);\r
168                         m_HashMap.clear();\r
169                         g_Git.GetMapHashToFriendName(m_HashMap);\r
170                         Invalidate();\r
171                         break;\r
172                 case ID_SWITCHTOREV:\r
173                         CAppUtils::Switch(&pSelLogEntry->m_CommitHash);\r
174                         m_HashMap.clear();\r
175                         g_Git.GetMapHashToFriendName(m_HashMap);\r
176                         Invalidate();\r
177                         break;\r
178                 case ID_RESET:\r
179                         CAppUtils::GitReset(&pSelLogEntry->m_CommitHash);\r
180                         m_HashMap.clear();\r
181                         g_Git.GetMapHashToFriendName(m_HashMap);\r
182                         Invalidate();\r
183                         break;\r
184                 default:\r
185                         //CMessageBox::Show(NULL,_T("Have not implemented"),_T("TortoiseGit"),MB_OK);\r
186                         break;\r
187 #if 0\r
188         \r
189                 case ID_REVERTREV:\r
190                         {\r
191                                 // we need an URL to complete this command, so error out if we can't get an URL\r
192                                 if (pathURL.IsEmpty())\r
193                                 {\r
194                                         CString strMessage;\r
195                                         strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
196                                         CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
197                                         TRACE(_T("could not retrieve the URL of the folder!\n"));\r
198                                         break;          //exit\r
199                                 }\r
200                                 CString msg;\r
201                                 msg.Format(IDS_LOG_REVERT_CONFIRM, m_path.GetWinPath());\r
202                                 if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
203                                 {\r
204                                         CGitProgressDlg dlg;\r
205                                         dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
206                                         dlg.SetPathList(CTGitPathList(m_path));\r
207                                         dlg.SetUrl(pathURL);\r
208                                         dlg.SetSecondUrl(pathURL);\r
209                                         revisionRanges.AdjustForMerge(true);\r
210                                         dlg.SetRevisionRanges(revisionRanges);\r
211                                         dlg.SetPegRevision(m_LogRevision);\r
212                                         dlg.DoModal();\r
213                                 }\r
214                         }\r
215                         break;\r
216                 case ID_MERGEREV:\r
217                         {\r
218                                 // we need an URL to complete this command, so error out if we can't get an URL\r
219                                 if (pathURL.IsEmpty())\r
220                                 {\r
221                                         CString strMessage;\r
222                                         strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
223                                         CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
224                                         TRACE(_T("could not retrieve the URL of the folder!\n"));\r
225                                         break;          //exit\r
226                                 }\r
227 \r
228                                 CString path = m_path.GetWinPathString();\r
229                                 bool bGotSavePath = false;\r
230                                 if ((GetSelectedCount() == 1)&&(!m_path.IsDirectory()))\r
231                                 {\r
232                                         bGotSavePath = CAppUtils::FileOpenSave(path, NULL, IDS_LOG_MERGETO, IDS_COMMONFILEFILTER, true, GetSafeHwnd());\r
233                                 }\r
234                                 else\r
235                                 {\r
236                                         CBrowseFolder folderBrowser;\r
237                                         folderBrowser.SetInfo(CString(MAKEINTRESOURCE(IDS_LOG_MERGETO)));\r
238                                         bGotSavePath = (folderBrowser.Show(GetSafeHwnd(), path, path) == CBrowseFolder::OK);\r
239                                 }\r
240                                 if (bGotSavePath)\r
241                                 {\r
242                                         CGitProgressDlg dlg;\r
243                                         dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
244                                         dlg.SetPathList(CTGitPathList(CTGitPath(path)));\r
245                                         dlg.SetUrl(pathURL);\r
246                                         dlg.SetSecondUrl(pathURL);\r
247                                         revisionRanges.AdjustForMerge(false);\r
248                                         dlg.SetRevisionRanges(revisionRanges);\r
249                                         dlg.SetPegRevision(m_LogRevision);\r
250                                         dlg.DoModal();\r
251                                 }\r
252                         }\r
253                         break;\r
254                 case ID_REVERTTOREV:\r
255                         {\r
256                                 // we need an URL to complete this command, so error out if we can't get an URL\r
257                                 if (pathURL.IsEmpty())\r
258                                 {\r
259                                         CString strMessage;\r
260                                         strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
261                                         CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
262                                         TRACE(_T("could not retrieve the URL of the folder!\n"));\r
263                                         break;          //exit\r
264                                 }\r
265 \r
266                                 CString msg;\r
267                                 msg.Format(IDS_LOG_REVERTTOREV_CONFIRM, m_path.GetWinPath());\r
268                                 if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
269                                 {\r
270                                         CGitProgressDlg dlg;\r
271                                         dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
272                                         dlg.SetPathList(CTGitPathList(m_path));\r
273                                         dlg.SetUrl(pathURL);\r
274                                         dlg.SetSecondUrl(pathURL);\r
275                                         GitRevRangeArray revarray;\r
276                                         revarray.AddRevRange(GitRev::REV_HEAD, revSelected);\r
277                                         dlg.SetRevisionRanges(revarray);\r
278                                         dlg.SetPegRevision(m_LogRevision);\r
279                                         dlg.DoModal();\r
280                                 }\r
281                         }\r
282                         break;\r
283         \r
284 \r
285         \r
286                 case ID_BLAMECOMPARE:\r
287                         {\r
288                                 //user clicked on the menu item "compare with working copy"\r
289                                 //now first get the revision which is selected\r
290                                 if (PromptShown())\r
291                                 {\r
292                                         GitDiff diff(this, this->m_hWnd, true);\r
293                                         diff.SetHEADPeg(m_LogRevision);\r
294                                         diff.ShowCompare(m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), false, true);\r
295                                 }\r
296                                 else\r
297                                         CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), m_LogRevision, false, false, true);\r
298                         }\r
299                         break;\r
300                 case ID_BLAMETWO:\r
301                         {\r
302                                 //user clicked on the menu item "compare and blame revisions"\r
303                                 if (PromptShown())\r
304                                 {\r
305                                         GitDiff diff(this, this->m_hWnd, true);\r
306                                         diff.SetHEADPeg(m_LogRevision);\r
307                                         diff.ShowCompare(CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
308                                 }\r
309                                 else\r
310                                         CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
311                         }\r
312                         break;\r
313                 case ID_BLAMEWITHPREVIOUS:\r
314                         {\r
315                                 //user clicked on the menu item "Compare and Blame with previous revision"\r
316                                 if (PromptShown())\r
317                                 {\r
318                                         GitDiff diff(this, this->m_hWnd, true);\r
319                                         diff.SetHEADPeg(m_LogRevision);\r
320                                         diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
321                                 }\r
322                                 else\r
323                                         CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
324                         }\r
325                         break;\r
326                 \r
327                 case ID_OPENWITH:\r
328                         bOpenWith = true;\r
329                 case ID_OPEN:\r
330                         {\r
331                                 CProgressDlg progDlg;\r
332                                 progDlg.SetTitle(IDS_APPNAME);\r
333                                 progDlg.SetAnimation(IDR_DOWNLOAD);\r
334                                 CString sInfoLine;\r
335                                 sInfoLine.Format(IDS_PROGRESSGETFILEREVISION, m_path.GetWinPath(), (LPCTSTR)revSelected.ToString());\r
336                                 progDlg.SetLine(1, sInfoLine, true);\r
337                                 SetAndClearProgressInfo(&progDlg);\r
338                                 progDlg.ShowModeless(m_hWnd);\r
339                                 CTGitPath tempfile = CTempFiles::Instance().GetTempFilePath(false, m_path, revSelected);\r
340                                 bool bSuccess = true;\r
341                                 if (!Cat(m_path, GitRev(GitRev::REV_HEAD), revSelected, tempfile))\r
342                                 {\r
343                                         bSuccess = false;\r
344                                         // try again, but with the selected revision as the peg revision\r
345                                         if (!Cat(m_path, revSelected, revSelected, tempfile))\r
346                                         {\r
347                                                 progDlg.Stop();\r
348                                                 SetAndClearProgressInfo((HWND)NULL);\r
349                                                 CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
350                                                 EnableOKButton();\r
351                                                 break;\r
352                                         }\r
353                                         bSuccess = true;\r
354                                 }\r
355                                 if (bSuccess)\r
356                                 {\r
357                                         progDlg.Stop();\r
358                                         SetAndClearProgressInfo((HWND)NULL);\r
359                                         SetFileAttributes(tempfile.GetWinPath(), FILE_ATTRIBUTE_READONLY);\r
360                                         int ret = 0;\r
361                                         if (!bOpenWith)\r
362                                                 ret = (int)ShellExecute(this->m_hWnd, NULL, tempfile.GetWinPath(), NULL, NULL, SW_SHOWNORMAL);\r
363                                         if ((ret <= HINSTANCE_ERROR)||bOpenWith)\r
364                                         {\r
365                                                 CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL ");\r
366                                                 cmd += tempfile.GetWinPathString() + _T(" ");\r
367                                                 CAppUtils::LaunchApplication(cmd, NULL, false);\r
368                                         }\r
369                                 }\r
370                         }\r
371                         break;\r
372                 case ID_BLAME:\r
373                         {\r
374                                 CBlameDlg dlg;\r
375                                 dlg.EndRev = revSelected;\r
376                                 if (dlg.DoModal() == IDOK)\r
377                                 {\r
378                                         CBlame blame;\r
379                                         CString tempfile;\r
380                                         CString logfile;\r
381                                         tempfile = blame.BlameToTempFile(m_path, dlg.StartRev, dlg.EndRev, dlg.EndRev, logfile, _T(""), dlg.m_bIncludeMerge, TRUE, TRUE);\r
382                                         if (!tempfile.IsEmpty())\r
383                                         {\r
384                                                 if (dlg.m_bTextView)\r
385                                                 {\r
386                                                         //open the default text editor for the result file\r
387                                                         CAppUtils::StartTextViewer(tempfile);\r
388                                                 }\r
389                                                 else\r
390                                                 {\r
391                                                         CString sParams = _T("/path:\"") + m_path.GetGitPathString() + _T("\" ");\r
392                                                         if(!CAppUtils::LaunchTortoiseBlame(tempfile, logfile, CPathUtils::GetFileNameFromPath(m_path.GetFileOrDirectoryName()),sParams))\r
393                                                         {\r
394                                                                 break;\r
395                                                         }\r
396                                                 }\r
397                                         }\r
398                                         else\r
399                                         {\r
400                                                 CMessageBox::Show(this->m_hWnd, blame.GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
401                                         }\r
402                                 }\r
403                         }\r
404                         break;\r
405                 case ID_UPDATE:\r
406                         {\r
407                                 CString sCmd;\r
408                                 CString url = _T("tgit:")+pathURL;\r
409                                 sCmd.Format(_T("%s /command:update /path:\"%s\" /rev:%ld"),\r
410                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
411                                         (LPCTSTR)m_path.GetWinPath(), (LONG)revSelected);\r
412                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
413                         }\r
414                         break;\r
415                 case ID_FINDENTRY:\r
416                         {\r
417                                 m_nSearchIndex = GetSelectionMark();\r
418                                 if (m_nSearchIndex < 0)\r
419                                         m_nSearchIndex = 0;\r
420                                 if (m_pFindDialog)\r
421                                 {\r
422                                         break;\r
423                                 }\r
424                                 else\r
425                                 {\r
426                                         m_pFindDialog = new CFindReplaceDialog();\r
427                                         m_pFindDialog->Create(TRUE, NULL, NULL, FR_HIDEUPDOWN | FR_HIDEWHOLEWORD, this);                                                                        \r
428                                 }\r
429                         }\r
430                         break;\r
431                 case ID_REPOBROWSE:\r
432                         {\r
433                                 CString sCmd;\r
434                                 sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%s"),\r
435                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
436                                         (LPCTSTR)pathURL, (LPCTSTR)revSelected.ToString());\r
437 \r
438                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
439                         }\r
440                         break;\r
441                 case ID_EDITLOG:\r
442                         {\r
443                                 EditLogMessage(selIndex);\r
444                         }\r
445                         break;\r
446                 case ID_EDITAUTHOR:\r
447                         {\r
448                                 EditAuthor(selEntries);\r
449                         }\r
450                         break;\r
451                 case ID_REVPROPS:\r
452                         {\r
453                                 CEditPropertiesDlg dlg;\r
454                                 dlg.SetProjectProperties(&m_ProjectProperties);\r
455                                 CTGitPathList escapedlist;\r
456                                 dlg.SetPathList(CTGitPathList(CTGitPath(pathURL)));\r
457                                 dlg.SetRevision(revSelected);\r
458                                 dlg.RevProps(true);\r
459                                 dlg.DoModal();\r
460                         }\r
461                         break;\r
462                 \r
463                 case ID_EXPORT:\r
464                         {\r
465                                 CString sCmd;\r
466                                 sCmd.Format(_T("%s /command:export /path:\"%s\" /revision:%ld"),\r
467                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
468                                         (LPCTSTR)pathURL, (LONG)revSelected);\r
469                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
470                         }\r
471                         break;\r
472                 case ID_CHECKOUT:\r
473                         {\r
474                                 CString sCmd;\r
475                                 CString url = _T("tgit:")+pathURL;\r
476                                 sCmd.Format(_T("%s /command:checkout /url:\"%s\" /revision:%ld"),\r
477                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
478                                         (LPCTSTR)url, (LONG)revSelected);\r
479                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
480                         }\r
481                         break;\r
482                 case ID_VIEWREV:\r
483                         {\r
484                                 CString url = m_ProjectProperties.sWebViewerRev;\r
485                                 url = GetAbsoluteUrlFromRelativeUrl(url);\r
486                                 url.Replace(_T("%REVISION%"), revSelected.ToString());\r
487                                 if (!url.IsEmpty())\r
488                                         ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
489                         }\r
490                         break;\r
491                 case ID_VIEWPATHREV:\r
492                         {\r
493                                 CString relurl = pathURL;\r
494                                 CString sRoot = GetRepositoryRoot(CTGitPath(relurl));\r
495                                 relurl = relurl.Mid(sRoot.GetLength());\r
496                                 CString url = m_ProjectProperties.sWebViewerPathRev;\r
497                                 url = GetAbsoluteUrlFromRelativeUrl(url);\r
498                                 url.Replace(_T("%REVISION%"), revSelected.ToString());\r
499                                 url.Replace(_T("%PATH%"), relurl);\r
500                                 if (!url.IsEmpty())\r
501                                         ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
502                         }\r
503                         break;\r
504 #endif\r
505                 \r
506                 } // switch (cmd)\r
507 \r
508                 theApp.DoWaitCursor(-1);\r
509 }