aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ruleparser.cpp8
-rw-r--r--src/ruleparser.h4
-rw-r--r--src/svn.cpp4
3 files changed, 16 insertions, 0 deletions
diff --git a/src/ruleparser.cpp b/src/ruleparser.cpp
index d0b3b76..c59b44b 100644
--- a/src/ruleparser.cpp
+++ b/src/ruleparser.cpp
@@ -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;
diff --git a/src/ruleparser.h b/src/ruleparser.h
index 483316c..1d561e0 100644
--- a/src/ruleparser.h
+++ b/src/ruleparser.h
@@ -43,6 +43,10 @@ public:
QString repository;
QString branch;
QString path;
+ int minRevision;
+ int maxRevision;
+
+ Match() : minRevision(-1), maxRevision(-1) { }
};
Rules(const QString &filename);
diff --git a/src/svn.cpp b/src/svn.cpp
index b44b36c..9cb0b98 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -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;