]> andersk Git - svn-all-fast-export.git/commitdiff
Try auto-creation of branches
authorThiago Macieira <thiago@doriath.(none)>
Wed, 13 Aug 2008 10:28:45 +0000 (12:28 +0200)
committerThiago Macieira <thiago.macieira@trolltech.com>
Wed, 13 Aug 2008 10:28:59 +0000 (12:28 +0200)
src/repository.cpp

index ab4c1bf82b3face6973148ad4791ae669dee97a3..538b6f069d331def03227575bb1ca55d103e0706 100644 (file)
@@ -77,8 +77,8 @@ void Repository::createBranch(const QString &branch, int revnum,
                               const QString &branchFrom, int)
 {
     if (!branches.contains(branch)) {
-        qCritical() << branch << "is not a known branch in repository" << name;
-        exit(1);
+        qWarning() << branch << "is not a known branch in repository" << name << endl
+                   << "Going to create it automatically";
     }
 
     startFastImport();
@@ -100,6 +100,13 @@ void Repository::createBranch(const QString &branch, int revnum,
     if (!branchFromRef.startsWith("refs/"))
         branchFromRef.prepend("refs/heads/");
 
+    if (!branches.contains(branchFrom) || !branches.value(branchFrom).created) {
+        qCritical() << branch << "in repository" << name
+                    << "is branching from branch" << branchFrom
+                    << "but the latter doesn't exist. Can't continue.";
+        exit(1);
+    }
+
     fastImport.write("reset " + branchRef + "\nfrom " + branchFromRef + "\n\n");
 }
 
This page took 0.034189 seconds and 5 git commands to generate.