mercurialclient.h 4.64 KB
Newer Older
dt's avatar
dt committed
1
2
/**************************************************************************
**
3
** Copyright (c) 2014 Brian McGillion
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
dt's avatar
dt committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
dt's avatar
dt committed
7
**
hjk's avatar
hjk committed
8
9
10
11
12
13
14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
dt's avatar
dt committed
15
16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17
18
19
20
21
22
23
24
25
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
con's avatar
con committed
26
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
dt's avatar
dt committed
29

30
31
32
#ifndef MERCURIALCLIENT_H
#define MERCURIALCLIENT_H

33
#include "mercurialsettings.h"
cerf's avatar
cerf committed
34
#include <vcsbase/vcsbaseclient.h>
35

36
37
namespace Mercurial {
namespace Internal {
38
struct MercurialDiffParameters;
39

hjk's avatar
hjk committed
40
class MercurialClient : public VcsBase::VcsBaseClient
41
42
43
{
    Q_OBJECT
public:
44
45
46
47
    MercurialClient(MercurialSettings *settings);

    MercurialSettings *settings() const;

Orgad Shaneh's avatar
Orgad Shaneh committed
48
49
50
51
    bool synchronousClone(const QString &workingDir,
                          const QString &srcLocation,
                          const QString &dstLocation,
                          const QStringList &extraOptions = QStringList());
52
53
54
    bool synchronousPull(const QString &workingDir,
                         const QString &srcLocation,
                         const QStringList &extraOptions = QStringList());
55
56
    bool manifestSync(const QString &repository, const QString &filename);
    QString branchQuerySync(const QString &repositoryRoot);
57
    QStringList parentRevisionsSync(const QString &workingDirectory,
58
                             const QString &file /* = QString() */,
59
60
61
62
                             const QString &revision);
    QString shortDescriptionSync(const QString &workingDirectory, const QString &revision,
                              const QString &format /* = QString() */);
    QString shortDescriptionSync(const QString &workingDirectory, const QString &revision);
63
64
    void incoming(const QString &repositoryRoot, const QString &repository = QString());
    void outgoing(const QString &repositoryRoot);
65
    QString vcsGetRepositoryURL(const QString &directory);
66
    bool managesFile(const QString &workingDirectory, const QString &fileName) const;
67

68
    void annotate(const QString &workingDir, const QString &file,
69
                  const QString &revision = QString(), int lineNumber = -1,
70
71
72
73
74
75
76
77
78
79
80
81
82
                  const QStringList &extraOptions = QStringList());
    void commit(const QString &repositoryRoot, const QStringList &files,
                const QString &commitMessageFile,
                const QStringList &extraOptions = QStringList());
    void diff(const QString &workingDir, const QStringList &files = QStringList(),
              const QStringList &extraOptions = QStringList());
    void import(const QString &repositoryRoot, const QStringList &files,
                const QStringList &extraOptions = QStringList());
    void revertAll(const QString &workingDir, const QString &revision = QString(),
                   const QStringList &extraOptions = QStringList());
    void view(const QString &source, const QString &id,
              const QStringList &extraOptions = QStringList());

cerf's avatar
cerf committed
83
public:
84
    QString findTopLevelForFile(const QFileInfo &file) const;
cerf's avatar
cerf committed
85
86

protected:
hjk's avatar
hjk committed
87
    Core::Id vcsEditorKind(VcsCommand cmd) const;
88
    QStringList revisionSpec(const QString &revision) const;
hjk's avatar
hjk committed
89
    VcsBase::VcsBaseEditorParameterWidget *createDiffEditor(const QString &workingDir,
90
91
                                                            const QStringList &files,
                                                            const QStringList &extraOptions);
92
    StatusItem parseStatusLine(const QString &line) const;
93
94
95
96
97
98
99

signals:
    void needUpdate();
    void needMerge();

private:
    void parsePullOutput(const QString &output);
100
101
102
103
104
105
};

} //namespace Internal
} //namespace Mercurial

#endif // MERCURIALCLIENT_H