From c0fa5feaf084d4e1674b966ef9b7524bc2fe1ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20Sp=C3=B6rlein?= Date: Mon, 19 Apr 2010 23:06:00 +0200 Subject: Print more info on what is exported where --- src/repository.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/repository.cpp b/src/repository.cpp index 922027d..f7f7a30 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -376,9 +376,9 @@ void Repository::Transaction::commit() QByteArray::number(repository->commitCount) + " branch " + branch + " = SVN r" + QByteArray::number(revnum) + "\n\n"); - printf(" %d modifications to \"%s\"", - deletedFiles.count() + modifiedFiles.count(), - qPrintable(repository->name)); + printf(" %d modifications from SVN %s to %s/%s", + deletedFiles.count() + modifiedFiles.count(), svnprefix.data(), + qPrintable(repository->name), branch.data()); while (repository->fastImport.bytesToWrite()) if (!repository->fastImport.waitForBytesWritten(-1)) -- cgit v1.2.1 From 95ac50d6ecafa8a318c8aa278ab2ef1d04277dd1 Mon Sep 17 00:00:00 2001 From: Torgny Nyblom Date: Thu, 29 Apr 2010 20:48:17 +0200 Subject: Split into two rows. --- src/svn.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/svn.cpp b/src/svn.cpp index 0c859c9..7babe31 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -216,7 +216,8 @@ static void splitPathName(const Rules::Match &rule, const QString &pathName, QSt } if (path_p) { - QString prefix = svnprefix.replace(rule.rx, rule.prefix); + QString prefix = svnprefix; + prefix.replace(rule.rx, rule.prefix); *path_p = prefix + pathName.mid(svnprefix.length()); } } -- cgit v1.2.1 From 64a45f529c6e3e08b2ddbb1b23870d89a3a62cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20Sp=C3=B6rlein?= Date: Mon, 19 Apr 2010 23:06:00 +0200 Subject: Implement the replace node changeset which exists from some repositories namely the FreeBSD svn rep --- src/svn.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/svn.cpp b/src/svn.cpp index 7babe31..0e7a1b7 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -509,15 +509,31 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change svn_boolean_t is_dir; SVN_ERR(svn_fs_is_dir(&is_dir, fs_root, key, revpool)); if (is_dir) { - if (path_from == NULL) { - // no, it's a new directory being added + if (change->change_kind == svn_fs_path_change_modify || + change->change_kind == svn_fs_path_change_add) { + if (path_from == NULL) { + // freshly added directory, or modified properties // Git doesn't handle directories, so we don't either //qDebug() << " mkdir ignored:" << key; return EXIT_SUCCESS; - } + } - current += '/'; - qDebug() << " " << key << "was copied from" << path_from << "rev" << rev_from; + current += '/'; + qDebug() << " " << key << "was copied from" << path_from << "rev" << rev_from; + } else if (change->change_kind == svn_fs_path_change_delete) { + qDebug() << " " << key << "was deleted"; + } else if (change->change_kind == svn_fs_path_change_replace) { + if (path_from == NULL) + qDebug() << " " << key << "was replaced"; + else + qDebug() << " " << key << "was replaced from" << path_from << "rev" << rev_from; + } else if (change->change_kind == svn_fs_path_change_reset) { + qCritical() << " " << key << "was reset, panic!"; + return EXIT_FAILURE; + } else { + qCritical() << " " << key << "has unhandled change kind " << change->change_kind << ", panic!"; + return EXIT_FAILURE; + } } // find the first rule that matches this pathname @@ -647,6 +663,8 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha transactions.insert(repository + branch, txn); } + if (change->change_kind == svn_fs_path_change_replace && path_from == NULL) + txn->deleteFile(path); if (change->change_kind == svn_fs_path_change_delete) { txn->deleteFile(path); } else if (!current.endsWith('/')) { -- cgit v1.2.1 From 80d1c990170ac8771da9607cdcf498f57996a949 Mon Sep 17 00:00:00 2001 From: Torgny Nyblom Date: Mon, 3 May 2010 20:07:04 +0200 Subject: Fix svn.replace --- src/svn.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/svn.cpp b/src/svn.cpp index 0e7a1b7..bb00214 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -509,16 +509,16 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change svn_boolean_t is_dir; SVN_ERR(svn_fs_is_dir(&is_dir, fs_root, key, revpool)); if (is_dir) { + current += '/'; if (change->change_kind == svn_fs_path_change_modify || change->change_kind == svn_fs_path_change_add) { if (path_from == NULL) { - // freshly added directory, or modified properties - // Git doesn't handle directories, so we don't either - //qDebug() << " mkdir ignored:" << key; - return EXIT_SUCCESS; + // freshly added directory, or modified properties + // Git doesn't handle directories, so we don't either + //qDebug() << " mkdir ignored:" << key; + return EXIT_SUCCESS; } - current += '/'; qDebug() << " " << key << "was copied from" << path_from << "rev" << rev_from; } else if (change->change_kind == svn_fs_path_change_delete) { qDebug() << " " << key << "was deleted"; -- cgit v1.2.1 From 209e6ce4ddf114494d6d72455690af819dcbf18c Mon Sep 17 00:00:00 2001 From: Torgny Nyblom Date: Tue, 4 May 2010 07:03:14 +0200 Subject: Try and branch from the correct svn revision rather then the last one. --- src/repository.cpp | 30 +++++++++++++++++++++--------- src/repository.h | 3 +++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/repository.cpp b/src/repository.cpp index f7f7a30..426eeff 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -120,7 +120,7 @@ void Repository::reloadBranches() } void Repository::createBranch(const QString &branch, int revnum, - const QString &branchFrom, int) + const QString &branchFrom, int branchRevNum) { startFastImport(); if (!branches.contains(branch)) { @@ -129,8 +129,9 @@ void Repository::createBranch(const QString &branch, int revnum, } QByteArray branchRef = branch.toUtf8(); - if (!branchRef.startsWith("refs/")) - branchRef.prepend("refs/heads/"); + if (!branchRef.startsWith("refs/")) + branchRef.prepend("refs/heads/"); + Branch &br = branches[branch]; if (br.created && br.created != revnum) { @@ -142,9 +143,18 @@ void Repository::createBranch(const QString &branch, int revnum, // now create the branch br.created = revnum; - QByteArray branchFromRef = branchFrom.toUtf8(); - if (!branchFromRef.startsWith("refs/")) - branchFromRef.prepend("refs/heads/"); + QByteArray branchFromRef; + const int closestCommit = *qLowerBound(exportedCommits, branchRevNum); + if(commitMarks.contains(closestCommit)) + { + branchFromRef = ":" + QByteArray::number(commitMarks.value(closestCommit)); + } else { + qWarning() << branch << "in repository" << name << "is branching but no exported commits exist in repository" + << "creating an empty branch."; + branchFromRef = branchFrom.toUtf8(); + if (!branchFromRef.startsWith("refs/")) + branchFromRef.prepend("refs/heads/"); + } if (!branches.contains(branchFrom) || !branches.value(branchFrom).created) { qCritical() << branch << "in repository" << name @@ -155,7 +165,7 @@ void Repository::createBranch(const QString &branch, int revnum, fastImport.write("reset " + branchRef + "\nfrom " + branchFromRef + "\n\n" "progress Branch " + branchRef + " created from " - + branchFromRef + " r" + QByteArray::number(revnum) + "\n\n"); + + branchFromRef + " r" + QByteArray::number(branchRevNum) + "\n\n"); } Repository::Transaction *Repository::newTransaction(const QString &branch, const QString &svnprefix, @@ -177,8 +187,7 @@ Repository::Transaction *Repository::newTransaction(const QString &branch, const if ((++commitCount % CommandLineParser::instance()->optionArgument(QLatin1String("commit-interval"), QLatin1String("10000")).toInt()) == 0) // write everything to disk every 10000 commits fastImport.write("checkpoint\n"); - if (outstandingTransactions++ == 0) - lastmark = 1; // reset the mark number + outstandingTransactions++; return txn; } @@ -347,6 +356,9 @@ void Repository::Transaction::commit() QTextStream s(&repository->fastImport); s << "commit " << branchRef << endl; + s << "mark :" << QByteArray::number(++repository->lastmark) << endl; + repository->commitMarks.insert(revnum, repository->lastmark); + repository->exportedCommits.append(revnum); s << "committer " << QString::fromUtf8(author) << ' ' << datetime << " -0000" << endl; Branch &br = repository->branches[branch]; diff --git a/src/repository.h b/src/repository.h index c00518a..629616b 100644 --- a/src/repository.h +++ b/src/repository.h @@ -20,6 +20,7 @@ #include #include +#include #include "ruleparser.h" @@ -84,6 +85,8 @@ private: QHash branches; QHash annotatedTags; + QHash commitMarks; + QVector exportedCommits; QString name; QProcess fastImport; int commitCount; -- cgit v1.2.1