From 7dd430d8609e657709ae794762c6eebb0000b249 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 13 Aug 2008 12:28:45 +0200 Subject: [PATCH] Try auto-creation of branches --- src/repository.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/repository.cpp b/src/repository.cpp index ab4c1bf..538b6f0 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -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"); } -- 2.45.0