aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTorgny Nyblom <kde@nyblom.org>2010-12-13 18:11:22 +0100
committerTorgny Nyblom <kde@nyblom.org>2010-12-13 18:11:22 +0100
commit70b22862e7efd9511cc39b479223aaacbb88c3c1 (patch)
tree4f2631249a355cb2bfefa4b845fe2518f7ec4c99 /src
parentf552e045dd68788b2502bb313bf3e268fc2d6d3c (diff)
downloadsvn2git-70b22862e7efd9511cc39b479223aaacbb88c3c1.tar
svn2git-70b22862e7efd9511cc39b479223aaacbb88c3c1.tar.gz
svn2git-70b22862e7efd9511cc39b479223aaacbb88c3c1.tar.bz2
svn2git-70b22862e7efd9511cc39b479223aaacbb88c3c1.tar.xz
svn2git-70b22862e7efd9511cc39b479223aaacbb88c3c1.zip
Delete before other changes
Fix issue where if a branch reset was triggered before a branch deletion in the same revision the reset was overridden by the deletion
Diffstat (limited to 'src')
-rw-r--r--src/svn.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/svn.cpp b/src/svn.cpp
index 38e21dc..c7835ff 100644
--- a/src/svn.cpp
+++ b/src/svn.cpp
@@ -44,6 +44,8 @@
#include <svn_types.h>
#include <QFile>
+#include <QLinkedList>
+#include <QPair>
#include <QDebug>
#include "repository.h"
@@ -451,6 +453,7 @@ int SvnPrivate::exportRevision(int revnum)
int SvnRevision::prepareTransactions()
{
+ QLinkedList< QPair<svn_fs_path_change_t*, const char*> > sortedChanges;
// find out what was changed in this revision:
apr_hash_t *changes;
SVN_ERR(svn_fs_paths_changed(&changes, fs_root, pool));
@@ -461,11 +464,20 @@ int SvnRevision::prepareTransactions()
const char *key = reinterpret_cast<const char *>(vkey);
svn_fs_path_change_t *change = reinterpret_cast<svn_fs_path_change_t *>(value);
- if (exportEntry(key, change, changes) == EXIT_FAILURE)
- return EXIT_FAILURE;
+ // If we mix path deletions with path adds/replaces we might erase a branch after that it has been reset -> history truncated
+ if(change->change_kind == svn_fs_path_change_delete) {
+ sortedChanges.prepend( qMakePair(change, key) );
+ } else {
+ sortedChanges.append( qMakePair(change, key) );
+ }
}
- return EXIT_SUCCESS;
+ QPair<svn_fs_path_change_t*, const char*> pair;
+ foreach (pair, sortedChanges) {
+ if (exportEntry(pair.second, pair.first, changes) == EXIT_FAILURE)
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
}
int SvnRevision::fetchRevProps()