diff options
author | Thiago Macieira <thiago@cassini.local.lan> | 2007-12-25 20:28:32 -0200 |
---|---|---|
committer | Thiago Macieira <thiago@cassini.local.lan> | 2007-12-25 20:28:32 -0200 |
commit | e087596c78237db34511211719218fe0fb2e8e51 (patch) | |
tree | 35c2332f0ead9cf11f1e19d140c9ccddef24ce58 | |
parent | 1602441997715867882c9ff2102cb13bcfd241ee (diff) | |
download | svn2git-e087596c78237db34511211719218fe0fb2e8e51.tar svn2git-e087596c78237db34511211719218fe0fb2e8e51.tar.gz svn2git-e087596c78237db34511211719218fe0fb2e8e51.tar.bz2 svn2git-e087596c78237db34511211719218fe0fb2e8e51.tar.xz svn2git-e087596c78237db34511211719218fe0fb2e8e51.zip |
Keep track of when a given branch was created instead
-rw-r--r-- | src/repository.cpp | 14 | ||||
-rw-r--r-- | src/repository.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/repository.cpp b/src/repository.cpp index 335278a..1cb7c41 100644 --- a/src/repository.cpp +++ b/src/repository.cpp @@ -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; } diff --git a/src/repository.h b/src/repository.h index 2cee3f2..edd04b7 100644 --- a/src/repository.h +++ b/src/repository.h @@ -70,7 +70,7 @@ public: private: struct Branch { - bool isCreated; + uint created; }; QHash<QString, Branch> branches; |