diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2011-10-19 15:49:13 +0000 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2011-10-31 11:49:39 +0100 |
commit | 494fbdb0d2d486ba43dd655e2fa126bfa881f44b (patch) | |
tree | d280bed55ad9293119d96e668f322b313c352d6b /src/plugins/git/commitdata.h | |
parent | 366a9d0d0eb450d1af58bc2c2d54c5e05bff82ee (diff) | |
download | qt-creator-494fbdb0d2d486ba43dd655e2fa126bfa881f44b.tar.gz |
Git: Do the right thing when commiting
Do the right thing when commiting in git. This allows
staged files to be commited without additional changes, etc.
Change-Id: Ib04c91cf9c105c4a2bbe013926112d6d5d3bade6
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/git/commitdata.h')
-rw-r--r-- | src/plugins/git/commitdata.h | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/src/plugins/git/commitdata.h b/src/plugins/git/commitdata.h index b31bf73c2f..e76f1e1b52 100644 --- a/src/plugins/git/commitdata.h +++ b/src/plugins/git/commitdata.h @@ -69,34 +69,50 @@ QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &); class CommitData { public: + enum FileState { + UntrackedFile = 0, + + StagedFile = 1, + ModifiedFile = 2, + AddedFile = 3, + DeletedFile = 4, + RenamedFile = 8, + CopiedFile = 16, + UpdatedFile = 32, + + ModifiedStagedFile = StagedFile | ModifiedFile, + AddedStagedFile = StagedFile | AddedFile, + DeletedStagedFile = StagedFile | DeletedFile, + RenamedStagedFile = StagedFile | RenamedFile, + CopiedStagedFile = StagedFile | CopiedFile, + UpdatedStagedFile = StagedFile | UpdatedFile, + + AllStates = UpdatedFile | CopiedFile | RenamedFile | DeletedFile | AddedFile | ModifiedFile | StagedFile, + UnknownFileState + }; + // A pair of state string/file name ('modified', 'file.cpp'). - typedef QPair<QString, QString> StateFilePair; + typedef QPair<FileState, QString> StateFilePair; void clear(); // Parse the files and the branch of panelInfo // from a git status output bool parseFilesFromStatus(const QString &output); - bool filesEmpty() const; - // Convenience to retrieve the file names from // the specification list. Optionally filter for a certain state - QStringList stagedFileNames(const QString &stateFilter = QString()) const; - QStringList unstagedFileNames(const QString &stateFilter = QString()) const; + QStringList filterFiles(const FileState &state = AllStates) const; + + static QString stateDisplayName(const FileState &state); QString amendSHA1; QString commitEncoding; GitSubmitEditorPanelInfo panelInfo; GitSubmitEditorPanelData panelData; - QList<StateFilePair> stagedFiles; - QList<StateFilePair> unstagedFiles; - QStringList untrackedFiles; + QList<StateFilePair> files; }; -QDebug operator<<(QDebug d, const CommitData &); - - } // namespace Internal } // namespace Git |