diff options
author | Torgny Nyblom <kde@nyblom.org> | 2010-04-12 16:58:22 +0200 |
---|---|---|
committer | Torgny Nyblom <kde@nyblom.org> | 2010-04-12 16:58:22 +0200 |
commit | 260906c6675b71bcd890e761f23cb7c4a27ac7a8 (patch) | |
tree | 87144723a59787cfe3b7f2ab4e711eaa5aa5f2f8 /src | |
parent | 352ad0f90f7d73bec0f36410128cafde183f39ba (diff) | |
download | svn2git-260906c6675b71bcd890e761f23cb7c4a27ac7a8.tar svn2git-260906c6675b71bcd890e761f23cb7c4a27ac7a8.tar.gz svn2git-260906c6675b71bcd890e761f23cb7c4a27ac7a8.tar.bz2 svn2git-260906c6675b71bcd890e761f23cb7c4a27ac7a8.tar.xz svn2git-260906c6675b71bcd890e761f23cb7c4a27ac7a8.zip |
Ditch the Rootdir option and add a prefix one instead (Thiago is always correct :))
Diffstat (limited to 'src')
-rw-r--r-- | src/ruleparser.cpp | 8 | ||||
-rw-r--r-- | src/ruleparser.h | 2 | ||||
-rw-r--r-- | src/svn.cpp | 17 |
3 files changed, 12 insertions, 15 deletions
diff --git a/src/ruleparser.cpp b/src/ruleparser.cpp index c9279ac..7ae9570 100644 --- a/src/ruleparser.cpp +++ b/src/ruleparser.cpp @@ -55,7 +55,7 @@ void Rules::load() QRegExp matchBranchLine("branch\\s+(\\S+)", Qt::CaseInsensitive); QRegExp matchRevLine("(min|max) revision (\\d+)", Qt::CaseInsensitive); QRegExp matchAnnotateLine("annotated\\s+(\\S+)", Qt::CaseInsensitive); - QRegExp matchRootDirLine("rootdir\\s+(\\S+)", Qt::CaseInsensitive); + QRegExp matchPrefixLine("prefix\\s+(\\S+)", Qt::CaseInsensitive); QTextStream s(&file); enum { ReadingNone, ReadingRepository, ReadingMatch } state = ReadingNone; @@ -99,8 +99,10 @@ void Rules::load() else // must be max match.maxRevision = matchRevLine.cap(2).toInt(); continue; - } else if (matchRootDirLine.exactMatch(line)) { - match.rootdir = QRegExp(matchRootDirLine.cap(1), Qt::CaseSensitive, QRegExp::RegExp2); + } else if (matchPrefixLine.exactMatch(line)) { + match.prefix = matchPrefixLine.cap(1); + if( match.prefix.startsWith('/')) + qFatal("Prefix starts with \"/\" on line %d, this can cause git-fast-import to crach.", lineNumber ); continue; } else if (matchActionLine.exactMatch(line)) { QString action = matchActionLine.cap(1); diff --git a/src/ruleparser.h b/src/ruleparser.h index 4ff77a2..8d0fcb2 100644 --- a/src/ruleparser.h +++ b/src/ruleparser.h @@ -44,7 +44,7 @@ public: QRegExp rx; QString repository; QString branch; - QRegExp rootdir; + QString prefix; int minRevision; int maxRevision; int lineNumber; diff --git a/src/svn.cpp b/src/svn.cpp index 5f3dc28..7a51ea7 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -187,7 +187,6 @@ findMatchRule(const MatchRuleList &matchRules, int revnum, const QString ¤ if (it->action == Rules::Match::Recurse && ruleMask & NoRecurseRule) continue; if (it->rx.indexIn(current) == 0) { - it->rootdir.indexIn(current); //Force a match run return it; } } @@ -200,28 +199,24 @@ static void splitPathName(const Rules::Match &rule, const QString &pathName, QSt QString *repository_p, QString *branch_p, QString *path_p) { QString svnprefix = pathName; - QString fullsvnprefix = pathName; - if( rule.rootdir.pattern().isEmpty() ) - svnprefix.truncate(rule.rx.matchedLength()); - else - svnprefix.truncate(rule.rootdir.matchedLength()); - fullsvnprefix.truncate(rule.rx.matchedLength()); + svnprefix.truncate(rule.rx.matchedLength()); + if (svnprefix_p) { *svnprefix_p = svnprefix; } if (repository_p) { - *repository_p = fullsvnprefix; + *repository_p = svnprefix; repository_p->replace(rule.rx, rule.repository); } if (branch_p) { - *branch_p = fullsvnprefix; + *branch_p = svnprefix; branch_p->replace(rule.rx, rule.branch); } if (path_p) { - *path_p = pathName.mid(svnprefix.length()); + *path_p = rule.prefix + pathName.mid(svnprefix.length()); } } @@ -550,7 +545,7 @@ int SvnRevision::exportDispatch(const char *key, const svn_fs_path_change_t *cha apr_hash_t *changes, const QString ¤t, const Rules::Match &rule, apr_pool_t *pool) { - if(CommandLineParser::instance()->contains( QLatin1String("debug-rules"))) + if(CommandLineParser::instance()->contains( QLatin1String("debug-rules")) && rule.action != Rules::Match::Ignore) qDebug() << " " << qPrintable(current) << "matched rule:" << rule.lineNumber << "(" << rule.rx.pattern() << ")"; switch (rule.action) { case Rules::Match::Ignore: |