Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

fogcreek shellext: added support for opening files in Kiln through the shell extension

Changeset a3769970ee05

Parent f83ef1d2374f

by David Golub

Changes to 4 files · Browse files at a3769970ee05 Showing diff from parent f83ef1d2374f Diff from another changeset...

 
53
54
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@@ -53,3 +53,25 @@
  ::ShellExecute(NULL, NULL, strKilnUrl, NULL, NULL, SW_SHOW);   }  } + +void KilnOpenFiles(const CString& strPath, const CAtlArray<CString>& arrFiles) +{ + CString strKilnUrl; + if (KilnGetUrl(strPath, &strKilnUrl)) + { + if (strKilnUrl[strKilnUrl.GetLength() - 1] != '/') + strKilnUrl += '/'; + strKilnUrl += "Files/"; + + CString strHgRoot; + GetHgRoot(strPath, strHgRoot); + + // Open each file in the default web browser + for (int i = 0; i < arrFiles.GetCount(); i++) + { + CString strRelPath; + GetRelPath(strHgRoot, arrFiles[i], strRelPath); + ::ShellExecute(NULL, NULL, strKilnUrl + strRelPath, NULL, NULL, SW_SHOW); + } + } +}
 
17
18
19
 
 
17
18
19
20
@@ -17,3 +17,4 @@
   bool KilnGetUrl(const CString& strPath, CString* pstrKilnUrl = NULL);  void KilnOpenRepo(const CString& strPath); +void KilnOpenFiles(const CString& strPath, const CAtlArray<CString>& arrFiles);
 
16
17
18
 
19
20
 
16
17
18
19
20
21
@@ -16,5 +16,6 @@
 #pragma once    int GetHgRoot(const CString& strPath, CString& strHgRoot); +int GetRelPath(const CString& strHgRoot, const CString& strPath, CString& strRes);  int HgQueryDirstate(char chClass, const CString& strPath, char chFilterStatus,   char& chOutStatus);
 
112
113
114
 
 
 
115
116
117
 
132
133
134
135
 
136
137
138
 
140
141
142
143
 
144
145
146
 
507
508
509
510
 
511
512
513
 
535
536
537
538
 
539
540
541
 
820
821
822
 
 
 
 
 
823
824
825
 
112
113
114
115
116
117
118
119
120
 
135
136
137
 
138
139
140
141
 
143
144
145
 
146
147
148
149
 
510
511
512
 
513
514
515
516
 
538
539
540
 
541
542
543
544
 
823
824
825
826
827
828
829
830
831
832
833
@@ -112,6 +112,9 @@
  { "kiln", L"Kiln",   L"Opens the current repository in Kiln.",   "kiln.ico", 0 }, + { "kilnfiles", L"Kiln", + L"Opens the selected files in Kiln.", + "kiln.ico", 0 },     // Add new items here.   // Template: @@ -132,7 +135,7 @@
 static const char* const RepoFilesMenu =   "commit status vdiff sep"   " add revert rename forget remove sep" - " log annotate sep" + " log annotate sep kilnfiles sep"   " about";    static const char* const NoRepoMenu = @@ -140,7 +143,7 @@
  " workbench sep"   " about";   -static const LPCTSTR DefaultPromotedString = "commit,workbench,kiln"; +static const LPCTSTR DefaultPromotedString = "commit,workbench,kiln,kilnfiles";    void CTortoiseHgCmenuBase::AddMenuList(UINT idCmd, const CString& strName)  { @@ -507,7 +510,7 @@
  CString strName = listEntries.GetNext(position);   if (listPromoted.Find(strName) != NULL)   { - if (strName == "kiln" && !KilnGetUrl(strCwd)) + if ((strName == "kiln" || strName == "kilnfiles") && !KilnGetUrl(strCwd))   continue;   InsertMenuItemByName(hMenu, strName, indexMenu++, idCmd++, idCmdFirst, L"Hg ");   } @@ -535,7 +538,7 @@
  {   if (listPromoted.Find(strName) == NULL)   { - if (strName == "kiln" && !KilnGetUrl(strCwd)) + if ((strName == "kiln" || strName == "kilnfiles") && !KilnGetUrl(strCwd))   continue;   InsertMenuItemByName(hSubMenu, strName, indexSubMenu++, idCmd++,   idCmdFirst, L""); @@ -820,6 +823,11 @@
  KilnOpenRepo(strCwd);   return;   } + else if (strCmd == "kilnfiles") + { + KilnOpenFiles(strCwd, m_arrFiles); + return; + }     if (!m_arrFiles.IsEmpty())   {