-
Notifications
You must be signed in to change notification settings - Fork 3
/
teamfoundationclient.h
131 lines (109 loc) · 4.46 KB
/
teamfoundationclient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/****************************************************************************
**
** Team Foundation Server plugin for Qt Creator
** Copyright (C) 2014 Jesper Hellesø Hansen
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
**
****************************************************************************/
#ifndef TEAMFOUNDATIONCLIENT_H
#define TEAMFOUNDATIONCLIENT_H
#include <vcsbase/vcsbaseplugin.h>
#include <vcsbase/vcscommand.h>
namespace TeamFoundation {
namespace Internal {
class TeamFoundationPlugin;
struct TeamFoundationResponse
{
TeamFoundationResponse() : exitCode(0) {}
bool error() const { return exitCode != 0; }
int exitCode;
QString standardOut;
QString standardError;
};
class TeamFoundationClient: public QObject
{
Q_OBJECT
friend class TeamFoundationPlugin;
public:
explicit TeamFoundationClient(TeamFoundationPlugin *plugin);
bool addFile(const QString &file) const;
bool deleteFile(const QString &file) const;
bool moveFile(const QString &from, const QString &to) const;
bool compare(const QString &path);
bool undo(const QString &path);
bool checkIn(const QString &path);
bool checkoutFile(const QString &fileName) const;
bool annotateFile(const QString &fileName) const;
bool getLatest(const QString &path, bool force) const;
bool history(const QString &path) const;
bool managesFile(const QString &fileName) const;
bool managesDirectory(const QString &directory) const;
QString repositoryUrl(const QString &fileName) const;
bool revertUnchanged(const QString &path);
bool shelve(const QString &path);
bool unshelve();
/// Adds authentication information if it is specified
static void addAuthentication(QStringList &arguments);
private slots:
// File level command slots
void addCurrentFile();
void deleteCurrentFile();
void compareCurrentFile();
void undoCurrentFile();
void checkInCurrentFile();
void annotateCurrentFile();
void getLatestCurrentFile();
void forceGetLatestCurrentFile();
void historyCurrentFile();
void shelveCurrentFile();
// Project level command slots
void historyProject();
void getLatestProject();
void forceGetLatestProject();
void undoProject();
void compareProject();
void checkInProject();
void revertUnchangedProject();
void shelveProject();
// Repository
void shelveRepository();
void unshelveRepository();
// settings
void configurationChanged();
private:
TeamFoundationResponse runTf(const QString &workingDirectory, const QStringList &arguments,
unsigned flags = VcsBase::VcsCommand::ShowStdOut) const;
TeamFoundationResponse runTfpt(const QString &workingDirectory, const QStringList &arguments,
unsigned flags = VcsBase::VcsCommand::ShowStdOut) const;
TeamFoundationResponse runVcs(const QString &workingDirectory, const Utils::FileName &executable,
const QStringList &arguments, unsigned flags) const;
bool manages(const QString &directory, const QString& command) const;
QString repositoryUrl(const QString &fileName, const QString& command) const;
static QString getRepositoryUrl(const QString &workspaceInfo);
/// Adds /recursive to the paramter list if path is a directory
void addRecursive(QStringList &arguments, const QString &path) const;
TeamFoundationPlugin* m_plugin;
enum TfVersion
{
TfVersion_None,
TfVersion_10,
TfVersion_BetterThan10
};
TfVersion m_tfVersion = TfVersion_None;
};
} // namespace Internal
} // namespace TeamFoundation
#endif // TEAMFOUNDATIONCLIENT_H