aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorgny Nyblom <kde@nyblom.org>2010-12-15 16:03:34 +0100
committerTorgny Nyblom <kde@nyblom.org>2010-12-15 16:03:34 +0100
commitae4fa7288cbfd27296186c85206966461fa20db6 (patch)
treec202b3b9e276143327543ba716f2c54ee0f42af3
parent4686434f149a7c6c3f6aef6f0d9f394990bc87db (diff)
downloadsvn2git-ae4fa7288cbfd27296186c85206966461fa20db6.tar
svn2git-ae4fa7288cbfd27296186c85206966461fa20db6.tar.gz
svn2git-ae4fa7288cbfd27296186c85206966461fa20db6.tar.bz2
svn2git-ae4fa7288cbfd27296186c85206966461fa20db6.tar.xz
svn2git-ae4fa7288cbfd27296186c85206966461fa20db6.zip
Move branch creation/deletion/restting to Repository and write these in
commit() Prepare for handling cvs2svn borked tags/branches
-rw-r--r--src/repository.cpp21
-rw-r--r--src/repository.h3
-rw-r--r--src/svn.cpp4
3 files changed, 23 insertions, 5 deletions
diff --git a/src/repository.cpp b/src/repository.cpp
index 6af1200..ce6d6ea 100644
--- a/src/repository.cpp
+++ b/src/repository.cpp
@@ -344,8 +344,6 @@ int Repository::deleteBranch(const QString &branch, int revnum)
int Repository::resetBranch(const QString &branch, int revnum, int mark, const QByteArray &resetTo, const QByteArray &comment)
{
- startFastImport();
-
QByteArray branchRef = branch.toUtf8();
if (!branchRef.startsWith("refs/"))
branchRef.prepend("refs/heads/");
@@ -355,21 +353,34 @@ int Repository::resetBranch(const QString &branch, int revnum, int mark, const Q
QByteArray backupBranch = "refs/backups/r" + QByteArray::number(revnum) + branchRef.mid(4);
qWarning() << "backing up branch" << branch << "to" << backupBranch;
- fastImport.write("reset " + backupBranch + "\nfrom " + branchRef + "\n\n");
+ resetBranches.append("reset " + backupBranch + "\nfrom " + branchRef + "\n\n");
}
br.created = revnum;
br.commits.append(revnum);
br.marks.append(mark);
- fastImport.write("reset " + branchRef + "\nfrom " + resetTo + "\n\n"
+ QByteArray cmd = "reset " + branchRef + "\nfrom " + resetTo + "\n\n"
"progress SVN r" + QByteArray::number(revnum)
+ " branch " + branch.toUtf8() + " = :" + QByteArray::number(mark)
- + " # " + comment + "\n\n");
+ + " # " + comment + "\n\n";
+ if(comment == "delete")
+ deletedBranches.append(cmd);
+ else
+ resetBranches.append(cmd);
return EXIT_SUCCESS;
}
+void Repository::commit()
+{
+ startFastImport();
+ fastImport.write(deletedBranches);
+ fastImport.write(resetBranches);
+ deletedBranches.clear();
+ resetBranches.clear();
+}
+
Repository::Transaction *Repository::newTransaction(const QString &branch, const QString &svnprefix,
int revnum)
{
diff --git a/src/repository.h b/src/repository.h
index 44388e0..349cf97 100644
--- a/src/repository.h
+++ b/src/repository.h
@@ -142,6 +142,7 @@ public:
const QByteArray &author, uint dt,
const QByteArray &log);
void finalizeTags();
+ void commit();
private:
struct Branch
@@ -167,6 +168,8 @@ private:
LoggingQProcess fastImport;
int commitCount;
int outstandingTransactions;
+ QByteArray deletedBranches;
+ QByteArray resetBranches;
/* starts at 0, and counts up. */
int last_commit_mark;
diff --git a/src/svn.cpp b/src/svn.cpp
index c7835ff..cf4ce23 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -506,6 +506,10 @@ int SvnRevision::commit()
// now create the commit
if (fetchRevProps() != EXIT_SUCCESS)
return EXIT_FAILURE;
+ foreach (Repository *repo, repositories.values()) {
+ repo->commit();
+ }
+
foreach (Repository::Transaction *txn, transactions) {
txn->setAuthor(authorident);
txn->setDateTime(epoch);