SvnCpp
|
00001 /* 00002 * ==================================================================== 00003 * Copyright (c) 2002-2009 The RapidSvn Group. All rights reserved. 00004 * 00005 * This program is free software: you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation, either version 3 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program (in the file GPL.txt. 00017 * If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * This software consists of voluntary contributions made by many 00020 * individuals. For exact contribution history, see the revision 00021 * history and logs, available at http://rapidsvn.tigris.org/. 00022 * ==================================================================== 00023 */ 00024 00025 #ifndef _SVNCPP_CLIENT_H_ 00026 #define _SVNCPP_CLIENT_H_ 00027 00028 // Ignore MSVC 6 compiler warning 00029 #if defined (_MSC_VER) && _MSC_VER <= 1200 00030 // debug symbol truncated 00031 #pragma warning (disable: 4786) 00032 // C++ exception specification 00033 #pragma warning (disable: 4290) 00034 #endif 00035 00036 // Ignore MSVC 7,8,9 compiler warnings 00037 #if defined (_MSC_VER) && _MSC_VER > 1200 && _MSC_VER <= 1500 00038 // C++ exception specification 00039 #pragma warning (disable: 4290) 00040 #endif 00041 00042 00043 // stl 00044 #include "svncpp/vector_wrapper.hpp" 00045 #include "svncpp/utility_wrapper.hpp" 00046 #include "svncpp/map_wrapper.hpp" 00047 00048 // svncpp 00049 #include "svncpp/context.hpp" 00050 #include "svncpp/exception.hpp" 00051 #include "svncpp/path.hpp" 00052 #include "svncpp/entry.hpp" 00053 #include "svncpp/revision.hpp" 00054 #include "svncpp/log_entry.hpp" 00055 #include "svncpp/annotate_line.hpp" 00056 00057 00058 namespace svn 00059 { 00060 // forward declarations 00061 class Context; 00062 class DirEntry; 00063 class Info; 00064 class Status; 00065 class Targets; 00066 00067 typedef std::vector<AnnotateLine> AnnotatedFile; 00068 typedef std::vector<DirEntry> DirEntries; 00069 typedef std::vector<Info> InfoVector; 00070 typedef std::vector<LogEntry> LogEntries; 00071 typedef std::vector<Status> StatusEntries; 00072 00073 00074 // map of property names to values 00075 typedef std::map<std::string,std::string> PropertiesMap; 00076 // pair of path, PropertiesMap 00077 typedef std::pair<std::string, PropertiesMap> PathPropertiesMapEntry; 00078 // vector of path, Properties pairs 00079 typedef std::vector<PathPropertiesMapEntry> PathPropertiesMapList; 00080 00087 struct StatusFilter 00088 { 00089 public: 00090 bool showUnversioned; 00091 bool showUnmodified; 00092 bool showModified; 00093 bool showConflicted; 00094 bool showIgnored; 00095 bool showExternals; 00096 00097 StatusFilter() 00098 : showUnversioned(false), showUnmodified(false), 00099 showModified(false), showConflicted(false), 00100 showExternals(false) 00101 { 00102 } 00103 }; 00104 00105 00109 class Client 00110 { 00111 public: 00115 Client(Context * context = 0); 00116 00117 virtual ~Client(); 00118 00122 const Context * 00123 getContext() const; 00124 00128 Context * 00129 getContext(); 00130 00138 void 00139 setContext(Context * context = NULL); 00140 00154 StatusEntries 00155 status(const char * path, 00156 const bool descend = false, 00157 const bool get_all = true, 00158 const bool update = false, 00159 const bool no_ignore = false, 00160 const bool ignore_externals = false) throw(ClientException); 00161 00179 svn_revnum_t 00180 status(const char * path, 00181 const StatusFilter & filter, 00182 const bool descend, 00183 const bool update, 00184 StatusEntries & entries) throw(ClientException); 00185 00186 00198 svn_revnum_t 00199 checkout(const char * moduleName, 00200 const Path & destPath, 00201 const Revision & revision, 00202 bool recurse, 00203 bool ignore_externals = false, 00204 const Revision & peg_revision = Revision::UNSPECIFIED) throw(ClientException); 00205 00210 void 00211 relocate(const Path & path, const char *from_url, 00212 const char *to_url, bool recurse) throw(ClientException); 00213 00218 void 00219 remove(const Path & path, bool force) throw(ClientException); 00220 00228 void 00229 remove(const Targets & targets, 00230 bool force) throw(ClientException); 00231 00240 void 00241 lock(const Targets & targets, bool force, 00242 const char * comment) throw(ClientException); 00243 00251 void 00252 unlock(const Targets & targets, bool force) throw(ClientException); 00253 00258 void 00259 revert(const Targets & targets, bool recurse) throw(ClientException); 00260 00265 void 00266 add(const Path & path, bool recurse) throw(ClientException); 00267 00280 std::vector<svn_revnum_t> 00281 update(const Targets & targets, 00282 const Revision & revision, 00283 bool recurse, 00284 bool ignore_externals) throw(ClientException); 00285 00286 svn_revnum_t 00287 update(const Path & path, 00288 const Revision & revision, 00289 bool recurse, 00290 bool ignore_externals) throw(ClientException); 00291 00302 std::string 00303 cat(const Path & path, 00304 const Revision & revision, 00305 const Revision & peg_revision = Revision::UNSPECIFIED) throw(ClientException); 00306 00307 00324 void 00325 get(Path & dstPath, 00326 const Path & path, 00327 const Revision & revision, 00328 const Revision & peg_revision = Revision::UNSPECIFIED) throw(ClientException); 00329 00330 00340 AnnotatedFile * 00341 annotate(const Path & path, 00342 const Revision & revisionStart, 00343 const Revision & revisionEnd) throw(ClientException); 00344 00356 svn_revnum_t 00357 commit(const Targets & targets, 00358 const char * message, 00359 bool recurse, 00360 bool keep_locks = false) throw(ClientException); 00361 00366 void 00367 copy(const Path & srcPath, 00368 const Revision & srcRevision, 00369 const Path & destPath) throw(ClientException); 00370 00375 void 00376 move(const Path & srcPath, 00377 const Revision & srcRevision, 00378 const Path & destPath, 00379 bool force) throw(ClientException); 00380 00389 void 00390 mkdir(const Path & path) throw(ClientException); 00391 00392 void 00393 mkdir(const Targets & targets) throw(ClientException); 00394 00401 void 00402 cleanup(const Path & path) throw(ClientException); 00403 00408 void 00409 resolved(const Path & path, bool recurse) throw(ClientException); 00410 00424 void 00425 doExport(const Path & from_path, 00426 const Path & to_path, 00427 const Revision & revision, 00428 bool overwrite = false, 00429 const Revision & peg_revision = Revision::UNSPECIFIED, 00430 bool ignore_externals = false, 00431 bool recurse = true, 00432 const char * native_eol = NULL) throw(ClientException); 00433 00439 svn_revnum_t 00440 doSwitch(const Path & path, const char * url, 00441 const Revision & revision, 00442 bool recurse) throw(ClientException); 00443 00453 void 00454 import(const Path & path, 00455 const char * url, 00456 const char * message, 00457 bool recurse) throw(ClientException); 00458 void 00459 import(const Path & path, 00460 const Path & url, 00461 const char * message, 00462 bool recurse) throw(ClientException); 00463 00464 00469 void 00470 merge(const Path & path1, const Revision & revision1, 00471 const Path & path2, const Revision & revision2, 00472 const Path & localPath, bool force, 00473 bool recurse, 00474 bool notice_ancestry = false, 00475 bool dry_run = false) throw(ClientException); 00476 00477 00490 InfoVector 00491 info(const Path & pathOrUrl, 00492 bool recurse=false, 00493 const Revision & revision = Revision::UNSPECIFIED, 00494 const Revision & pegRevision = Revision::UNSPECIFIED) throw(ClientException); 00495 00496 00512 const LogEntries * 00513 log(const char * path, 00514 const Revision & revisionStart, 00515 const Revision & revisionEnd, 00516 bool discoverChangedPaths = false, 00517 bool strictNodeHistory = true) throw(ClientException); 00518 00541 std::string 00542 diff(const Path & tmpPath, const Path & path, 00543 const Revision & revision1, const Revision & revision2, 00544 const bool recurse, const bool ignoreAncestry, 00545 const bool noDiffDeleted) throw(ClientException); 00546 00570 std::string 00571 diff(const Path & tmpPath, const Path & path1, const Path & path2, 00572 const Revision & revision1, const Revision & revision2, 00573 const bool recurse, const bool ignoreAncestry, 00574 const bool noDiffDeleted) throw(ClientException); 00575 00599 std::string 00600 diff(const Path & tmpPath, const Path & path, 00601 const Revision & pegRevision, const Revision & revision1, 00602 const Revision & revision2, const bool recurse, 00603 const bool ignoreAncestry, const bool noDiffDeleted) 00604 throw(ClientException); 00605 00616 DirEntries 00617 list(const char * pathOrUrl, 00618 svn_opt_revision_t * revision, 00619 bool recurse) throw(ClientException); 00620 00630 PathPropertiesMapList 00631 proplist(const Path &path, 00632 const Revision &revision, 00633 bool recurse = false); 00634 00645 PathPropertiesMapList 00646 propget(const char * propName, 00647 const Path & path, 00648 const Revision & revision, 00649 bool recurse = false); 00650 00667 void 00668 propset(const char * propName, 00669 const char * propValue, 00670 const Path & path, 00671 const Revision & revision, 00672 bool recurse = false, 00673 bool skip_checks = true); 00674 00684 void 00685 propdel(const char * propName, 00686 const Path & path, 00687 const Revision & revision, 00688 bool recurse = false); 00689 00690 00699 std::pair<svn_revnum_t,PropertiesMap> 00700 revproplist(const Path & path, 00701 const Revision & revision); 00702 00712 std::pair<svn_revnum_t,std::string> 00713 revpropget(const char * propName, 00714 const Path & path, 00715 const Revision & revision); 00716 00728 svn_revnum_t 00729 revpropset(const char * propName, 00730 const char * propValue, 00731 const Path & path, 00732 const Revision & revision, 00733 bool force = false); 00734 00745 svn_revnum_t 00746 revpropdel(const char * propName, 00747 const Path & path, 00748 const Revision & revision, 00749 bool force = false); 00750 00751 00759 void 00760 ignore(const Path & path) throw(ClientException); 00761 00769 void 00770 ignore(const Targets & targets) throw(ClientException); 00771 private: 00772 Context * m_context; 00773 00777 Client & operator= (const Client &); 00778 00782 Client(const Client &); 00783 }; 00784 } 00785 00786 #endif 00787 /* ----------------------------------------------------------------- 00788 * local variables: 00789 * eval: (load-file "../../rapidsvn-dev.el") 00790 * end: 00791 */