aboutsummaryrefslogtreecommitdiffstats
path: root/src/repository.cpp
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2010-07-20 22:08:24 +0530
committerRaja R Harinath <harinath@hurrynot.org>2010-07-21 00:47:33 +0530
commit0e512033f95a4b2153aecf7c6bd677f626eb7138 (patch)
tree1ef5011bc7c7b80456aa792af9cd28ec9c442ea2 /src/repository.cpp
parent09c6fbf79bd4e8821b799ccf79f4046a5eed6592 (diff)
downloadsvn2git-0e512033f95a4b2153aecf7c6bd677f626eb7138.tar
svn2git-0e512033f95a4b2153aecf7c6bd677f626eb7138.tar.gz
svn2git-0e512033f95a4b2153aecf7c6bd677f626eb7138.tar.bz2
svn2git-0e512033f95a4b2153aecf7c6bd677f626eb7138.tar.xz
svn2git-0e512033f95a4b2153aecf7c6bd677f626eb7138.zip
Re-arrange Repository::createBranch to be closer to resetBranch
While at it, make progress message for the "unknown from" case similar to the normal progress message. This ensures that any reconstructed branch data-structure will not lose any information.
Diffstat (limited to 'src/repository.cpp')
-rw-r--r--src/repository.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/repository.cpp b/src/repository.cpp
index 913ef73..d0826e5 100644
--- a/src/repository.cpp
+++ b/src/repository.cpp
@@ -279,18 +279,6 @@ int Repository::createBranch(const QString &branch, int revnum,
<< "Going to create it automatically";
}
- QByteArray branchRef = branch.toUtf8();
- if (!branchRef.startsWith("refs/"))
- branchRef.prepend("refs/heads/");
-
- Branch &br = branches[branch];
- if (br.created && br.created != revnum && br.marks.last()) {
- QByteArray backupBranch = branchRef + '_' + QByteArray::number(revnum);
- qWarning() << branch << "already exists; backing up to" << backupBranch;
-
- fastImport.write("reset " + backupBranch + "\nfrom " + branchRef + "\n\n");
- }
-
Branch &brFrom = branches[branchFrom];
if (!brFrom.created) {
qCritical() << branch << "in repository" << name
@@ -314,11 +302,6 @@ int Repository::createBranch(const QString &branch, int revnum,
}
}
- // now create the branch
- br.created = revnum;
- br.commits.append(revnum);
- br.marks.append(mark);
-
QByteArray branchFromRef = ":" + QByteArray::number(mark);
if (!mark) {
qWarning() << branch << "in repository" << name << "is branching but no exported commits exist in repository"
@@ -326,12 +309,29 @@ int Repository::createBranch(const QString &branch, int revnum,
branchFromRef = branchFrom.toUtf8();
if (!branchFromRef.startsWith("refs/"))
branchFromRef.prepend("refs/heads/");
- branchFromDesc = "at unknown r" + QByteArray::number(branchRevNum);
+ branchFromDesc += ", deleted/unknown";
}
+ QByteArray branchRef = branch.toUtf8();
+ if (!branchRef.startsWith("refs/"))
+ branchRef.prepend("refs/heads/");
+
+ Branch &br = branches[branch];
+ if (br.created && br.created != revnum && br.marks.last()) {
+ QByteArray backupBranch = branchRef + '_' + QByteArray::number(revnum);
+ qWarning() << branch << "already exists; backing up to" << backupBranch;
+
+ fastImport.write("reset " + backupBranch + "\nfrom " + branchRef + "\n\n");
+ }
+
+ // now create the branch
+ br.created = revnum;
+ br.commits.append(revnum);
+ br.marks.append(mark);
+
fastImport.write("reset " + branchRef + "\nfrom " + branchFromRef + "\n\n"
"progress SVN r" + QByteArray::number(revnum)
- + " branch " + branch.toUtf8() + " = " + branchFromRef
+ + " branch " + branch.toUtf8() + " = :" + QByteArray::number(mark)
+ " # " + branchFromDesc
+ "\n\n");