forked from jesperhh/teamfoundation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteamfoundationclient.h
103 lines (86 loc) · 3.69 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
/****************************************************************************
**
** 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() : error(false) {}
bool error;
QString standardOut;
QString standardError;
};
class TeamFoundationClient: public QObject
{
Q_OBJECT
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) 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;
/// 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 historyCurrentFile();
// Project level command slots
void historyProject();
void getLatestProject();
void undoProject();
void compareProject();
void checkInProject();
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;
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;
friend class TeamFoundationPlugin;
};
} // namespace Internal
} // namespace TeamFoundation
#endif // TEAMFOUNDATIONCLIENT_H