aboutsummaryrefslogtreecommitdiffstats
path: root/src/svn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/svn.cpp')
-rw-r--r--src/svn.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/svn.cpp b/src/svn.cpp
index b2fe2a2..f63219b 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -75,7 +75,7 @@ class SvnPrivate
{
public:
QList<MatchRuleList> allMatchRules;
- RepositoryHash repositories;
+ RepositoryHash *repositories;
IdentityHash identities;
QString userdomain;
@@ -119,7 +119,7 @@ void Svn::setMatchRules(const QList<MatchRuleList> &allMatchRules)
d->allMatchRules = allMatchRules;
}
-void Svn::setRepositories(const RepositoryHash &repositories)
+void Svn::setRepositories(RepositoryHash *repositories)
{
d->repositories = repositories;
}
@@ -145,7 +145,7 @@ bool Svn::exportRevision(int revnum)
}
SvnPrivate::SvnPrivate(const QString &pathToRepository)
- : global_pool(NULL)
+ : repositories(NULL), global_pool(NULL)
{
if( openRepository(pathToRepository) != EXIT_SUCCESS) {
qCritical() << "Failed to open repository";
@@ -398,7 +398,7 @@ public:
AprAutoPool pool;
QHash<QString, Repository::Transaction *> transactions;
QList<MatchRuleList> allMatchRules;
- RepositoryHash repositories;
+ RepositoryHash *repositories;
IdentityHash identities;
QString userdomain;
@@ -415,7 +415,7 @@ public:
bool needCommit;
SvnRevision(int revision, svn_fs_t *f, apr_pool_t *parent_pool)
- : pool(parent_pool), fs(f), fs_root(0), revnum(revision), propsFetched(false)
+ : repositories(NULL), pool(parent_pool), fs(f), fs_root(0), revnum(revision), propsFetched(false)
{
ruledebug = CommandLineParser::instance()->contains( QLatin1String("debug-rules"));
}
@@ -542,7 +542,7 @@ int SvnRevision::commit()
// now create the commit
if (fetchRevProps() != EXIT_SUCCESS)
return EXIT_FAILURE;
- foreach (Repository *repo, repositories.values()) {
+ foreach (Repository *repo, repositories->values()) {
repo->commit();
}
@@ -686,12 +686,27 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha
QString svnprefix, repository, branch, path;
splitPathName(rule, current, &svnprefix, &repository, &branch, &path);
- Repository *repo = repositories.value(repository, 0);
+ Repository *repo = repositories->value(repository, 0);
if (!repo) {
- if (change->change_kind != svn_fs_path_change_delete)
+ if (change->change_kind != svn_fs_path_change_delete) {
+ // Attempt to auto create the repo
+ qWarning() << "Auto-creating repository" << repository << "with branch"
+ << branch << "at revision" << revnum << "due to rule match";
+
+ repo = new Repository(repository, branch, revnum);
+ if (!repo)
+ return EXIT_FAILURE;
+ repositories->insert(repository, repo);
+
+ //repo->setupIncremental(INT_MAX);
+ }
+
+ if (!repo) {
qCritical() << "Rule" << rule
<< "references unknown repository" << repository;
- return EXIT_FAILURE;
+
+ return EXIT_FAILURE;
+ }
}
printf(".");