aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJehan Bing <nahor.j@gmail.com>2011-03-10 10:54:52 -0800
committerTorgny Nyblom <kde@nyblom.org>2011-03-21 18:38:26 +0100
commit584005f2e26149282aa12c4a0367d250caaf3918 (patch)
tree621adf0e7644446d08d30f17a79742cf85234b69
parent34f881571e48b6fb71f687944ff4420d589a6d22 (diff)
downloadsvn2git-584005f2e26149282aa12c4a0367d250caaf3918.tar
svn2git-584005f2e26149282aa12c4a0367d250caaf3918.tar.gz
svn2git-584005f2e26149282aa12c4a0367d250caaf3918.tar.bz2
svn2git-584005f2e26149282aa12c4a0367d250caaf3918.tar.xz
svn2git-584005f2e26149282aa12c4a0367d250caaf3918.zip
Create backup reference before deletion of the original branch
Ensure that the backup reference is created before deleting the original branch. As it was, the deletion was executed earlier causing the backup reference to point to a non-existing branch so was not created.
-rw-r--r--src/repository.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/repository.cpp b/src/repository.cpp
index 7de840f..2c70bf3 100644
--- a/src/repository.cpp
+++ b/src/repository.cpp
@@ -349,11 +349,12 @@ int Repository::resetBranch(const QString &branch, int revnum, int mark, const Q
branchRef.prepend("refs/heads/");
Branch &br = branches[branch];
+ QByteArray backupCmd;
if (br.created && br.created != revnum && !br.marks.isEmpty() && br.marks.last()) {
QByteArray backupBranch = "refs/backups/r" + QByteArray::number(revnum) + branchRef.mid(4);
qWarning() << "WARN: backing up branch" << branch << "to" << backupBranch;
- resetBranches.append("reset " + backupBranch + "\nfrom " + branchRef + "\n\n");
+ backupCmd = "reset " + backupBranch + "\nfrom " + branchRef + "\n\n";
}
br.created = revnum;
@@ -365,9 +366,9 @@ int Repository::resetBranch(const QString &branch, int revnum, int mark, const Q
+ " branch " + branch.toUtf8() + " = :" + QByteArray::number(mark)
+ " # " + comment + "\n\n";
if(comment == "delete")
- deletedBranches.append(cmd);
+ deletedBranches.append(backupCmd).append(cmd);
else
- resetBranches.append(cmd);
+ resetBranches.append(backupCmd).append(cmd);
return EXIT_SUCCESS;
}