diff 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
line wrap: on
line diff
--- a/mainwindow.cpp	Wed Jun 23 21:12:46 2010 +0300
+++ b/mainwindow.cpp	Thu Jun 24 11:38:50 2010 +0200
@@ -153,7 +153,7 @@
             if (QMessageBox::Ok == QMessageBox::warning(this, "Remove file", "Really remove file " + currentFile.mid(2) + "?",
                 QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel))
             {
-                params << "remove" << "--after" << "--force" << currentFile.mid(2);   //Jump over status marker characters (e.g "M ")
+                params << "remove" << "--after" << "--force" << "--" << currentFile.mid(2);   //Jump over status marker characters (e.g "M ")
 
                 runner -> startProc(getHgBinaryName(), workFolderPath, params);
                 runningAction = ACT_REMOVE;
@@ -171,7 +171,7 @@
 
         if (!currentFile.isEmpty())
         {
-            params << "annotate" << currentFile.mid(2);   //Jump over status marker characters (e.g "M ")
+            params << "annotate" << "--" << currentFile.mid(2);   //Jump over status marker characters (e.g "M ")
 
             runner -> startProc(getHgBinaryName(), workFolderPath, params);
             runningAction = ACT_ANNOTATE;
@@ -189,7 +189,7 @@
 
         if (!currentFile.isEmpty())
         {
-            params << "resolve" << "--mark" << currentFile.mid(2);   //Jump over status marker characters (e.g "M ")
+            params << "resolve" << "--mark" << "--" << currentFile.mid(2);   //Jump over status marker characters (e.g "M ")
 
             runner -> startProc(getHgBinaryName(), workFolderPath, params);
             runningAction = ACT_RESOLVE_MARK;
@@ -394,7 +394,7 @@
         if (!currentFile.isEmpty())
         {
             //Diff parent file against working folder file
-            params << "kdiff3" << currentFile.mid(2);
+            params << "kdiff3" << "--" << currentFile.mid(2);
             runner -> startProc(getHgBinaryName(), workFolderPath, params, false);
             runningAction = ACT_FILEDIFF;
         }
@@ -487,7 +487,7 @@
         QStringList params;
         QString currentFile = hgExp -> getCurrentFileListLine();
 
-        params << "revert" << "--no-backup" << currentFile.mid(2);
+        params << "revert" << "--no-backup" << "--" << currentFile.mid(2);
 
         runner -> startProc(getHgBinaryName(), workFolderPath, params);
         runningAction = ACT_REVERT;