aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2010-07-20 21:04:29 +0530
committerRaja R Harinath <harinath@hurrynot.org>2010-07-20 21:04:29 +0530
commit4f080c2c934d5caa7a8eae8123cfbab7a735cc11 (patch)
treed2a25ea2296c27b03b8232a0067fd7dccb4d56ff
parent8cdfe443e65b3882f9e5cd08c083ad03184d2741 (diff)
downloadsvn2git-4f080c2c934d5caa7a8eae8123cfbab7a735cc11.tar
svn2git-4f080c2c934d5caa7a8eae8123cfbab7a735cc11.tar.gz
svn2git-4f080c2c934d5caa7a8eae8123cfbab7a735cc11.tar.bz2
svn2git-4f080c2c934d5caa7a8eae8123cfbab7a735cc11.tar.xz
svn2git-4f080c2c934d5caa7a8eae8123cfbab7a735cc11.zip
Remove exit(1) in createBranch. Return EXIT_SUCCESS/EXIT_FAILURE instead
Allow graceful exit of all fast-import processes when createBranch fails. For consistency, add return value to deleteBranch, even though it always returns EXIT_SUCCESS.
-rw-r--r--src/repository.cpp10
-rw-r--r--src/repository.h6
-rw-r--r--src/svn.cpp6
3 files changed, 13 insertions, 9 deletions
diff --git a/src/repository.cpp b/src/repository.cpp
index 57db6c7..cf36c1f 100644
--- a/src/repository.cpp
+++ b/src/repository.cpp
@@ -270,7 +270,7 @@ void Repository::reloadBranches()
}
}
-void Repository::createBranch(const QString &branch, int revnum,
+int Repository::createBranch(const QString &branch, int revnum,
const QString &branchFrom, int branchRevNum)
{
startFastImport();
@@ -296,7 +296,7 @@ void Repository::createBranch(const QString &branch, int revnum,
qCritical() << branch << "in repository" << name
<< "is branching from branch" << branchFrom
<< "but the latter doesn't exist. Can't continue.";
- exit(1);
+ return EXIT_FAILURE;
}
int mark = 0;
@@ -334,9 +334,11 @@ void Repository::createBranch(const QString &branch, int revnum,
+ " branch " + branch.toUtf8() + " = " + branchFromRef
+ " # " + branchFromDesc
+ "\n\n");
+
+ return EXIT_SUCCESS;
}
-void Repository::deleteBranch(const QString &branch, int revnum)
+int Repository::deleteBranch(const QString &branch, int revnum)
{
startFastImport();
QByteArray branchRef = branch.toUtf8();
@@ -359,6 +361,8 @@ void Repository::deleteBranch(const QString &branch, int revnum)
fastImport.write("reset " + branchRef + "\nfrom " + null_sha + "\n\n"
"progress SVN r" + QByteArray::number(revnum)
+ " branch " + branch.toUtf8() + " = :0 # delete\n\n");
+
+ return EXIT_SUCCESS;
}
Repository::Transaction *Repository::newTransaction(const QString &branch, const QString &svnprefix,
diff --git a/src/repository.h b/src/repository.h
index 44a6c14..ec821e2 100644
--- a/src/repository.h
+++ b/src/repository.h
@@ -65,9 +65,9 @@ public:
~Repository();
void reloadBranches();
- void createBranch(const QString &branch, int revnum,
- const QString &branchFrom, int revFrom);
- void deleteBranch(const QString &branch, int revnum);
+ int createBranch(const QString &branch, int revnum,
+ const QString &branchFrom, int revFrom);
+ int deleteBranch(const QString &branch, int revnum);
Transaction *newTransaction(const QString &branch, const QString &svnprefix, int revnum);
void createAnnotatedTag(const QString &name, const QString &svnprefix, int revnum,
diff --git a/src/svn.cpp b/src/svn.cpp
index b23e629..317bd3c 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -618,8 +618,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha
if (change->change_kind == svn_fs_path_change_delete && current == svnprefix) {
qDebug() << "repository" << repository << "branch" << branch << "deleted";
- repo->deleteBranch(branch, revnum);
- return EXIT_SUCCESS;
+ return repo->deleteBranch(branch, revnum);
}
QString previous;
@@ -671,7 +670,8 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha
<< qPrintable(prevbranch);
}
- repo->createBranch(branch, revnum, prevbranch, rev_from);
+ if (repo->createBranch(branch, revnum, prevbranch, rev_from) == EXIT_FAILURE)
+ return EXIT_FAILURE;
if (rule.annotate) {
// create an annotated tag
fetchRevProps();