]> andersk Git - svn-all-fast-export.git/commitdiff
Add support for min/max revision ranges
authorThiago Macieira <thiago@cassini.local.lan>
Mon, 24 Dec 2007 13:28:41 +0000 (11:28 -0200)
committerThiago Macieira <thiago@cassini.local.lan>
Mon, 24 Dec 2007 13:28:41 +0000 (11:28 -0200)
src/ruleparser.cpp
src/ruleparser.h
src/svn.cpp

index d0b3b768cddca6e4c7af029990028dc44b5c83ba..c59b44b0f64997a3202917fc450a4fbdf8e0c22a 100644 (file)
@@ -49,10 +49,12 @@ void Rules::load()
     // initialize the regexps we will use
     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+(\\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;
index 483316cb22059f7c7734f354e7947b075089a9cf..1d561e073c7bf42b3a4f609404885b9995466de9 100644 (file)
@@ -43,6 +43,10 @@ public:
         QString repository;
         QString branch;
         QString path;
+        int minRevision;
+        int maxRevision;
+
+        Match() : minRevision(-1), maxRevision(-1) { }
     };
 
     Rules(const QString &filename);
index b44b36c93c721a05980bf405f3973be1b9fd9594..9cb0b989cdd680b4f0c494a9a1d246162d3f97ed 100644 (file)
@@ -303,6 +303,10 @@ int SvnPrivate::exportRevision(int revnum)
         // find the first rule that matches this pathname
         bool foundMatch = false;
         foreach (Rules::Match rule, matchRules) {
+            if (rule.minRevision > revnum)
+                continue;
+            if (rule.maxRevision != -1 && rule.maxRevision < revnum)
+                continue;
             if (rule.rx.exactMatch(current)) {
                 foundMatch = true;
                 QString repository = current;
This page took 0.041388 seconds and 5 git commands to generate.