diff options
-rw-r--r-- | src/svn.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/svn.cpp b/src/svn.cpp index f63219b..ed49f48 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -43,6 +43,7 @@ #include <svn_repos.h> #include <svn_types.h> +#include <QDir> #include <QFile> #include <QDebug> @@ -717,7 +718,29 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha if (change->change_kind == svn_fs_path_change_delete && current == svnprefix && path.isEmpty()) { if(ruledebug) qDebug() << "repository" << repository << "branch" << branch << "deleted"; - return repo->deleteBranch(branch, revnum); + + + if ("master" != branch) { + return repo->deleteBranch(branch, revnum); + } + + // Master is deleted, which generally means we're obsoleting our package + // Rename the repository instead (and keep the revision number in-case it's + // resurrected later + if (!QDir(repository).exists()) { // repo doesn't exist yet. + qCritical() << "Cannot find repository dir for" << repository; + return EXIT_FAILURE; + } + + QString newreponame = repository + "-r" + QString::number(revnum); + if (!QFile::rename(repository, newreponame)) { + qCritical() << "Could not rename repository dir for" << repository; + return EXIT_FAILURE; + } + + repositories->remove(repository); + repositories->insert(newreponame, repo); + return EXIT_SUCCESS; } QString previous; |