diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2010-07-22 17:37:07 +0530 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2010-07-22 17:37:07 +0530 |
commit | f0b31cfe9d31421b83507316d1274d191336a1f7 (patch) | |
tree | 456f8b2266607a1c337d9f9218c358cfde05815b /src/repository.h | |
parent | 37b289b98200f0e054a97485b56a0b643536cad4 (diff) | |
download | svn2git-f0b31cfe9d31421b83507316d1274d191336a1f7.tar svn2git-f0b31cfe9d31421b83507316d1274d191336a1f7.tar.gz svn2git-f0b31cfe9d31421b83507316d1274d191336a1f7.tar.bz2 svn2git-f0b31cfe9d31421b83507316d1274d191336a1f7.tar.xz svn2git-f0b31cfe9d31421b83507316d1274d191336a1f7.zip |
Extract out public methods of Repository into an abstract base class
Rename Repository to FastImportRepository. We will be introducing new types soon.
Diffstat (limited to 'src/repository.h')
-rw-r--r-- | src/repository.h | 109 |
1 files changed, 26 insertions, 83 deletions
diff --git a/src/repository.h b/src/repository.h index 0240043..590ef0e 100644 --- a/src/repository.h +++ b/src/repository.h @@ -30,94 +30,37 @@ public: class Transaction { Q_DISABLE_COPY(Transaction) - friend class Repository; - - Repository *repository; - QByteArray branch; - QByteArray svnprefix; - QByteArray author; - QByteArray log; - uint datetime; - int revnum; - - QVector<int> merges; - - QStringList deletedFiles; - QByteArray modifiedFiles; - - inline Transaction() {} + protected: + Transaction() {} public: - ~Transaction(); - void commit(); - - void setAuthor(const QByteArray &author); - void setDateTime(uint dt); - void setLog(const QByteArray &log); + virtual ~Transaction() {} + virtual void commit() = 0; - void noteCopyFromBranch (const QString &prevbranch, int revFrom); + virtual void setAuthor(const QByteArray &author) = 0; + virtual void setDateTime(uint dt) = 0; + virtual void setLog(const QByteArray &log) = 0; - void deleteFile(const QString &path); - QIODevice *addFile(const QString &path, int mode, qint64 length); - }; - Repository(const Rules::Repository &rule); - int setupIncremental(int &cutoff); - void restoreLog(); - ~Repository(); - - void reloadBranches(); - int createBranch(const QString &branch, int revnum, - const QString &branchFrom, int revFrom); - int deleteBranch(const QString &branch, int revnum); - Transaction *newTransaction(const QString &branch, const QString &svnprefix, int revnum); - - void createAnnotatedTag(const QString &name, const QString &svnprefix, int revnum, - const QByteArray &author, uint dt, - const QByteArray &log); - void finalizeTags(); + virtual void noteCopyFromBranch (const QString &prevbranch, int revFrom) = 0; -private: - struct Branch - { - int created; - QVector<int> commits; - QVector<int> marks; - }; - struct AnnotatedTag - { - QString supportingRef; - QByteArray svnprefix; - QByteArray author; - QByteArray log; - uint dt; - int revnum; + virtual void deleteFile(const QString &path) = 0; + virtual QIODevice *addFile(const QString &path, int mode, qint64 length) = 0; }; - - QHash<QString, Branch> branches; - QHash<QString, AnnotatedTag> annotatedTags; - QString name; - QProcess fastImport; - int commitCount; - int outstandingTransactions; - - /* starts at 0, and counts up. */ - int last_commit_mark; - - /* starts at maxMark and counts down. Reset after each SVN revision */ - int next_file_mark; - - bool processHasStarted; - - void startFastImport(); - void closeFastImport(); - - // called when a transaction is deleted - void forgetTransaction(Transaction *t); - - int resetBranch(const QString &branch, int revnum, int mark, const QByteArray &resetTo, const QByteArray &comment); - int markFrom(const QString &branchFrom, int branchRevNum, QByteArray &desc); - - friend class ProcessCache; - Q_DISABLE_COPY(Repository) + virtual int setupIncremental(int &cutoff) = 0; + virtual void restoreLog() = 0; + virtual ~Repository() {} + + virtual void reloadBranches() = 0; + virtual int createBranch(const QString &branch, int revnum, + const QString &branchFrom, int revFrom) = 0; + virtual int deleteBranch(const QString &branch, int revnum) = 0; + virtual Transaction *newTransaction(const QString &branch, const QString &svnprefix, int revnum) = 0; + + virtual void createAnnotatedTag(const QString &name, const QString &svnprefix, int revnum, + const QByteArray &author, uint dt, + const QByteArray &log) = 0; + virtual void finalizeTags() = 0; }; +Repository *makeRepository(const Rules::Repository &rule, const QHash<QString, Repository *> &repositories); + #endif |