OSDN Git Service

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