Skip to content

Commit e44134e

Browse files
committed
Don't stop if rules match
1 parent d8084f9 commit e44134e

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

src/svn.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,14 @@ int SvnPrivate::openRepository(const QString &pathToRepository)
193193

194194
enum RuleType { AnyRule = 0, NoIgnoreRule = 0x01, NoRecurseRule = 0x02 };
195195

196-
static MatchRuleList::ConstIterator
197-
findMatchRule(const MatchRuleList &matchRules, int revnum, const QString &current,
198-
int ruleMask = AnyRule)
199-
{
200-
MatchRuleList::ConstIterator it = matchRules.constBegin(),
196+
static MatchRuleList::ConstIterator findMatchRule(
197+
const MatchRuleList &matchRules,
198+
int revnum,
199+
const QString &current,
200+
const MatchRuleList::ConstIterator from,
201+
int ruleMask = AnyRule
202+
) {
203+
MatchRuleList::ConstIterator it = from,
201204
end = matchRules.constEnd();
202205
for ( ; it != end; ++it) {
203206
if (it->minRevision > revnum)
@@ -630,13 +633,19 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change2_t *chang
630633
//Replace all returns with continue,
631634
bool isHandled = false;
632635
foreach ( const MatchRuleList matchRules, allMatchRules ) {
633-
// find the first rule that matches this pathname
634-
MatchRuleList::ConstIterator match = findMatchRule(matchRules, revnum, current);
635-
if (match != matchRules.constEnd()) {
636+
MatchRuleList::ConstIterator match = matchRules.constBegin();
637+
while (true) {
638+
// find each rule that matches this pathname
639+
match = findMatchRule(matchRules, revnum, current, match);
640+
if (match == matchRules.constEnd()) break;
636641
const Rules::Match &rule = *match;
637642
if ( exportDispatch(key, change, path_from, rev_from, changes, current, rule, matchRules, revpool) == EXIT_FAILURE )
638643
return EXIT_FAILURE;
639644
isHandled = true;
645+
++match;
646+
}
647+
if (isHandled) {
648+
// while loop found rules
640649
} else if (is_dir && path_from != NULL) {
641650
qDebug() << current << "is a copy-with-history, auto-recursing";
642651
if ( recurse(key, change, path_from, matchRules, rev_from, changes, revpool) == EXIT_FAILURE )
@@ -738,7 +747,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
738747
previous += '/';
739748
}
740749
MatchRuleList::ConstIterator prevmatch =
741-
findMatchRule(matchRules, rev_from, previous, NoIgnoreRule);
750+
findMatchRule(matchRules, rev_from, previous, matchRules.constBegin(), NoIgnoreRule);
742751
if (prevmatch != matchRules.constEnd()) {
743752
splitPathName(*prevmatch, previous, &prevsvnprefix, &prevrepository,
744753
&preveffectiverepository, &prevbranch, &prevpath);
@@ -995,7 +1004,7 @@ int SvnRevision::recursiveDumpDir(Repository::Transaction *txn, svn_fs_t *fs, sv
9951004
entryFinalName += '/';
9961005
QString entryNameQString = entryName + '/';
9971006

998-
MatchRuleList::ConstIterator match = findMatchRule(matchRules, revnum, entryNameQString);
1007+
MatchRuleList::ConstIterator match = findMatchRule(matchRules, revnum, entryNameQString, matchRules.constBegin());
9991008
if (match == matchRules.constEnd()) continue; // no match of parent repo? (should not happen)
10001009

10011010
const Rules::Match &matchedRule = *match;
@@ -1076,12 +1085,18 @@ int SvnRevision::recurse(const char *path, const svn_fs_path_change2_t *change,
10761085
current += '/';
10771086

10781087
// find the first rule that matches this pathname
1079-
MatchRuleList::ConstIterator match = findMatchRule(matchRules, revnum, current);
1080-
if (match != matchRules.constEnd()) {
1088+
bool matched = false;
1089+
MatchRuleList::ConstIterator match = matchRules.constBegin();
1090+
while (true) {
1091+
match = findMatchRule(matchRules, revnum, current, match);
1092+
if (match == matchRules.constEnd()) break;
1093+
matched = true;
10811094
if (exportDispatch(entry, change, entryFrom.isNull() ? 0 : entryFrom.constData(),
10821095
rev_from, changes, current, *match, matchRules, dirpool) == EXIT_FAILURE)
10831096
return EXIT_FAILURE;
1084-
} else {
1097+
++match;
1098+
}
1099+
if (!matched) {
10851100
if (i.value() == svn_node_dir) {
10861101
qDebug() << current << "rev" << revnum
10871102
<< "did not match any rules; auto-recursing";

0 commit comments

Comments
 (0)