diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2011-04-08 07:16:44 +0200 |
---|---|---|
committer | Torgny Nyblom <kde@nyblom.org> | 2011-04-08 07:16:44 +0200 |
commit | 9677b1fea3ab82db3e9185439938d9e2380e02d4 (patch) | |
tree | f58eb3bec6cbf8d14c641b3f8a9e1fd84b757824 | |
parent | 584005f2e26149282aa12c4a0367d250caaf3918 (diff) | |
download | svn2git-9677b1fea3ab82db3e9185439938d9e2380e02d4.tar svn2git-9677b1fea3ab82db3e9185439938d9e2380e02d4.tar.gz svn2git-9677b1fea3ab82db3e9185439938d9e2380e02d4.tar.bz2 svn2git-9677b1fea3ab82db3e9185439938d9e2380e02d4.tar.xz svn2git-9677b1fea3ab82db3e9185439938d9e2380e02d4.zip |
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,
-rw-r--r-- | src/repository.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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"; |