From 9677b1fea3ab82db3e9185439938d9e2380e02d4 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Fri, 8 Apr 2011 07:16:44 +0200 Subject: Save deleted branches in a visible namespace - The branch is first created properly and then deleted (line "progress SVN r77 branch config-header = :0 # delete") - Jehan's post-1.0.3 commit 584005f2e26149282aa12c4a0367d250caaf3918 writes a backup of the branches latest ref to refs/backup/ on deletion. Many thanks for that commit! However, in my opinion the problem with the current code is that it makes it much too easy to lose history during the conversion to Git. Without a tag or branch pointing to it the commits will fall off easily, especially if people use "git clone" on the bare Git repository created by svn2git. It would be safer and useful to create visible tags for this, e.g. refs/tags/branch-bugfix17-deleted. My attached patch changes Jehan's code to do just that. Please consider application - this patch really matters to me. If you'd rather have both a ref in refs/backup/ and in refs/tags/ or require a command line option for it I can adjust the patch for you. Thanks for listening, --- src/repository.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/repository.cpp b/src/repository.cpp index 2c70bf3..2f8e16f 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -351,7 +351,11 @@ int Repository::resetBranch(const QString &branch, int revnum, int mark, const Q 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); + QByteArray backupBranch; + if ((comment == "delete") && branchRef.startsWith("refs/heads/")) + backupBranch = "refs/tags/backups/" + branchRef.mid(11) + "@" + QByteArray::number(revnum); + else + backupBranch = "refs/backups/r" + QByteArray::number(revnum) + branchRef.mid(4); qWarning() << "WARN: backing up branch" << branch << "to" << backupBranch; backupCmd = "reset " + backupBranch + "\nfrom " + branchRef + "\n\n"; -- cgit v1.2.1