Changeset View
Changeset View
Standalone View
Standalone View
svn/svncommands.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2019-2020 * | ||||
3 | * by Nikolai Krasheninnikov <nkrasheninnikov@yandex.ru> * | ||||
4 | * * | ||||
5 | * This program is free software; you can redistribute it and/or modify * | ||||
6 | * it under the terms of the GNU General Public License as published by * | ||||
7 | * the Free Software Foundation; either version 2 of the License, or * | ||||
8 | * (at your option) any later version. * | ||||
9 | * * | ||||
10 | * This program is distributed in the hope that it will be useful, * | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||||
13 | * GNU General Public License for more details. * | ||||
14 | * * | ||||
15 | * You should have received a copy of the GNU General Public License * | ||||
16 | * along with this program; if not, write to the * | ||||
17 | * Free Software Foundation, Inc., * | ||||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * | ||||
19 | ***************************************************************************/ | ||||
20 | | ||||
21 | #ifndef SVNCOMMANDS_H | ||||
22 | #define SVNCOMMANDS_H | ||||
23 | | ||||
24 | #include <QString> | ||||
25 | #include <QtGlobal> | ||||
26 | | ||||
27 | #include <Dolphin/KVersionControlPlugin> | ||||
28 | | ||||
29 | class QTemporaryFile; | ||||
30 | class QFileDevice; | ||||
31 | | ||||
32 | /** | ||||
33 | * \brief SVN support functions. | ||||
34 | * | ||||
35 | * \note All functions are synchronous i.e. blocking. Each of them waits for svn process to finish. | ||||
36 | */ | ||||
37 | class SVNCommands { | ||||
38 | public: | ||||
39 | /** | ||||
40 | * Returns file \p filePath local revision. Local revision means last known file revision, not | ||||
41 | * last SVN repository revision. | ||||
42 | * | ||||
43 | * \return Local revision, 0 in case of error. | ||||
44 | * | ||||
45 | * \note This function uses only local SVN data without connection to a remote so it's fast. | ||||
46 | */ | ||||
47 | static ulong localRevision(const QString& filePath); | ||||
48 | | ||||
49 | /** | ||||
50 | * For file \p filePath return its full remote repository URL path. | ||||
51 | * | ||||
52 | * \return Remote path, empty QString in case of error. | ||||
53 | * | ||||
54 | * \note This function uses only local SVN data without connection to a remote so it's fast. | ||||
55 | */ | ||||
56 | static QString remoteItemUrl(const QString& filePath); | ||||
57 | | ||||
58 | /** | ||||
59 | * Export remote URL \p remoteUrl at revision \p rev to a file \p file. File should already be | ||||
60 | * opened or ready to be opened. Freeing resources is up to the caller. | ||||
61 | * | ||||
62 | * \return True if export success, false either. | ||||
63 | * | ||||
64 | * \note \p file should already be created with \p new. | ||||
65 | */ | ||||
66 | static bool exportRemoteFile(const QString& remoteUrl, ulong rev, QFileDevice *file); | ||||
67 | static bool exportRemoteFile(const QString& remoteUrl, ulong rev, QTemporaryFile *file); | ||||
68 | | ||||
69 | /** | ||||
70 | * Export local file \p filePath at revision \p rev to a file \p file. File should already be | ||||
71 | * opened or ready to be opened. Freeing resources is up to the caller. | ||||
72 | * | ||||
73 | * \return True if export success, false either. | ||||
74 | * | ||||
75 | * \note \p file should already be created with \p new. | ||||
76 | */ | ||||
77 | static bool exportLocalFile(const QString& filePath, ulong rev, QFileDevice *file); | ||||
78 | static bool exportLocalFile(const QString& filePath, ulong rev, QTemporaryFile *file); | ||||
79 | }; | ||||
80 | | ||||
81 | #endif // SVNCOMMANDS_H |