diff options
author | Colin Guthrie <colin@mageia.org> | 2014-05-24 01:00:19 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2014-05-24 01:00:19 +0100 |
commit | fb9c6dea4dd67433943a3769317b891a80817c29 (patch) | |
tree | f1a3a6253431a632b6ea5e282324987d8445fa43 /src/repository.cpp | |
parent | 539de0386876ed470f2ae6be90a98421493b3c90 (diff) | |
download | svn2git-fb9c6dea4dd67433943a3769317b891a80817c29.tar svn2git-fb9c6dea4dd67433943a3769317b891a80817c29.tar.gz svn2git-fb9c6dea4dd67433943a3769317b891a80817c29.tar.bz2 svn2git-fb9c6dea4dd67433943a3769317b891a80817c29.tar.xz svn2git-fb9c6dea4dd67433943a3769317b891a80817c29.zip |
Add the ability to autocreate repositories.
In Mageia, we have 13k+ packages and have very strict repo layout. Due to this
we want to autocreate repositories when we import packages from subversion to
git.
This does not really support reloading and continuing etc. but hopefully
that is sufficient for our import.
Diffstat (limited to 'src/repository.cpp')
-rw-r--r-- | src/repository.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/repository.cpp b/src/repository.cpp index 154dc93..d33e218 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -72,6 +72,23 @@ Repository::Repository(const Rules::Repository &rule) branches.insert(branchRule.name, branch); } + init(rule.description); +} + +Repository::Repository(const QString &name, const QString &branchName, int revision) + : name(name), prefix(""), fastImport(name), commitCount(0), outstandingTransactions(0), + last_commit_mark(0), next_file_mark(maxMark), processHasStarted(false) +{ + Branch branch; + branch.created = revision; + + branches.insert(branchName, branch); + + init(""); +} + +void Repository::init(const QString &description) +{ // create the default branch branches["master"].created = 1; @@ -85,10 +102,10 @@ Repository::Repository(const Rules::Repository &rule) init.start("git", QStringList() << "--bare" << "init"); init.waitForFinished(-1); // Write description - if (!rule.description.isEmpty()) { + if (!description.isEmpty()) { QFile fDesc(QDir(name).filePath("description")); if (fDesc.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { - fDesc.write(rule.description.toUtf8()); + fDesc.write(description.toUtf8()); fDesc.putChar('\n'); fDesc.close(); } @@ -102,6 +119,7 @@ Repository::Repository(const Rules::Repository &rule) } } + static QString logFileName(QString name) { name.replace('/', '_'); @@ -302,7 +320,6 @@ int Repository::markFrom(const QString &branchFrom, int branchRevNum, QByteArray Branch &brFrom = branches[branchFrom]; if (!brFrom.created) return -1; - if (brFrom.commits.isEmpty()) { return -1; } |