OSDN Git Service

230ad54c59b511f910c13401630920ba544dd060
[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 \r
180                         break;\r
181                 default:\r
182                         //CMessageBox::Show(NULL,_T("Have not implemented"),_T("TortoiseGit"),MB_OK);\r
183                         break;\r
184 #if 0\r
185         \r
186                 case ID_REVERTREV:\r
187                         {\r
188                                 // we need an URL to complete this command, so error out if we can't get an URL\r
189                                 if (pathURL.IsEmpty())\r
190                                 {\r
191                                         CString strMessage;\r
192                                         strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
193                                         CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
194                                         TRACE(_T("could not retrieve the URL of the folder!\n"));\r
195                                         break;          //exit\r
196                                 }\r
197                                 CString msg;\r
198                                 msg.Format(IDS_LOG_REVERT_CONFIRM, m_path.GetWinPath());\r
199                                 if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
200                                 {\r
201                                         CGitProgressDlg dlg;\r
202                                         dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
203                                         dlg.SetPathList(CTGitPathList(m_path));\r
204                                         dlg.SetUrl(pathURL);\r
205                                         dlg.SetSecondUrl(pathURL);\r
206                                         revisionRanges.AdjustForMerge(true);\r
207                                         dlg.SetRevisionRanges(revisionRanges);\r
208                                         dlg.SetPegRevision(m_LogRevision);\r
209                                         dlg.DoModal();\r
210                                 }\r
211                         }\r
212                         break;\r
213                 case ID_MERGEREV:\r
214                         {\r
215                                 // we need an URL to complete this command, so error out if we can't get an URL\r
216                                 if (pathURL.IsEmpty())\r
217                                 {\r
218                                         CString strMessage;\r
219                                         strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
220                                         CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
221                                         TRACE(_T("could not retrieve the URL of the folder!\n"));\r
222                                         break;          //exit\r
223                                 }\r
224 \r
225                                 CString path = m_path.GetWinPathString();\r
226                                 bool bGotSavePath = false;\r
227                                 if ((GetSelectedCount() == 1)&&(!m_path.IsDirectory()))\r
228                                 {\r
229                                         bGotSavePath = CAppUtils::FileOpenSave(path, NULL, IDS_LOG_MERGETO, IDS_COMMONFILEFILTER, true, GetSafeHwnd());\r
230                                 }\r
231                                 else\r
232                                 {\r
233                                         CBrowseFolder folderBrowser;\r
234                                         folderBrowser.SetInfo(CString(MAKEINTRESOURCE(IDS_LOG_MERGETO)));\r
235                                         bGotSavePath = (folderBrowser.Show(GetSafeHwnd(), path, path) == CBrowseFolder::OK);\r
236                                 }\r
237                                 if (bGotSavePath)\r
238                                 {\r
239                                         CGitProgressDlg dlg;\r
240                                         dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
241                                         dlg.SetPathList(CTGitPathList(CTGitPath(path)));\r
242                                         dlg.SetUrl(pathURL);\r
243                                         dlg.SetSecondUrl(pathURL);\r
244                                         revisionRanges.AdjustForMerge(false);\r
245                                         dlg.SetRevisionRanges(revisionRanges);\r
246                                         dlg.SetPegRevision(m_LogRevision);\r
247                                         dlg.DoModal();\r
248                                 }\r
249                         }\r
250                         break;\r
251                 case ID_REVERTTOREV:\r
252                         {\r
253                                 // we need an URL to complete this command, so error out if we can't get an URL\r
254                                 if (pathURL.IsEmpty())\r
255                                 {\r
256                                         CString strMessage;\r
257                                         strMessage.Format(IDS_ERR_NOURLOFFILE, (LPCTSTR)(m_path.GetUIPathString()));\r
258                                         CMessageBox::Show(this->m_hWnd, strMessage, _T("TortoiseGit"), MB_ICONERROR);\r
259                                         TRACE(_T("could not retrieve the URL of the folder!\n"));\r
260                                         break;          //exit\r
261                                 }\r
262 \r
263                                 CString msg;\r
264                                 msg.Format(IDS_LOG_REVERTTOREV_CONFIRM, m_path.GetWinPath());\r
265                                 if (CMessageBox::Show(this->m_hWnd, msg, _T("TortoiseGit"), MB_YESNO | MB_ICONQUESTION) == IDYES)\r
266                                 {\r
267                                         CGitProgressDlg dlg;\r
268                                         dlg.SetCommand(CGitProgressDlg::GitProgress_Merge);\r
269                                         dlg.SetPathList(CTGitPathList(m_path));\r
270                                         dlg.SetUrl(pathURL);\r
271                                         dlg.SetSecondUrl(pathURL);\r
272                                         GitRevRangeArray revarray;\r
273                                         revarray.AddRevRange(GitRev::REV_HEAD, revSelected);\r
274                                         dlg.SetRevisionRanges(revarray);\r
275                                         dlg.SetPegRevision(m_LogRevision);\r
276                                         dlg.DoModal();\r
277                                 }\r
278                         }\r
279                         break;\r
280         \r
281 \r
282         \r
283                 case ID_BLAMECOMPARE:\r
284                         {\r
285                                 //user clicked on the menu item "compare with working copy"\r
286                                 //now first get the revision which is selected\r
287                                 if (PromptShown())\r
288                                 {\r
289                                         GitDiff diff(this, this->m_hWnd, true);\r
290                                         diff.SetHEADPeg(m_LogRevision);\r
291                                         diff.ShowCompare(m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), false, true);\r
292                                 }\r
293                                 else\r
294                                         CAppUtils::StartShowCompare(m_hWnd, m_path, GitRev::REV_BASE, m_path, revSelected, GitRev(), m_LogRevision, false, false, true);\r
295                         }\r
296                         break;\r
297                 case ID_BLAMETWO:\r
298                         {\r
299                                 //user clicked on the menu item "compare and blame revisions"\r
300                                 if (PromptShown())\r
301                                 {\r
302                                         GitDiff diff(this, this->m_hWnd, true);\r
303                                         diff.SetHEADPeg(m_LogRevision);\r
304                                         diff.ShowCompare(CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
305                                 }\r
306                                 else\r
307                                         CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revSelected2, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
308                         }\r
309                         break;\r
310                 case ID_BLAMEWITHPREVIOUS:\r
311                         {\r
312                                 //user clicked on the menu item "Compare and Blame with previous revision"\r
313                                 if (PromptShown())\r
314                                 {\r
315                                         GitDiff diff(this, this->m_hWnd, true);\r
316                                         diff.SetHEADPeg(m_LogRevision);\r
317                                         diff.ShowCompare(CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), false, true);\r
318                                 }\r
319                                 else\r
320                                         CAppUtils::StartShowCompare(m_hWnd, CTGitPath(pathURL), revPrevious, CTGitPath(pathURL), revSelected, GitRev(), m_LogRevision, false, false, true);\r
321                         }\r
322                         break;\r
323                 \r
324                 case ID_OPENWITH:\r
325                         bOpenWith = true;\r
326                 case ID_OPEN:\r
327                         {\r
328                                 CProgressDlg progDlg;\r
329                                 progDlg.SetTitle(IDS_APPNAME);\r
330                                 progDlg.SetAnimation(IDR_DOWNLOAD);\r
331                                 CString sInfoLine;\r
332                                 sInfoLine.Format(IDS_PROGRESSGETFILEREVISION, m_path.GetWinPath(), (LPCTSTR)revSelected.ToString());\r
333                                 progDlg.SetLine(1, sInfoLine, true);\r
334                                 SetAndClearProgressInfo(&progDlg);\r
335                                 progDlg.ShowModeless(m_hWnd);\r
336                                 CTGitPath tempfile = CTempFiles::Instance().GetTempFilePath(false, m_path, revSelected);\r
337                                 bool bSuccess = true;\r
338                                 if (!Cat(m_path, GitRev(GitRev::REV_HEAD), revSelected, tempfile))\r
339                                 {\r
340                                         bSuccess = false;\r
341                                         // try again, but with the selected revision as the peg revision\r
342                                         if (!Cat(m_path, revSelected, revSelected, tempfile))\r
343                                         {\r
344                                                 progDlg.Stop();\r
345                                                 SetAndClearProgressInfo((HWND)NULL);\r
346                                                 CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
347                                                 EnableOKButton();\r
348                                                 break;\r
349                                         }\r
350                                         bSuccess = true;\r
351                                 }\r
352                                 if (bSuccess)\r
353                                 {\r
354                                         progDlg.Stop();\r
355                                         SetAndClearProgressInfo((HWND)NULL);\r
356                                         SetFileAttributes(tempfile.GetWinPath(), FILE_ATTRIBUTE_READONLY);\r
357                                         int ret = 0;\r
358                                         if (!bOpenWith)\r
359                                                 ret = (int)ShellExecute(this->m_hWnd, NULL, tempfile.GetWinPath(), NULL, NULL, SW_SHOWNORMAL);\r
360                                         if ((ret <= HINSTANCE_ERROR)||bOpenWith)\r
361                                         {\r
362                                                 CString cmd = _T("RUNDLL32 Shell32,OpenAs_RunDLL ");\r
363                                                 cmd += tempfile.GetWinPathString() + _T(" ");\r
364                                                 CAppUtils::LaunchApplication(cmd, NULL, false);\r
365                                         }\r
366                                 }\r
367                         }\r
368                         break;\r
369                 case ID_BLAME:\r
370                         {\r
371                                 CBlameDlg dlg;\r
372                                 dlg.EndRev = revSelected;\r
373                                 if (dlg.DoModal() == IDOK)\r
374                                 {\r
375                                         CBlame blame;\r
376                                         CString tempfile;\r
377                                         CString logfile;\r
378                                         tempfile = blame.BlameToTempFile(m_path, dlg.StartRev, dlg.EndRev, dlg.EndRev, logfile, _T(""), dlg.m_bIncludeMerge, TRUE, TRUE);\r
379                                         if (!tempfile.IsEmpty())\r
380                                         {\r
381                                                 if (dlg.m_bTextView)\r
382                                                 {\r
383                                                         //open the default text editor for the result file\r
384                                                         CAppUtils::StartTextViewer(tempfile);\r
385                                                 }\r
386                                                 else\r
387                                                 {\r
388                                                         CString sParams = _T("/path:\"") + m_path.GetGitPathString() + _T("\" ");\r
389                                                         if(!CAppUtils::LaunchTortoiseBlame(tempfile, logfile, CPathUtils::GetFileNameFromPath(m_path.GetFileOrDirectoryName()),sParams))\r
390                                                         {\r
391                                                                 break;\r
392                                                         }\r
393                                                 }\r
394                                         }\r
395                                         else\r
396                                         {\r
397                                                 CMessageBox::Show(this->m_hWnd, blame.GetLastErrorMessage(), _T("TortoiseGit"), MB_ICONERROR);\r
398                                         }\r
399                                 }\r
400                         }\r
401                         break;\r
402                 case ID_UPDATE:\r
403                         {\r
404                                 CString sCmd;\r
405                                 CString url = _T("tgit:")+pathURL;\r
406                                 sCmd.Format(_T("%s /command:update /path:\"%s\" /rev:%ld"),\r
407                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
408                                         (LPCTSTR)m_path.GetWinPath(), (LONG)revSelected);\r
409                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
410                         }\r
411                         break;\r
412                 case ID_FINDENTRY:\r
413                         {\r
414                                 m_nSearchIndex = GetSelectionMark();\r
415                                 if (m_nSearchIndex < 0)\r
416                                         m_nSearchIndex = 0;\r
417                                 if (m_pFindDialog)\r
418                                 {\r
419                                         break;\r
420                                 }\r
421                                 else\r
422                                 {\r
423                                         m_pFindDialog = new CFindReplaceDialog();\r
424                                         m_pFindDialog->Create(TRUE, NULL, NULL, FR_HIDEUPDOWN | FR_HIDEWHOLEWORD, this);                                                                        \r
425                                 }\r
426                         }\r
427                         break;\r
428                 case ID_REPOBROWSE:\r
429                         {\r
430                                 CString sCmd;\r
431                                 sCmd.Format(_T("%s /command:repobrowser /path:\"%s\" /rev:%s"),\r
432                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
433                                         (LPCTSTR)pathURL, (LPCTSTR)revSelected.ToString());\r
434 \r
435                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
436                         }\r
437                         break;\r
438                 case ID_EDITLOG:\r
439                         {\r
440                                 EditLogMessage(selIndex);\r
441                         }\r
442                         break;\r
443                 case ID_EDITAUTHOR:\r
444                         {\r
445                                 EditAuthor(selEntries);\r
446                         }\r
447                         break;\r
448                 case ID_REVPROPS:\r
449                         {\r
450                                 CEditPropertiesDlg dlg;\r
451                                 dlg.SetProjectProperties(&m_ProjectProperties);\r
452                                 CTGitPathList escapedlist;\r
453                                 dlg.SetPathList(CTGitPathList(CTGitPath(pathURL)));\r
454                                 dlg.SetRevision(revSelected);\r
455                                 dlg.RevProps(true);\r
456                                 dlg.DoModal();\r
457                         }\r
458                         break;\r
459                 \r
460                 case ID_EXPORT:\r
461                         {\r
462                                 CString sCmd;\r
463                                 sCmd.Format(_T("%s /command:export /path:\"%s\" /revision:%ld"),\r
464                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
465                                         (LPCTSTR)pathURL, (LONG)revSelected);\r
466                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
467                         }\r
468                         break;\r
469                 case ID_CHECKOUT:\r
470                         {\r
471                                 CString sCmd;\r
472                                 CString url = _T("tgit:")+pathURL;\r
473                                 sCmd.Format(_T("%s /command:checkout /url:\"%s\" /revision:%ld"),\r
474                                         (LPCTSTR)(CPathUtils::GetAppDirectory()+_T("TortoiseProc.exe")),\r
475                                         (LPCTSTR)url, (LONG)revSelected);\r
476                                 CAppUtils::LaunchApplication(sCmd, NULL, false);\r
477                         }\r
478                         break;\r
479                 case ID_VIEWREV:\r
480                         {\r
481                                 CString url = m_ProjectProperties.sWebViewerRev;\r
482                                 url = GetAbsoluteUrlFromRelativeUrl(url);\r
483                                 url.Replace(_T("%REVISION%"), revSelected.ToString());\r
484                                 if (!url.IsEmpty())\r
485                                         ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
486                         }\r
487                         break;\r
488                 case ID_VIEWPATHREV:\r
489                         {\r
490                                 CString relurl = pathURL;\r
491                                 CString sRoot = GetRepositoryRoot(CTGitPath(relurl));\r
492                                 relurl = relurl.Mid(sRoot.GetLength());\r
493                                 CString url = m_ProjectProperties.sWebViewerPathRev;\r
494                                 url = GetAbsoluteUrlFromRelativeUrl(url);\r
495                                 url.Replace(_T("%REVISION%"), revSelected.ToString());\r
496                                 url.Replace(_T("%PATH%"), relurl);\r
497                                 if (!url.IsEmpty())\r
498                                         ShellExecute(this->m_hWnd, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);                                        \r
499                         }\r
500                         break;\r
501 #endif\r
502                 \r
503                 } // switch (cmd)\r
504 \r
505                 theApp.DoWaitCursor(-1);\r
506 }