]> andersk Git - svn-all-fast-export.git/blobdiff - src/repository.cpp
Support Qt 4.3 too
[svn-all-fast-export.git] / src / repository.cpp
index 890c10c9329f88ff356fefa3d4de0c8a333ffb4e..cfe4db93425df8f54df3daa1ac62541554eac777 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include "repository.h"
+#include "options.h"
 #include <QTextStream>
 #include <QDebug>
 #include <QLinkedList>
@@ -39,13 +40,17 @@ public:
 
     inline void remove(Repository *repo)
     {
+#if QT_VERSION >= 0x040400
         removeOne(repo);
+#else
+        removeAll(repo);
+#endif
     }
 };
 static ProcessCache processCache;
 
 Repository::Repository(const Rules::Repository &rule)
-    : name(rule.name), commitCount(0), processHasStarted(false)
+    : name(rule.name), commitCount(0), outstandingTransactions(0), processHasStarted(false)
 {
     foreach (Rules::Repository::Branch branchRule, rule.branches) {
         Branch branch;
@@ -62,6 +67,7 @@ Repository::Repository(const Rules::Repository &rule)
 
 Repository::~Repository()
 {
+    Q_ASSERT(outstandingTransactions == 0);
     closeFastImport();
 }
 
@@ -154,11 +160,12 @@ Repository::Transaction *Repository::newTransaction(const QString &branch, const
     txn->svnprefix = svnprefix.toUtf8();
     txn->datetime = 0;
     txn->revnum = revnum;
-    txn->lastmark = revnum;
 
     if ((++commitCount % 10000) == 0)
         // write everything to disk every 10000 commits
         fastImport.write("checkpoint\n");
+    if (outstandingTransactions++ == 0)
+        lastmark = 1;           // reset the mark number
     return txn;
 }
 
@@ -188,6 +195,7 @@ void Repository::startFastImport()
 
 Repository::Transaction::~Transaction()
 {
+    --repository->outstandingTransactions;
 }
 
 void Repository::Transaction::setAuthor(const QByteArray &a)
@@ -212,7 +220,7 @@ void Repository::Transaction::deleteFile(const QString &path)
 
 QIODevice *Repository::Transaction::addFile(const QString &path, int mode, qint64 length)
 {
-    int mark = ++lastmark;
+    int mark = ++repository->lastmark;
 
     if (modifiedFiles.capacity() == 0)
         modifiedFiles.reserve(2048);
@@ -243,7 +251,8 @@ void Repository::Transaction::commit()
     QByteArray message = log;
     if (!message.endsWith('\n'))
         message += '\n';
-    message += "\nsvn path=" + svnprefix + "; revision=" + QByteArray::number(revnum) + "\n";
+    if (Options::globalOptions->switches.value("metadata", true))
+        message += "\nsvn path=" + svnprefix + "; revision=" + QByteArray::number(revnum) + "\n";
 
     {
         QByteArray branchRef = branch;
@@ -252,7 +261,6 @@ void Repository::Transaction::commit()
 
         QTextStream s(&repository->fastImport);
         s << "commit " << branchRef << endl;
-        s << "mark :" << revnum << endl;
         s << "committer " << QString::fromUtf8(author) << ' ' << datetime << " -0000" << endl;
 
         Branch &br = repository->branches[branch];
This page took 0.133337 seconds and 4 git commands to generate.