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 /*! 0025 * \file client_parameter.h 0026 * \brief defining classes working as named parameters for different subversion methods 0027 * 0028 * Subversion has various functions which has growing / changing parameter lists from version to version. 0029 * since subversion 1.4 this changes are more and more unhandy for a c++ wrapper due every time changes to 0030 * virtual class. This special data containers may reduce changes of signatures to the client interface. 0031 */ 0032 0033 #ifndef CLIENT_PARAMETER_H 0034 #define CLIENT_PARAMETER_H 0035 0036 #include <QScopedPointer> 0037 #include <svnqt/path.h> 0038 #include <svnqt/revision.h> 0039 #include <svnqt/svnqt_defines.h> 0040 #include <svnqt/svnqttypes.h> 0041 #include <svnqt/targets.h> 0042 0043 namespace svn 0044 { 0045 0046 struct CopyParameterData; 0047 0048 //! parameter for svn_copy wrapper 0049 /*! 0050 * This class should never contains virtual methods. New Methods are always appended at end of class definition 0051 * \sa svn::Client::copy 0052 */ 0053 class SVNQT_EXPORT CopyParameter 0054 { 0055 private: 0056 QScopedPointer<CopyParameterData> _data; 0057 0058 public: 0059 CopyParameter(const Targets &_srcPath, const Path &_destPath); 0060 ~CopyParameter(); 0061 0062 //! Targets for copy operation 0063 const Targets &srcPath() const; 0064 //! Targets for copy operation 0065 CopyParameter &srcPath(const Targets &_srcPath); 0066 //! Destination path for copy operation 0067 const Path &destination() const; 0068 //! Destination path for copy operation 0069 CopyParameter &destination(const Path &destination); 0070 0071 //! set copy operation parameter asChild to true 0072 CopyParameter &asChild(bool); 0073 //! return value for asChild 0074 bool asChild() const; 0075 0076 //! copy should ignore externals 0077 /*! 0078 * \since subversion 1.6 0079 */ 0080 CopyParameter &ignoreExternal(bool); 0081 //! return externals has to ignored 0082 /*! 0083 * \since subversion 1.6 0084 */ 0085 bool ignoreExternal() const; 0086 0087 //! set copy/move operation parameter makeParent 0088 CopyParameter &makeParent(bool); 0089 //! return value for asChild 0090 bool makeParent() const; 0091 0092 //! set the source revision for the copy operation 0093 CopyParameter &srcRevision(const Revision &); 0094 //! get the source revision for the copy operation 0095 const Revision &srcRevision() const; 0096 //! set the peg revision for the copy operation 0097 CopyParameter &pegRevision(const Revision &); 0098 //! get the peg revision for the copy operation 0099 const Revision &pegRevision() const; 0100 0101 //! set the properties map for the copy operation 0102 CopyParameter &properties(const PropertiesMap &); 0103 //! get the properties map for the copy operation 0104 const PropertiesMap &properties() const; 0105 }; 0106 0107 struct DiffParameterData; 0108 0109 //! parameter for svn_diff and svn_diff_peg wrapper 0110 /*! 0111 * This class should never contains virtual methods. New Methods are always appended at end of class definition 0112 * \sa svn::Client::diff svn::Client::diff_peg 0113 */ 0114 class SVNQT_EXPORT DiffParameter 0115 { 0116 private: 0117 QScopedPointer<DiffParameterData> _data; 0118 0119 public: 0120 DiffParameter(); 0121 ~DiffParameter(); 0122 0123 //! Changelist filter 0124 /*! 0125 * if empty. no filtering is done 0126 * \since subversion 1.5 0127 * \sa svn_client_diff4 0128 */ 0129 const svn::StringArray &changeList() const; 0130 //! type of recurse operation 0131 /*! 0132 * \sa svn::Depth 0133 */ 0134 Depth depth() const; 0135 //! extra options for diff ("-b", "-w","--ignore-eol-style") 0136 const svn::StringArray &extra() const; 0137 //! whether the files will be checked for relatedness. 0138 bool ignoreAncestry() const; 0139 //! if true generate diff even the items are marked as binaries 0140 bool ignoreContentType() const; 0141 //! if true, no diff output will be generated on deleted files. 0142 bool noDiffDeleted() const; 0143 //! first file or folder to diff. 0144 const Path &path1() const; 0145 //! second file or folder to diff. 0146 /*! 0147 * this is ignored for diff_peg calls 0148 */ 0149 const Path &path2() const; 0150 //! peg revision (only used for diff_peg) 0151 const svn::Revision &peg() const; 0152 //! if set, all pathes are related to this folder 0153 /*! 0154 * Must not be an url! May be empty 0155 */ 0156 const Path &relativeTo() const; 0157 //! one of the revisions to check (path1). 0158 const svn::Revision &rev1() const; 0159 //! the other revision (path2 for non peg diff). 0160 const svn::Revision &rev2() const; 0161 //! prefix for a temporary directory needed by diff. 0162 /*! 0163 * Filenames will have ".tmp" and similar added to this prefix in 0164 * order to ensure uniqueness. 0165 */ 0166 const Path &tmpPath() const; 0167 0168 DiffParameter &path1(const Path &path); 0169 DiffParameter &path2(const Path &path); 0170 DiffParameter &tmpPath(const Path &path); 0171 DiffParameter &relativeTo(const Path &path); 0172 DiffParameter &depth(Depth _depth); 0173 DiffParameter &changeList(const svn::StringArray &changeList); 0174 DiffParameter &extra(const svn::StringArray &_extra); 0175 DiffParameter &ignoreAncestry(bool value); 0176 DiffParameter &ignoreContentType(bool value); 0177 DiffParameter &peg(const svn::Revision &_rev); 0178 DiffParameter &rev1(const svn::Revision &_rev); 0179 DiffParameter &rev2(const svn::Revision &_rev); 0180 DiffParameter &noDiffDeleted(bool value); 0181 0182 //! use gits diff format 0183 /*! 0184 * \since subversion 1.7 0185 * \sa svn_client_diff_peg5,svn_client_diff5 0186 */ 0187 DiffParameter &git_diff_format(bool value); 0188 //! use gits diff format 0189 /*! 0190 * \since subversion 1.7 0191 * \sa svn_client_diff_peg5,svn_client_diff5 0192 */ 0193 bool git_diff_format() const; 0194 0195 //! show copies as new add 0196 /*! 0197 * \since subversion 1.7 0198 * \sa svn_client_diff_peg5,svn_client_diff5 0199 */ 0200 DiffParameter &copies_as_adds(bool value); 0201 //! show copies as new add 0202 /*! 0203 * \since subversion 1.7 0204 * \sa svn_client_diff_peg5,svn_client_diff5 0205 */ 0206 bool copies_as_adds() const; 0207 }; 0208 0209 struct StatusParameterData; 0210 0211 class SVNQT_EXPORT StatusParameter 0212 { 0213 private: 0214 QScopedPointer<StatusParameterData> _data; 0215 0216 public: 0217 explicit StatusParameter(const Path &_path = Path()); 0218 ~StatusParameter(); 0219 0220 //! path to explore 0221 const Path &path() const; 0222 StatusParameter &path(const Path &_path); 0223 //! list specific revision when browsing remote, on working copies parameter will ignored 0224 const Revision &revision() const; 0225 StatusParameter &revision(const Revision &rev); 0226 //! recursion level 0227 Depth depth() const; 0228 StatusParameter &depth(Depth d); 0229 //! Return all entries, not just the interesting ones. 0230 bool all() const; 0231 StatusParameter &all(bool getall); 0232 //! Query the repository for updates. 0233 bool update() const; 0234 StatusParameter &update(bool updates); 0235 //! Disregard default and svn:ignore property ignores. 0236 bool noIgnore() const; 0237 StatusParameter &noIgnore(bool noignore); 0238 //! don't recurse into external definitions 0239 bool ignoreExternals() const; 0240 StatusParameter &ignoreExternals(bool noexternals); 0241 const StringArray &changeList() const; 0242 StatusParameter &changeList(const StringArray &list); 0243 //! if on remote listing detailed item info should get if possible 0244 /*! that may slow so should configureable in frontends! 0245 */ 0246 bool detailedRemote() const; 0247 StatusParameter &detailedRemote(bool value); 0248 }; 0249 0250 struct LogParameterData; 0251 0252 class SVNQT_EXPORT LogParameter 0253 { 0254 private: 0255 QScopedPointer<LogParameterData> _data; 0256 0257 public: 0258 LogParameter(); 0259 ~LogParameter(); 0260 0261 //! items to get the logs for 0262 const Targets &targets() const; 0263 //! set items to get the logs for 0264 LogParameter &targets(const Targets &targets); 0265 //! range of revisions getting logs for 0266 /*! 0267 * when build against subversion prior 1.6 only the first pair is used! 0268 */ 0269 const RevisionRanges &revisions() const; 0270 //! set range of revisions getting logs for 0271 LogParameter &revisions(const RevisionRanges &revisions); 0272 //! simple start-end range. 0273 /*! 0274 * in fact it is the first item in internal revision range. May used when only one pair is required. 0275 */ 0276 const RevisionRange &revisionRange() const; 0277 //! set a simple start-end range 0278 /*! 0279 * this is useful if only one range is required. This will converted into internal ranges when set. 0280 */ 0281 LogParameter &revisionRange(const Revision &start, const Revision &end); 0282 0283 //! the peg revision to use 0284 const Revision &peg() const; 0285 //! set the peg revision to use 0286 LogParameter &peg(const Revision &peg); 0287 //! if not zero limit logs to this count 0288 int limit() const; 0289 LogParameter &limit(int limit); 0290 bool discoverChangedPathes() const; 0291 LogParameter &discoverChangedPathes(bool value); 0292 bool strictNodeHistory() const; 0293 LogParameter &strictNodeHistory(bool value); 0294 bool includeMergedRevisions() const; 0295 LogParameter &includeMergedRevisions(bool value); 0296 const StringArray &revisionProperties() const; 0297 LogParameter &revisionProperties(const StringArray &props); 0298 const StringArray &excludeList() const; 0299 LogParameter &excludeList(const StringArray &props); 0300 }; 0301 0302 struct PropertiesParameterData; 0303 0304 class SVNQT_EXPORT PropertiesParameter 0305 { 0306 private: 0307 QScopedPointer<PropertiesParameterData> _data; 0308 0309 public: 0310 PropertiesParameter(); 0311 ~PropertiesParameter(); 0312 0313 PropertiesParameter &propertyName(const QString &); 0314 const QString &propertyName() const; 0315 0316 PropertiesParameter &propertyValue(const QString &); 0317 const QString &propertyValue() const; 0318 0319 //! Old value to check against 0320 /*! 0321 * used for revpropset only 0322 */ 0323 PropertiesParameter &propertyOriginalValue(const QString &); 0324 const QString &propertyOriginalValue() const; 0325 0326 //! path or url 0327 PropertiesParameter &path(const Path &); 0328 const Path &path() const; 0329 0330 //! set on revision 0331 /*! for revpropset it should be a valid Revision, for propset it should be INVALID 0332 * if url is a local path otherwise it must be a valid revision. 0333 */ 0334 PropertiesParameter &revision(const Revision &); 0335 //! set/get on revision 0336 /*! for revpropset it should be a valid Revision, for propset it should be INVALID 0337 * if url is a local path otherwise it must be a valid revision. 0338 */ 0339 const Revision &revision() const; 0340 0341 //! allow newlines in author property 0342 /*! 0343 * used for revprop_set only 0344 */ 0345 PropertiesParameter &force(bool); 0346 //! allow newlines in author property 0347 /*! 0348 * used for revprop_set only 0349 */ 0350 bool force() const; 0351 0352 //! set depth of operation 0353 /*! 0354 * used for local propset only 0355 */ 0356 PropertiesParameter &depth(Depth depth); 0357 //! depth of operation 0358 /*! 0359 * used for local propset only 0360 */ 0361 Depth depth() const; 0362 0363 //! set skip check 0364 /*! 0365 * used for local propset only 0366 */ 0367 PropertiesParameter &skipCheck(bool value); 0368 //! skip check 0369 /*! 0370 * used for local propset only 0371 */ 0372 bool skipCheck() const; 0373 0374 //! set filter list. if empty no filtering is done 0375 /*! 0376 * used for local propset only 0377 */ 0378 PropertiesParameter &changeList(const StringArray &_list); 0379 //! filter list. if empty no filtering is done 0380 /*! 0381 * used for local propset only 0382 */ 0383 const StringArray &changeList() const; 0384 0385 PropertiesParameter &revisionProperties(const PropertiesMap &props); 0386 const PropertiesMap &revisionProperties() const; 0387 }; 0388 0389 struct MergeParameterData; 0390 0391 /** 0392 * Wrapper for all mergeparameters. 0393 */ 0394 class SVNQT_EXPORT MergeParameter 0395 { 0396 private: 0397 QScopedPointer<MergeParameterData> _data; 0398 0399 public: 0400 MergeParameter(); 0401 ~MergeParameter(); 0402 0403 MergeParameter &path1(const Path &path); 0404 const Path &path1() const; 0405 MergeParameter &path2(const Path &path); 0406 const Path &path2() const; 0407 MergeParameter &localPath(const Path &path); 0408 const Path &localPath() const; 0409 0410 /*! 0411 * used for Client::merge_peg only, when build against subversion prior 1.6 only the first pair is used! 0412 */ 0413 MergeParameter &peg(const Revision &rev); 0414 /*! 0415 * used for Client::merge_peg only or reintegrate merge 0416 */ 0417 const Revision &peg() const; 0418 /*! 0419 * used for Client::merge_peg only, when build against subversion prior 1.6 only the first pair is used! 0420 */ 0421 MergeParameter &revisions(const RevisionRanges &revs); 0422 /*! 0423 * used for Client::merge_peg only, when build against subversion prior 1.6 only the first pair is used! 0424 */ 0425 const RevisionRanges &revisions() const; 0426 //! simple start-end range. 0427 /*! 0428 * in fact it is the first item in internal revision range. May used when only one pair is required. 0429 * used for Client::merge, pair is [start,end], with subversion prior 1.6 for Client::merge_peg, too. 0430 */ 0431 const RevisionRange &revisionRange() const; 0432 //! set a simple start-end range 0433 /*! 0434 * this is useful if only one range is required. This will converted into internal ranges when set. 0435 * used for Client::merge, pair is [rev1,rev2], with subversion prior 1.6 for Client::merge_peg, too. 0436 */ 0437 MergeParameter &revisionRange(const Revision &start, const Revision &end); 0438 0439 //! get start revision 0440 /*! 0441 * used for Client::merge. Revision1 is the first item in first pair of Revision ranges 0442 */ 0443 const Revision &revision1() const; 0444 //! get end revision 0445 /*! 0446 * used for Client::merge. Revision2 is the second item in first pair of Revision ranges 0447 */ 0448 const Revision &revision2() const; 0449 0450 MergeParameter &force(bool how); 0451 bool force() const; 0452 MergeParameter ¬ice_ancestry(bool how); 0453 bool notice_ancestry() const; 0454 MergeParameter &dry_run(bool how); 0455 bool dry_run() const; 0456 MergeParameter &record_only(bool how); 0457 bool record_only() const; 0458 0459 MergeParameter &depth(Depth depth); 0460 Depth depth() const; 0461 0462 MergeParameter &merge_options(const StringArray &options); 0463 const StringArray &merge_options() const; 0464 0465 /** 0466 * @param reintegrate must be true if this parameter are for a reintegrate merge. 0467 */ 0468 MergeParameter &reintegrate(bool reintegrate); 0469 /** 0470 * Check whether the parameters are for a reintegrate merge or not. If yes, than parameters are used as follows: 0471 * - peg() - setup the required peg revision 0472 * - path1() gives the source path 0473 * - localPath() the local working copy to merge into 0474 * - dry_run() run without real modifications 0475 * - merge_options() all other svn options for merge 0476 * 0477 * All other parameters are ignored in that case. 0478 */ 0479 bool reintegrate() const; 0480 0481 /** 0482 * @param allow_mixed_rev true if merging into mixed rev working copy is allowed. If false, merge fails if mixed rev WC 0483 * @since subversion 1.7 0484 */ 0485 MergeParameter &allow_mixed_rev(bool allow_mixed_rev); 0486 bool allow_mixed_rev() const; 0487 }; 0488 0489 struct CheckoutParameterData; 0490 //! parameter for Checkout and Export 0491 class SVNQT_EXPORT CheckoutParameter 0492 { 0493 private: 0494 QScopedPointer<CheckoutParameterData> _data; 0495 0496 public: 0497 CheckoutParameter(); 0498 ~CheckoutParameter(); 0499 0500 //! name of the module to checkout. 0501 CheckoutParameter &moduleName(const Path &path); 0502 //! name of the module to checkout. 0503 const Path &moduleName() const; 0504 //! destination directory for checkout. 0505 CheckoutParameter &destination(const Path &path); 0506 //! destination directory for checkout. 0507 const Path &destination() const; 0508 //! the revision number to checkout. 0509 /*! If the number is -1 0510 * then it will checkout the latest revision. 0511 */ 0512 CheckoutParameter &revision(const Revision &rev); 0513 //! the revision number to checkout. 0514 /*! If the number is -1 0515 * then it will checkout the latest revision. 0516 */ 0517 const Revision &revision() const; 0518 //! Revision to look up 0519 CheckoutParameter &peg(const Revision &rev); 0520 //! Revision to look up 0521 const Revision &peg() const; 0522 //! depth of operation 0523 /*! 0524 * \sa svn::Depth 0525 */ 0526 CheckoutParameter &depth(Depth depth); 0527 //! depth of operation 0528 /*! 0529 * \sa svn::Depth 0530 */ 0531 Depth depth() const; 0532 //! if true don't process externals definitions. 0533 CheckoutParameter &ignoreExternals(bool ignore); 0534 //! if true don't process externals definitions. 0535 bool ignoreExternals() const; 0536 //! if true overwrite existing not versioned items. 0537 CheckoutParameter &overWrite(bool overwrite); 0538 //! if true overwrite existing not versioned items. 0539 bool overWrite() const; 0540 //! do not replace svn:keywords on export 0541 bool ignoreKeywords() const; 0542 CheckoutParameter &ignoreKeywords(bool ignorekeywords); 0543 0544 //! Either "LF", "CR" or "CRLF" or QString(). 0545 /*! 0546 * Used only from Client::doExport, QString() is default (will used as NULL for subversion) 0547 */ 0548 CheckoutParameter &nativeEol(const QString &native); 0549 //! Either "LF", "CR" or "CRLF" or QString(). 0550 /*! 0551 * Used only from Client::doExport, QString() is default (will used as NULL for subversion) 0552 */ 0553 const QString &nativeEol() const; 0554 }; 0555 } 0556 0557 #endif