]> andersk Git - svn-all-fast-export.git/blobdiff - src/ruleparser.cpp
Make it a fatal error to have a malformed line in the rules file
[svn-all-fast-export.git] / src / ruleparser.cpp
index c214440484c192b80cfec75f0acf69f15a50fdcd..3297d77f9820e80d97bd9f660b2864e253376b66 100644 (file)
@@ -47,12 +47,14 @@ void Rules::load()
         return;
 
     // initialize the regexps we will use
-    QRegExp repoLine("create repository\\s+(\\w+)", Qt::CaseInsensitive);
+    QRegExp repoLine("create repository\\s+(\\S+)", Qt::CaseInsensitive);
     QRegExp repoBranchLine("branch\\s+(\\S+)\\s+from\\s+(\\S+)", Qt::CaseInsensitive);
+
     QRegExp matchLine("match\\s+(.*)", Qt::CaseInsensitive);
-    QRegExp matchRepoLine("repository\\s+(\\w+)", Qt::CaseInsensitive);
+    QRegExp matchRepoLine("repository\\s+(\\S+)", Qt::CaseInsensitive);
     QRegExp matchBranchLine("branch\\s+(\\S+)", Qt::CaseInsensitive);
     QRegExp matchPathLine("path\\s+(.*)", Qt::CaseInsensitive);
+    QRegExp matchRevLine("(min|max) revision (\\d+)", Qt::CaseInsensitive);
 
     QTextStream s(&file);
     enum { ReadingNone, ReadingRepository, ReadingMatch } state = ReadingNone;
@@ -92,6 +94,12 @@ void Rules::load()
             } else if (matchPathLine.exactMatch(line)) {
                 match.path = matchPathLine.cap(1);
                 continue;
+            } else if (matchRevLine.exactMatch(line)) {
+                if (matchRevLine.cap(1) == "min")
+                    match.minRevision = matchRevLine.cap(2).toInt();
+                else            // must be max
+                    match.maxRevision = matchRevLine.cap(2).toInt();
+                continue;
             } else if (line == "end match") {
                 m_matchRules += match;
                 state = ReadingNone;
@@ -113,8 +121,7 @@ void Rules::load()
             match = Match();
             match.rx = QRegExp(matchLine.cap(1), Qt::CaseSensitive, QRegExp::RegExp2);
         } else {
-            qWarning() << "Malformed line in configure file:" << origLine;
-            state = ReadingNone;
+            qFatal("Malformed line in rules file: %s", qPrintable(origLine));
         }
     }
 }
This page took 0.334304 seconds and 4 git commands to generate.