Skip to content

Commit cf94ee3

Browse files
not-implementedtnyblom
authored andcommitted
Fixed ignoring of subpaths inside a repository (implemented rule matching for recursiveDumpDir) (#33)
1 parent efba961 commit cf94ee3

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/svn.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ static int dumpBlob(Repository::Transaction *txn, svn_fs_root_t *fs_root,
305305

306306
static int recursiveDumpDir(Repository::Transaction *txn, svn_fs_root_t *fs_root,
307307
const QByteArray &pathname, const QString &finalPathName,
308-
apr_pool_t *pool)
308+
apr_pool_t *pool, svn_revnum_t revnum,
309+
const Rules::Match &rule, const MatchRuleList &matchRules,
310+
bool ruledebug)
309311
{
310312
// get the dir listing
311313
apr_hash_t *entries;
@@ -332,7 +334,19 @@ static int recursiveDumpDir(Repository::Transaction *txn, svn_fs_root_t *fs_root
332334

333335
if (i.value() == svn_node_dir) {
334336
entryFinalName += '/';
335-
if (recursiveDumpDir(txn, fs_root, entryName, entryFinalName, dirpool) == EXIT_FAILURE)
337+
QString entryNameQString = entryName + '/';
338+
339+
MatchRuleList::ConstIterator match = findMatchRule(matchRules, revnum, entryNameQString);
340+
if (match == matchRules.constEnd()) continue; // no match of parent repo? (should not happen)
341+
342+
const Rules::Match &matchedRule = *match;
343+
if (matchedRule.action != Rules::Match::Export || matchedRule.repository != rule.repository) {
344+
if (ruledebug)
345+
qDebug() << "recursiveDumpDir:" << entryNameQString << "skip entry for different/ignored repository";
346+
continue;
347+
}
348+
349+
if (recursiveDumpDir(txn, fs_root, entryName, entryFinalName, dirpool, revnum, rule, matchRules, ruledebug) == EXIT_FAILURE)
336350
return EXIT_FAILURE;
337351
} else if (i.value() == svn_node_file) {
338352
printf("+");
@@ -827,7 +841,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
827841
if(ruledebug)
828842
qDebug() << "Create a true SVN copy of branch (" << key << "->" << branch << path << ")";
829843
txn->deleteFile(path);
830-
recursiveDumpDir(txn, fs_root, key, path, pool);
844+
recursiveDumpDir(txn, fs_root, key, path, pool, revnum, rule, matchRules, ruledebug);
831845
}
832846
if (rule.annotate) {
833847
// create an annotated tag
@@ -911,7 +925,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
911925
if (ignoreSet == false) {
912926
txn->deleteFile(path);
913927
}
914-
recursiveDumpDir(txn, fs_root, key, path, pool);
928+
recursiveDumpDir(txn, fs_root, key, path, pool, revnum, rule, matchRules, ruledebug);
915929
}
916930

917931
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)