File: bazaarutils.h

package info (click to toggle)
kdevelop 4%3A5.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 52,544 kB
  • sloc: cpp: 254,897; python: 3,380; sh: 1,271; ansic: 657; xml: 221; php: 95; makefile: 36; lisp: 13; sed: 12
file content (116 lines) | stat: -rw-r--r-- 4,320 bytes parent folder | download
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
/***************************************************************************
 *   Copyright 2013-2014 Maciej Poleski                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or         *
 *   modify it under the terms of the GNU General Public License as        *
 *   published by the Free Software Foundation; either version 2 of        *
 *   the License or (at your option) version 3 or any later version        *
 *   accepted by the membership of KDE e.V. (or its successor approved     *
 *   by the membership of KDE e.V.), which shall act as a proxy            *
 *   defined in Section 14 of version 3 of the license.                    *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 ***************************************************************************/

#ifndef BAZAAR_BAZAARUTILS_H
#define BAZAAR_BAZAARUTILS_H

#include <QDir>
#include <QUrl>

#include <vcs/vcsevent.h>
#include <vcs/interfaces/ibasicversioncontrol.h>

namespace KDevelop
{
class VcsRevision;
class VcsStatusInfo;
class VcsEvent;
}

namespace BazaarUtils
{

/**
 * Converts @p url to QDir instance assuming file is local
 */
QDir toQDir(const QUrl& url);

/**
 * @return working copy location of working copy which contains @p path.
 */
QDir workingCopy(const QUrl& path);

/**
 * Translate VcsRevision into Revision Identifier accepted by Bazaar. This
 * function is designed for translating single revision ids.
 */
QString getRevisionSpec(const KDevelop::VcsRevision& revision);

/**
 * Translate VcsRevision into revision range option accepted by Bazaar. This
 * function is designed for translating end point into range from begin to
 * given end point.
 */
QString getRevisionSpecRange(const KDevelop::VcsRevision& end);

/**
 * Translate VcsRevision range into revision range option accepted by Bazaar.
 * This function translates VcsRevision range into best possible approximation
 * of revision range accepted by Bazaar.
 */
QString getRevisionSpecRange(const KDevelop::VcsRevision& begin,
                             const KDevelop::VcsRevision& end);

/**
 * Checks if @p dirPath is valid working directory location.
 * @return true if @p dirPath is valid working directory location, false
 * otherwise.
 */
bool isValidDirectory(const QUrl& dirPath);

/**
 * Parses single status info line to KDevelop::VcsStatusInfo.
 */
KDevelop::VcsStatusInfo parseVcsStatusInfoLine(const QString& line);

/**
 * Concatenates path of working copy location and relative file in working copy
 * location (@p pathInWorkingCopy) and returns absolute path of this file.
 * @return Absolute path of file designated by @p pathInWorkingCopy relative to
 * @p workingCopy.
 */
QString concatenatePath(const QDir& workingCopy, const QUrl& pathInWorkingCopy);

/**
 * Parses information about single commit from @p output (which is single part
 * of @c bzr @c log output).
 * @return Information about single commit in instance of
 * KDevelop::VcsEvent class.
 */
KDevelop::VcsEvent parseBzrLogPart(const QString& output);

/**
 * Parses information about single action on single file in some
 * @c bzr @c log output.
 */
KDevelop::VcsItemEvent::Action parseActionDescription(const QString& action);

/**
 * Some methods in interface provides @p recursion parameter. In general
 * Bazaar don't support this (only part of interface has native recursion
 * handling support). This function removes directiories from list if
 * we are in NonRecursive mode (as directory for self is not versioned).
 */
QList<QUrl> handleRecursion(const QList<QUrl>& listOfUrls, KDevelop::IBasicVersionControl::RecursionMode recursion);

}


#endif // BAZAAR_BAZAARUTILS_H