1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #pragma once
27 
28 #include <vcsbase/vcsbaseclient.h>
29 
30 #include <utils/fileutils.h>
31 
32 namespace VcsBase { class VcsCommand; }
33 
34 namespace Subversion {
35 namespace Internal {
36 
37 class SubversionDiffEditorController;
38 class SubversionSettings;
39 
40 class SubversionClient : public VcsBase::VcsBaseClient
41 {
42     Q_OBJECT
43 
44 public:
45     SubversionClient(SubversionSettings *settings);
46 
47     bool doCommit(const QString &repositoryRoot,
48                   const QStringList &files,
49                   const QString &commitMessageFile,
50                   const QStringList &extraOptions = QStringList()) const;
51     void commit(const QString &repositoryRoot,
52                 const QStringList &files,
53                 const QString &commitMessageFile,
54                 const QStringList &extraOptions = QStringList()) override;
55 
56     void diff(const QString &workingDirectory, const QStringList &files,
57               const QStringList &extraOptions) override;
58 
59     void log(const QString &workingDir,
60              const QStringList &files = QStringList(),
61              const QStringList &extraOptions = QStringList(),
62              bool enableAnnotationContextMenu = false) override;
63 
64     void describe(const QString &workingDirectory, int changeNumber, const QString &title);
65 
66     // Add authorization options to the command line arguments.
67     static QStringList addAuthenticationOptions(const SubversionSettings &settings);
68 
69     QString synchronousTopic(const QString &repository) const;
70 
71     static QString escapeFile(const QString &file);
72     static QStringList escapeFiles(const QStringList &files);
73 
74 protected:
75     Utils::Id vcsEditorKind(VcsCommandTag cmd) const override;
76 
77 private:
78     SubversionDiffEditorController *findOrCreateDiffEditor(const QString &documentId, const QString &source,
79                                            const QString &title, const QString &workingDirectory);
80 
81     mutable Utils::FilePath m_svnVersionBinary;
82     mutable QString m_svnVersion;
83 };
84 
85 } // namespace Internal
86 } // namespace Subversion
87