Add 'branches' command to test the fetching of branches in Configuration
[vng.git] / commits / Commit.h
blob672f9ff389edf9a5fb944495af5a4f8c8d286bb1
1 /*
2 * This file is part of the vng project
3 * Copyright (C) 2008 Thomas Zander <tzander@trolltech.com>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef COMMIT_H
19 #define COMMIT_H
21 #include "../Vng.h"
23 #include <QString>
24 #include <QDateTime>
26 class CommitPrivate;
27 class ChangeSet;
29 class Commit {
30 public:
31 /// default constructor creates an invalid commit object.
32 Commit();
33 Commit(const QString &treeism, const Commit &nextCommit = Commit());
34 Commit(const Commit &other);
35 ~Commit();
37 /// return an older commit
38 QList<Commit> previous();
39 /// return a commit made at a later time that has this one as its parent.
40 Commit next();
42 int previousCommitsCount() const;
44 QString author() const;
45 QString committer() const;
46 QString logMessage() const;
47 QString tree() const;
48 QString commitTreeIsm() const;
50 QDateTime commitTime() const;
51 QDateTime authorTime() const;
53 /// available only when the diff provided it.
54 ChangeSet changeSet() const;
56 /// Clear references to the previousCommits, if this commit is the last user of the parent commits it will clean up some memory.
57 void clearParents();
59 Commit &operator=(const Commit &other);
60 bool operator==(const Commit &other);
62 Vng::Acceptance acceptance() const;
63 void setAcceptance(Vng::Acceptance accepted);
65 bool isValid() const;
67 /**
68 * Return the first commit on this branch.
69 * If this is head commit on a branch (not master), this will search for
70 * the first commit that both this branch and another branch share.
72 Commit firstCommitInBranch();
74 static Commit createFromStream(QIODevice *device);
76 protected:
77 Commit(CommitPrivate *priv);
78 void fillFromTreeIsm(const QString &treeIsm);
79 CommitPrivate * d;
81 private:
82 static Commit createFromStream(QIODevice *device, CommitPrivate *priv);
85 #endif