Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

shellext: pass file list as string

that last version didn't actually build (make has no deps yet)

Changeset 297768095e6b

Parent ede9f8247280

by Steve Borho

Changes to 3 files · Browse files at 297768095e6b Showing diff from parent ede9f8247280 Diff from another changeset...

 
18
19
20
21
 
22
23
24
25
 
 
26
27
28
29
30
 
 
 
 
 
31
32
33
 
35
36
37
38
 
39
40
41
 
18
19
20
 
21
22
23
24
 
25
26
27
28
29
30
 
31
32
33
34
35
36
37
38
 
40
41
42
 
43
44
45
46
@@ -18,16 +18,21 @@
  std::string hgcmd = Quote(dir + "\\hgtk.exe") + cmd;     std::string cwd; - std::vector<std::string> filelist; + std::string filelist;   if (!myFolder.empty())   {   cwd = myFolder; - filelist.push_back(GetHgRepoRoot(myFolder)); + filelist = GetHgRepoRoot(myFolder); + filelist += "\n";   }   else if (!myFiles.empty())   {   cwd = IsDirectory(myFiles[0])? myFiles[0] : DirName(myFiles[0]); - filelist = myFiles; + for( DWORD i = 0 ; i < myFiles.size() ; i++ ) + { + filelist += myFiles[i]; + filelist += "\n"; + }   }   else   { @@ -35,7 +40,7 @@
  return;   }   - if (!filelist.empty()) + if ( !filelist.empty() )   hgcmd += " --listfile -";     LaunchCommand(hgcmd, cwd, filelist);
 
91
92
93
94
 
95
96
97
 
142
143
144
145
146
 
147
148
149
150
151
152
153
154
155
156
 
157
158
159
 
91
92
93
 
94
95
96
97
 
142
143
144
 
 
145
146
 
147
 
 
 
 
 
 
 
148
149
150
151
@@ -91,7 +91,7 @@
 // Note: if the command is a batch file and the [full] path to the  // batch contains spaces, the path must be double-quoted.  // (see http://www.encocoservices.com/createprocess.html) -bool LaunchCommand(const std::string& command, const std::string& cwd, std::vector<std::string> filelist) +bool LaunchCommand(const std::string& command, const std::string& cwd, const std::string& filelist)  {   TDEBUG_TRACE("LaunchCommand: " << command);   PROCESS_INFORMATION processInfo; @@ -142,18 +142,10 @@
  return false;   }   - std::string writename; - for( DWORD i = 0 ; i < filelist.size(); i++ ) + if( !filelist.empty() )   { - bool bSuccess;   DWORD dwWritten; - - writename = filelist[i]; - writename.push_back('\n'); - - bSuccess = WriteFile(hChildStd_IN_Wr, writename.c_str(), writename.size(), &dwWritten, NULL); - if ( !bSuccess ) - break; + WriteFile(hChildStd_IN_Wr, filelist.c_str(), filelist.size(), &dwWritten, NULL);   }     if ( !CloseHandle(hChildStd_IN_Wr) )
 
31
32
33
34
 
35
36
37
 
31
32
33
 
34
35
36
37
@@ -31,7 +31,7 @@
 bool IsDirectory(const std::string&);  std::string DirName(const std::string&);  std::string BaseName(const std::string&); -bool LaunchCommand(const std::string& command, const std::string& cwd, const std::vector<std::string> filelist); +bool LaunchCommand(const std::string& command, const std::string& cwd, const std::string& filelist);  HICON GetTortoiseIcon(const std::string & iconname);  std::string GetHgRepoRoot(const std::string& path);  bool IsHgRepo(const std::string& path);