comparison mainwindow.cpp @ 41:94bbc4b30b2a

Handle filenames starting with "-" Such filenames are mistaken for command line options, unless we tell Mercurial to stop processing command line options with the special "--" option.
author Martin Geisler <mg@aragost.com>
date Thu, 24 Jun 2010 11:38:50 +0200
parents 42f3cb49373b
children 9a89dedf260a
comparison
equal deleted inserted replaced
40:42f3cb49373b 41:94bbc4b30b2a
151 if (!currentFile.isEmpty()) 151 if (!currentFile.isEmpty())
152 { 152 {
153 if (QMessageBox::Ok == QMessageBox::warning(this, "Remove file", "Really remove file " + currentFile.mid(2) + "?", 153 if (QMessageBox::Ok == QMessageBox::warning(this, "Remove file", "Really remove file " + currentFile.mid(2) + "?",
154 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel)) 154 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel))
155 { 155 {
156 params << "remove" << "--after" << "--force" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") 156 params << "remove" << "--after" << "--force" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
157 157
158 runner -> startProc(getHgBinaryName(), workFolderPath, params); 158 runner -> startProc(getHgBinaryName(), workFolderPath, params);
159 runningAction = ACT_REMOVE; 159 runningAction = ACT_REMOVE;
160 } 160 }
161 } 161 }
169 QStringList params; 169 QStringList params;
170 QString currentFile = hgExp -> getCurrentFileListLine(); 170 QString currentFile = hgExp -> getCurrentFileListLine();
171 171
172 if (!currentFile.isEmpty()) 172 if (!currentFile.isEmpty())
173 { 173 {
174 params << "annotate" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") 174 params << "annotate" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
175 175
176 runner -> startProc(getHgBinaryName(), workFolderPath, params); 176 runner -> startProc(getHgBinaryName(), workFolderPath, params);
177 runningAction = ACT_ANNOTATE; 177 runningAction = ACT_ANNOTATE;
178 } 178 }
179 } 179 }
187 QStringList params; 187 QStringList params;
188 QString currentFile = hgExp -> getCurrentFileListLine(); 188 QString currentFile = hgExp -> getCurrentFileListLine();
189 189
190 if (!currentFile.isEmpty()) 190 if (!currentFile.isEmpty())
191 { 191 {
192 params << "resolve" << "--mark" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") 192 params << "resolve" << "--mark" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ")
193 193
194 runner -> startProc(getHgBinaryName(), workFolderPath, params); 194 runner -> startProc(getHgBinaryName(), workFolderPath, params);
195 runningAction = ACT_RESOLVE_MARK; 195 runningAction = ACT_RESOLVE_MARK;
196 } 196 }
197 } 197 }
392 QString currentFile = hgExp -> getCurrentFileListLine(); 392 QString currentFile = hgExp -> getCurrentFileListLine();
393 393
394 if (!currentFile.isEmpty()) 394 if (!currentFile.isEmpty())
395 { 395 {
396 //Diff parent file against working folder file 396 //Diff parent file against working folder file
397 params << "kdiff3" << currentFile.mid(2); 397 params << "kdiff3" << "--" << currentFile.mid(2);
398 runner -> startProc(getHgBinaryName(), workFolderPath, params, false); 398 runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
399 runningAction = ACT_FILEDIFF; 399 runningAction = ACT_FILEDIFF;
400 } 400 }
401 } 401 }
402 } 402 }
485 if (runningAction == ACT_NONE) 485 if (runningAction == ACT_NONE)
486 { 486 {
487 QStringList params; 487 QStringList params;
488 QString currentFile = hgExp -> getCurrentFileListLine(); 488 QString currentFile = hgExp -> getCurrentFileListLine();
489 489
490 params << "revert" << "--no-backup" << currentFile.mid(2); 490 params << "revert" << "--no-backup" << "--" << currentFile.mid(2);
491 491
492 runner -> startProc(getHgBinaryName(), workFolderPath, params); 492 runner -> startProc(getHgBinaryName(), workFolderPath, params);
493 runningAction = ACT_REVERT; 493 runningAction = ACT_REVERT;
494 } 494 }
495 } 495 }