File indexing completed on 2024-04-28 05:42:08

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2009 by Rajko Albrecht                             *
0003  *   ral@alwins-world.de                                                   *
0004  *                                                                         *
0005  * This program is free software; you can redistribute it and/or           *
0006  * modify it under the terms of the GNU Lesser General Public              *
0007  * License as published by the Free Software Foundation; either            *
0008  * version 2.1 of the License, or (at your option) any later version.      *
0009  *                                                                         *
0010  * This program is distributed in the hope that it will be useful,         *
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *
0013  * Lesser General Public License for more details.                         *
0014  *                                                                         *
0015  * You should have received a copy of the GNU Lesser General Public        *
0016  * License along with this program (in the file LGPL.txt); if not,         *
0017  * write to the Free Software Foundation, Inc., 51 Franklin St,            *
0018  * Fifth Floor, Boston, MA  02110-1301  USA                                *
0019  *                                                                         *
0020  * This software consists of voluntary contributions made by many          *
0021  * individuals.  For exact contribution history, see the revision          *
0022  * history and logs, available at https://commits.kde.org/kdesvn.          *
0023  ***************************************************************************/
0024 #include "client_parameter.h"
0025 #include "client_parameter_macros.h"
0026 #include "stringarray.h"
0027 #include "svnqttypes.h"
0028 
0029 namespace svn
0030 {
0031 //! internal data structure
0032 struct SVNQT_NOEXPORT CopyParameterData {
0033     CopyParameterData()
0034         : _srcPath()
0035         , _srcRevision()
0036         , _pegRevision()
0037         , _destPath()
0038         , _asChild(false)
0039         , _makeParent(false)
0040         , _ignoreExternal(false)
0041         , _properties()
0042     {
0043     }
0044     Targets _srcPath;
0045     Revision _srcRevision;
0046     Revision _pegRevision;
0047     Path _destPath;
0048     bool _asChild;
0049     bool _makeParent;
0050     bool _ignoreExternal;
0051     PropertiesMap _properties;
0052 };
0053 
0054 CopyParameter::CopyParameter(const Targets &_srcPath, const Path &_destPath)
0055     : _data(new CopyParameterData)
0056 {
0057     _data->_srcPath = _srcPath;
0058     _data->_destPath = _destPath;
0059 }
0060 
0061 CopyParameter::~CopyParameter()
0062 {
0063 }
0064 
0065 GETSET(CopyParameter, Targets, _srcPath, srcPath);
0066 GETSET(CopyParameter, Path, _destPath, destination);
0067 GETSET(CopyParameter, Revision, _srcRevision, srcRevision);
0068 GETSET(CopyParameter, Revision, _pegRevision, pegRevision);
0069 GETSET(CopyParameter, PropertiesMap, _properties, properties);
0070 
0071 GETSETSI(CopyParameter, bool, _asChild, asChild);
0072 GETSETSI(CopyParameter, bool, _makeParent, makeParent);
0073 GETSETSI(CopyParameter, bool, _ignoreExternal, ignoreExternal);
0074 
0075 struct SVNQT_NOEXPORT DiffParameterData {
0076 public:
0077     DiffParameterData()
0078         : _tmpPath()
0079         , _path1()
0080         , _path2()
0081         , _relativeTo()
0082         , _changeList()
0083         , _ignoreAncestry(false)
0084         , _noDiffDeleted(false)
0085         , _depth(DepthInfinity)
0086         , _peg_revision(Revision::UNDEFINED)
0087         , _rev1(Revision::START)
0088         , _rev2(Revision::HEAD)
0089         , _extra()
0090         , _ignore_contenttype(false)
0091         , _copies_as_adds(false)
0092         , _git_diff_format(false)
0093     {
0094     }
0095 
0096     Path _tmpPath;
0097     Path _path1;
0098     Path _path2;
0099     Path _relativeTo;
0100     StringArray _changeList;
0101     bool _ignoreAncestry;
0102     bool _noDiffDeleted;
0103     Depth _depth;
0104     Revision _peg_revision;
0105     Revision _rev1;
0106     Revision _rev2;
0107     StringArray _extra;
0108     bool _ignore_contenttype;
0109     // subversion 1.7
0110     bool _copies_as_adds;
0111     bool _git_diff_format;
0112 };
0113 
0114 DiffParameter::DiffParameter()
0115     : _data(new DiffParameterData)
0116 {
0117 }
0118 
0119 DiffParameter::~DiffParameter()
0120 {
0121 }
0122 
0123 GETSET(DiffParameter, Path, _path1, path1)
0124 GETSET(DiffParameter, Path, _path2, path2)
0125 GETSET(DiffParameter, Path, _tmpPath, tmpPath)
0126 GETSET(DiffParameter, Path, _relativeTo, relativeTo)
0127 GETSET(DiffParameter, Revision, _peg_revision, peg)
0128 GETSET(DiffParameter, Revision, _rev1, rev1)
0129 GETSET(DiffParameter, Revision, _rev2, rev2)
0130 GETSET(DiffParameter, StringArray, _changeList, changeList)
0131 GETSET(DiffParameter, StringArray, _extra, extra)
0132 
0133 GETSETSI(DiffParameter, Depth, _depth, depth)
0134 GETSETSI(DiffParameter, bool, _ignoreAncestry, ignoreAncestry)
0135 GETSETSI(DiffParameter, bool, _ignore_contenttype, ignoreContentType)
0136 GETSETSI(DiffParameter, bool, _noDiffDeleted, noDiffDeleted)
0137 GETSETSI(DiffParameter, bool, _copies_as_adds, copies_as_adds)
0138 GETSETSI(DiffParameter, bool, _git_diff_format, git_diff_format)
0139 
0140 struct StatusParameterData {
0141     StatusParameterData(const Path &path)
0142         : _path(path)
0143         , _revision(Revision::UNDEFINED)
0144         , _depth(DepthInfinity)
0145         , _getAll(true)
0146         , _update(true)
0147         , _noIgnore(false)
0148         , _ignoreExternals(false)
0149         , _detailedRemote(false)
0150         , _changeList()
0151     {
0152     }
0153     Path _path;
0154     Revision _revision;
0155     Depth _depth;
0156     bool _getAll;
0157     bool _update;
0158     bool _noIgnore;
0159     bool _ignoreExternals;
0160     bool _detailedRemote;
0161     StringArray _changeList;
0162 };
0163 
0164 StatusParameter::StatusParameter(const Path &path)
0165     : _data(new StatusParameterData(path))
0166 {
0167 }
0168 
0169 StatusParameter::~StatusParameter()
0170 {
0171 }
0172 
0173 GETSET(StatusParameter, Path, _path, path)
0174 GETSET(StatusParameter, Revision, _revision, revision)
0175 GETSET(StatusParameter, StringArray, _changeList, changeList)
0176 
0177 GETSETSI(StatusParameter, Depth, _depth, depth)
0178 GETSETSI(StatusParameter, bool, _getAll, all)
0179 GETSETSI(StatusParameter, bool, _update, update)
0180 GETSETSI(StatusParameter, bool, _noIgnore, noIgnore)
0181 GETSETSI(StatusParameter, bool, _ignoreExternals, ignoreExternals)
0182 GETSETSI(StatusParameter, bool, _detailedRemote, detailedRemote)
0183 
0184 struct LogParameterData {
0185 public:
0186     LogParameterData()
0187         : _targets()
0188         , _ranges()
0189         , _peg(Revision::UNDEFINED)
0190         , _limit(0)
0191         , _discoverChangedPathes(false)
0192         , _strictNodeHistory(true)
0193         , _includeMergedRevisions(false)
0194         , _revisionProperties()
0195         , _excludeList()
0196     {
0197     }
0198     Targets _targets;
0199     RevisionRanges _ranges;
0200     Revision _peg;
0201     int _limit;
0202     bool _discoverChangedPathes, _strictNodeHistory, _includeMergedRevisions;
0203     StringArray _revisionProperties;
0204     StringArray _excludeList;
0205 };
0206 
0207 LogParameter::LogParameter()
0208     : _data(new LogParameterData)
0209 {
0210 }
0211 
0212 LogParameter::~LogParameter()
0213 {
0214 }
0215 
0216 GETSET(LogParameter, Targets, _targets, targets);
0217 GETSET(LogParameter, RevisionRanges, _ranges, revisions);
0218 GETSET(LogParameter, Revision, _peg, peg);
0219 GETSET(LogParameter, StringArray, _revisionProperties, revisionProperties);
0220 GETSET(LogParameter, StringArray, _excludeList, excludeList);
0221 
0222 GETSETSI(LogParameter, int, _limit, limit);
0223 GETSETSI(LogParameter, bool, _discoverChangedPathes, discoverChangedPathes);
0224 GETSETSI(LogParameter, bool, _strictNodeHistory, strictNodeHistory);
0225 GETSETSI(LogParameter, bool, _includeMergedRevisions, includeMergedRevisions);
0226 
0227 const RevisionRange &LogParameter::revisionRange() const
0228 {
0229     if (_data->_ranges.size() < 1) {
0230         const static RevisionRange r(Revision::UNDEFINED, Revision::UNDEFINED);
0231         return r;
0232     }
0233     return _data->_ranges[0];
0234 }
0235 LogParameter &LogParameter::revisionRange(const Revision &start, const Revision &end)
0236 {
0237     _data->_ranges.clear();
0238     _data->_ranges.append(RevisionRange(start, end));
0239     return *this;
0240 }
0241 
0242 struct PropertiesParameterData {
0243     PropertiesParameterData()
0244         : _name(QString())
0245         , _value(QString())
0246         , _originalValue(QString())
0247         , _path()
0248         , _revision(Revision::UNDEFINED)
0249         , _force(false)
0250         , _depth(DepthEmpty)
0251         , _skipCheck(false)
0252         , _changeList()
0253         , _revProperties()
0254     {
0255     }
0256     QString _name;
0257     QString _value;
0258     QString _originalValue;
0259     Path _path;
0260     Revision _revision;
0261     bool _force;
0262     Depth _depth;
0263     bool _skipCheck;
0264     StringArray _changeList;
0265     PropertiesMap _revProperties;
0266 };
0267 
0268 PropertiesParameter::PropertiesParameter()
0269     : _data(new PropertiesParameterData)
0270 {
0271 }
0272 
0273 PropertiesParameter::~PropertiesParameter()
0274 {
0275 }
0276 
0277 GETSET(PropertiesParameter, QString, _name, propertyName);
0278 GETSET(PropertiesParameter, QString, _value, propertyValue);
0279 GETSET(PropertiesParameter, QString, _originalValue, propertyOriginalValue);
0280 GETSET(PropertiesParameter, Path, _path, path);
0281 GETSET(PropertiesParameter, Revision, _revision, revision);
0282 GETSET(PropertiesParameter, StringArray, _changeList, changeList);
0283 GETSET(PropertiesParameter, PropertiesMap, _revProperties, revisionProperties);
0284 
0285 GETSETSI(PropertiesParameter, bool, _force, force);
0286 GETSETSI(PropertiesParameter, Depth, _depth, depth);
0287 GETSETSI(PropertiesParameter, bool, _skipCheck, skipCheck);
0288 
0289 struct MergeParameterData {
0290 public:
0291     MergeParameterData()
0292         : _path1()
0293         , _path2()
0294         , _localPath()
0295         , _peg(Revision::UNDEFINED)
0296         , _ranges()
0297         , _force(false)
0298         , _notice_ancestry(true)
0299         , _dry_run(false)
0300         , _record_only(false)
0301         , _reintegrate(false)
0302         , _allow_mixed_rev(false)
0303         , _depth(DepthInfinity)
0304         , _merge_options()
0305     {
0306     }
0307     Path _path1, _path2, _localPath;
0308     Revision _peg;
0309     RevisionRanges _ranges;
0310     bool _force, _notice_ancestry, _dry_run, _record_only, _reintegrate, _allow_mixed_rev;
0311     Depth _depth;
0312     StringArray _merge_options;
0313 };
0314 
0315 MergeParameter::MergeParameter()
0316     : _data(new MergeParameterData)
0317 {
0318 }
0319 
0320 MergeParameter::~MergeParameter()
0321 {
0322 }
0323 
0324 GETSET(MergeParameter, Path, _path1, path1);
0325 GETSET(MergeParameter, Path, _path2, path2);
0326 GETSET(MergeParameter, Path, _localPath, localPath);
0327 GETSET(MergeParameter, Revision, _peg, peg);
0328 GETSET(MergeParameter, StringArray, _merge_options, merge_options);
0329 GETSET(MergeParameter, RevisionRanges, _ranges, revisions);
0330 
0331 GETSETSI(MergeParameter, bool, _force, force);
0332 GETSETSI(MergeParameter, bool, _notice_ancestry, notice_ancestry);
0333 GETSETSI(MergeParameter, bool, _dry_run, dry_run);
0334 GETSETSI(MergeParameter, bool, _record_only, record_only);
0335 GETSETSI(MergeParameter, Depth, _depth, depth);
0336 GETSETSI(MergeParameter, bool, _reintegrate, reintegrate);
0337 GETSETSI(MergeParameter, bool, _allow_mixed_rev, allow_mixed_rev);
0338 
0339 const RevisionRange &MergeParameter::revisionRange() const
0340 {
0341     if (_data->_ranges.size() < 1) {
0342         const static RevisionRange r(Revision::UNDEFINED, Revision::UNDEFINED);
0343         return r;
0344     }
0345     return _data->_ranges[0];
0346 }
0347 MergeParameter &MergeParameter::revisionRange(const Revision &start, const Revision &end)
0348 {
0349     _data->_ranges.clear();
0350     _data->_ranges.append(RevisionRange(start, end));
0351     return *this;
0352 }
0353 const Revision &MergeParameter::revision1() const
0354 {
0355     return revisionRange().first;
0356 }
0357 const Revision &MergeParameter::revision2() const
0358 {
0359     return revisionRange().second;
0360 }
0361 
0362 struct CheckoutParameterData {
0363     CheckoutParameterData()
0364         : _moduleName()
0365         , _destination()
0366         , _revision(Revision::UNDEFINED)
0367         , _peg(Revision::UNDEFINED)
0368         , _depth(DepthInfinity)
0369         , _ignoreExternals(false)
0370         , _overWrite(false)
0371         , _ignoreKeywords(false)
0372         , _nativeEol(QString())
0373     {
0374     }
0375     Path _moduleName, _destination;
0376     Revision _revision, _peg;
0377     Depth _depth;
0378     bool _ignoreExternals, _overWrite, _ignoreKeywords;
0379     QString _nativeEol;
0380 };
0381 
0382 CheckoutParameter::CheckoutParameter()
0383     : _data(new CheckoutParameterData)
0384 {
0385 }
0386 
0387 CheckoutParameter::~CheckoutParameter()
0388 {
0389 }
0390 
0391 GETSET(CheckoutParameter, Path, _moduleName, moduleName)
0392 GETSET(CheckoutParameter, Path, _destination, destination)
0393 GETSET(CheckoutParameter, Revision, _revision, revision)
0394 GETSET(CheckoutParameter, Revision, _peg, peg)
0395 GETSET(CheckoutParameter, QString, _nativeEol, nativeEol)
0396 
0397 GETSETSI(CheckoutParameter, Depth, _depth, depth)
0398 GETSETSI(CheckoutParameter, bool, _ignoreExternals, ignoreExternals)
0399 GETSETSI(CheckoutParameter, bool, _overWrite, overWrite)
0400 GETSETSI(CheckoutParameter, bool, _ignoreKeywords, ignoreKeywords)
0401 }