]> andersk Git - svn-all-fast-export.git/blobdiff - src/repository.cpp
Keep track of when a given branch was created instead
[svn-all-fast-export.git] / src / repository.cpp
index 38b7b1b92ef2044dd7ce578a8e99de85506d322d..1cb7c410a0370f38f4b76b51f94829fc4c1230b0 100644 (file)
@@ -24,13 +24,13 @@ Repository::Repository(const Rules::Repository &rule)
 {
     foreach (Rules::Repository::Branch branchRule, rule.branches) {
         Branch branch;
-        branch.isCreated = false;
+        branch.created = 0;     // not created
 
         branches.insert(branchRule.name, branch);
     }
 
     // create the default branch
-    branches["master"].isCreated = true;
+    branches["master"].created = 1;
 
     fastImport.setWorkingDirectory(name);
 }
@@ -68,7 +68,7 @@ void Repository::reloadBranches()
             startFastImport();
             fastImport.write("reset " + branchRef.toUtf8() +
                              "\nfrom " + branchRef.toUtf8() + "^0\n\n");
-            it->isCreated = true;
+            it->created = 1;
         }
     }
 }
@@ -87,7 +87,7 @@ void Repository::createBranch(const QString &branch, int revnum,
         branchRef.prepend("refs/heads/");
 
     Branch &br = branches[branch];
-    if (br.isCreated) {
+    if (br.created && br.created != revnum) {
         QByteArray backupBranch = branchRef + '_' + QByteArray::number(revnum);
         qWarning() << branch << "already exists; backing up to" << backupBranch;
 
@@ -95,7 +95,7 @@ void Repository::createBranch(const QString &branch, int revnum,
     }
 
     // now create the branch
-    br.isCreated = true;
+    br.created = revnum;
     QByteArray branchFromRef = branchFrom.toUtf8();
     if (!branchFromRef.startsWith("refs/"))
         branchFromRef.prepend("refs/heads/");
@@ -201,9 +201,7 @@ void Repository::Transaction::commit()
         s << "committer " << author << ' ' << datetime << " -0000" << endl;
 
         Branch &br = repository->branches[branch];
-        if (!br.isCreated) {
-            br.isCreated = true;
-        }
+        Q_ASSERT(br.created);
 
         s << "data " << message.length() << endl;
     }
@@ -211,8 +209,11 @@ void Repository::Transaction::commit()
     repository->fastImport.write(message);
 
     // write the file deletions
-    foreach (QString df, deletedFiles)
-        repository->fastImport.write("D " + df.toUtf8() + "\n");
+    if (deletedFiles.contains(""))
+        repository->fastImport.write("deleteall\n");
+    else
+        foreach (QString df, deletedFiles)
+            repository->fastImport.write("D " + df.toUtf8() + "\n");
 
     // write the file modifications
     QHash<QString, FileProperties>::ConstIterator it = modifiedFiles.constBegin();
This page took 0.028523 seconds and 4 git commands to generate.