From: Thiago Macieira Date: Sun, 23 Dec 2007 16:50:27 +0000 (-0200) Subject: Add the Repository class X-Git-Url: http://andersk.mit.edu/gitweb/svn-all-fast-export.git/commitdiff_plain/5a7327f691416d3b061318da00fbd85a341f710a Add the Repository class --- diff --git a/src/repository.cpp b/src/repository.cpp new file mode 100644 index 0000000..c3174b8 --- /dev/null +++ b/src/repository.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2007 Thiago Macieira + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "repository.h" + +Repository::Repository(const Rules::Repository &rule) +{ + foreach (Rules::Repository::Branch branchRule, rule.branches) { + Branch branch; + branch.branchFrom = branchRule.branchFrom; + branch.isCreated = false; + + branches.insert(branchRule.name, branch); + } + + fastImport.setWorkingDirectory(rule.name); + fastImport.setProcessChannelMode(QProcess::ForwardedChannels); +} diff --git a/src/repository.h b/src/repository.h new file mode 100644 index 0000000..7779bdf --- /dev/null +++ b/src/repository.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007 Thiago Macieira + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef REPOSITORY_H +#define REPOSITORY_H + +#include +#include + +#include "ruleparser.h" + +class Repository +{ +public: + struct Branch + { + QString branchFrom; + bool isCreated; + }; + + Repository(const Rules::Repository &rule); + ~Repository(); + +private: + QHash branches; + QProcess fastImport; +}; + +#endif diff --git a/src/src.pro b/src/src.pro index f8e76f6..e6cff4f 100644 --- a/src/src.pro +++ b/src/src.pro @@ -9,4 +9,5 @@ INCLUDEPATH += . QT = core # Input -SOURCES += ruleparser.cpp +SOURCES += ruleparser.cpp repository.cpp +HEADERS += ruleparser.h repository.h