SvnCpp
client.hpp
Go to the documentation of this file.
1 /*
2  * ====================================================================
3  * Copyright (c) 2002-2009 The RapidSvn Group. All rights reserved.
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 3 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 (in the file GPL.txt.
17  * If not, see <http://www.gnu.org/licenses/>.
18  *
19  * This software consists of voluntary contributions made by many
20  * individuals. For exact contribution history, see the revision
21  * history and logs, available at http://rapidsvn.tigris.org/.
22  * ====================================================================
23  */
24 
25 #ifndef _SVNCPP_CLIENT_H_
26 #define _SVNCPP_CLIENT_H_
27 
28 // Ignore MSVC 6 compiler warning
29 #if defined (_MSC_VER) && _MSC_VER <= 1200
30 // debug symbol truncated
31 #pragma warning (disable: 4786)
32 // C++ exception specification
33 #pragma warning (disable: 4290)
34 #endif
35 
36 // Ignore MSVC 7,8,9 compiler warnings
37 #if defined (_MSC_VER) && _MSC_VER > 1200 && _MSC_VER <= 1500
38 // C++ exception specification
39 #pragma warning (disable: 4290)
40 #endif
41 
42 
43 // stl
46 #include "svncpp/map_wrapper.hpp"
47 
48 // svncpp
49 #include "svncpp/context.hpp"
50 #include "svncpp/exception.hpp"
51 #include "svncpp/path.hpp"
52 #include "svncpp/entry.hpp"
53 #include "svncpp/revision.hpp"
54 #include "svncpp/log_entry.hpp"
55 #include "svncpp/annotate_line.hpp"
56 
57 
58 namespace svn
59 {
60  // forward declarations
61  class Context;
62  class DirEntry;
63  class Info;
64  class Status;
65  class Targets;
66 
67  typedef std::vector<AnnotateLine> AnnotatedFile;
68  typedef std::vector<DirEntry> DirEntries;
69  typedef std::vector<Info> InfoVector;
70  typedef std::vector<LogEntry> LogEntries;
71  typedef std::vector<Status> StatusEntries;
72 
73 
74  // map of property names to values
75  typedef std::map<std::string,std::string> PropertiesMap;
76  // pair of path, PropertiesMap
77  typedef std::pair<std::string, PropertiesMap> PathPropertiesMapEntry;
78  // vector of path, Properties pairs
79  typedef std::vector<PathPropertiesMapEntry> PathPropertiesMapList;
80 
87  struct StatusFilter
88  {
89 public:
92  bool showModified;
96 
98  : showUnversioned(false), showUnmodified(false),
99  showModified(false), showConflicted(false),
100  showExternals(false)
101  {
102  }
103  };
104 
105 
109  class Client
110  {
111  public:
115  Client(Context * context = 0);
116 
117  virtual ~Client();
118 
122  const Context *
123  getContext() const;
124 
128  Context *
129  getContext();
130 
138  void
139  setContext(Context * context = NULL);
140 
154  StatusEntries
155  status(const char * path,
156  const bool descend = false,
157  const bool get_all = true,
158  const bool update = false,
159  const bool no_ignore = false,
160  const bool ignore_externals = false) throw(ClientException);
161 
179  svn_revnum_t
180  status(const char * path,
181  const StatusFilter & filter,
182  const bool descend,
183  const bool update,
184  StatusEntries & entries) throw(ClientException);
185 
186 
198  svn_revnum_t
199  checkout(const char * moduleName,
200  const Path & destPath,
201  const Revision & revision,
202  bool recurse,
203  bool ignore_externals = false,
204  const Revision & peg_revision = Revision::UNSPECIFIED) throw(ClientException);
205 
210  void
211  relocate(const Path & path, const char *from_url,
212  const char *to_url, bool recurse) throw(ClientException);
213 
218  void
219  remove(const Path & path, bool force) throw(ClientException);
220 
228  void
229  remove(const Targets & targets,
230  bool force) throw(ClientException);
231 
240  void
241  lock(const Targets & targets, bool force,
242  const char * comment) throw(ClientException);
243 
251  void
252  unlock(const Targets & targets, bool force) throw(ClientException);
253 
258  void
259  revert(const Targets & targets, bool recurse) throw(ClientException);
260 
265  void
266  add(const Path & path, bool recurse) throw(ClientException);
267 
280  std::vector<svn_revnum_t>
281  update(const Targets & targets,
282  const Revision & revision,
283  bool recurse,
284  bool ignore_externals) throw(ClientException);
285 
286  svn_revnum_t
287  update(const Path & path,
288  const Revision & revision,
289  bool recurse,
290  bool ignore_externals) throw(ClientException);
291 
302  std::string
303  cat(const Path & path,
304  const Revision & revision,
305  const Revision & peg_revision = Revision::UNSPECIFIED) throw(ClientException);
306 
307 
324  void
325  get(Path & dstPath,
326  const Path & path,
327  const Revision & revision,
328  const Revision & peg_revision = Revision::UNSPECIFIED) throw(ClientException);
329 
330 
340  AnnotatedFile *
341  annotate(const Path & path,
342  const Revision & revisionStart,
343  const Revision & revisionEnd) throw(ClientException);
344 
356  svn_revnum_t
357  commit(const Targets & targets,
358  const char * message,
359  bool recurse,
360  bool keep_locks = false) throw(ClientException);
361 
366  void
367  copy(const Path & srcPath,
368  const Revision & srcRevision,
369  const Path & destPath) throw(ClientException);
370 
375  void
376  move(const Path & srcPath,
377  const Revision & srcRevision,
378  const Path & destPath,
379  bool force) throw(ClientException);
380 
389  void
390  mkdir(const Path & path) throw(ClientException);
391 
392  void
393  mkdir(const Targets & targets) throw(ClientException);
394 
401  void
402  cleanup(const Path & path) throw(ClientException);
403 
408  void
409  resolved(const Path & path, bool recurse) throw(ClientException);
410 
424  void
425  doExport(const Path & from_path,
426  const Path & to_path,
427  const Revision & revision,
428  bool overwrite = false,
429  const Revision & peg_revision = Revision::UNSPECIFIED,
430  bool ignore_externals = false,
431  bool recurse = true,
432  const char * native_eol = NULL) throw(ClientException);
433 
439  svn_revnum_t
440  doSwitch(const Path & path, const char * url,
441  const Revision & revision,
442  bool recurse) throw(ClientException);
443 
453  void
454  import(const Path & path,
455  const char * url,
456  const char * message,
457  bool recurse) throw(ClientException);
458  void
459  import(const Path & path,
460  const Path & url,
461  const char * message,
462  bool recurse) throw(ClientException);
463 
464 
469  void
470  merge(const Path & path1, const Revision & revision1,
471  const Path & path2, const Revision & revision2,
472  const Path & localPath, bool force,
473  bool recurse,
474  bool notice_ancestry = false,
475  bool dry_run = false) throw(ClientException);
476 
477 
490  InfoVector
491  info(const Path & pathOrUrl,
492  bool recurse=false,
493  const Revision & revision = Revision::UNSPECIFIED,
494  const Revision & pegRevision = Revision::UNSPECIFIED) throw(ClientException);
495 
496 
512  const LogEntries *
513  log(const char * path,
514  const Revision & revisionStart,
515  const Revision & revisionEnd,
516  bool discoverChangedPaths = false,
517  bool strictNodeHistory = true) throw(ClientException);
518 
541  std::string
542  diff(const Path & tmpPath, const Path & path,
543  const Revision & revision1, const Revision & revision2,
544  const bool recurse, const bool ignoreAncestry,
545  const bool noDiffDeleted) throw(ClientException);
546 
570  std::string
571  diff(const Path & tmpPath, const Path & path1, const Path & path2,
572  const Revision & revision1, const Revision & revision2,
573  const bool recurse, const bool ignoreAncestry,
574  const bool noDiffDeleted) throw(ClientException);
575 
599  std::string
600  diff(const Path & tmpPath, const Path & path,
601  const Revision & pegRevision, const Revision & revision1,
602  const Revision & revision2, const bool recurse,
603  const bool ignoreAncestry, const bool noDiffDeleted)
604  throw(ClientException);
605 
616  DirEntries
617  list(const char * pathOrUrl,
618  svn_opt_revision_t * revision,
619  bool recurse) throw(ClientException);
620 
630  PathPropertiesMapList
631  proplist(const Path &path,
632  const Revision &revision,
633  bool recurse = false);
634 
645  PathPropertiesMapList
646  propget(const char * propName,
647  const Path & path,
648  const Revision & revision,
649  bool recurse = false);
650 
667  void
668  propset(const char * propName,
669  const char * propValue,
670  const Path & path,
671  const Revision & revision,
672  bool recurse = false,
673  bool skip_checks = true);
674 
684  void
685  propdel(const char * propName,
686  const Path & path,
687  const Revision & revision,
688  bool recurse = false);
689 
690 
699  std::pair<svn_revnum_t,PropertiesMap>
700  revproplist(const Path & path,
701  const Revision & revision);
702 
712  std::pair<svn_revnum_t,std::string>
713  revpropget(const char * propName,
714  const Path & path,
715  const Revision & revision);
716 
728  svn_revnum_t
729  revpropset(const char * propName,
730  const char * propValue,
731  const Path & path,
732  const Revision & revision,
733  bool force = false);
734 
745  svn_revnum_t
746  revpropdel(const char * propName,
747  const Path & path,
748  const Revision & revision,
749  bool force = false);
750 
751 
759  void
760  ignore(const Path & path) throw(ClientException);
761 
769  void
770  ignore(const Targets & targets) throw(ClientException);
771  private:
772  Context * m_context;
773 
777  Client & operator= (const Client &);
778 
782  Client(const Client &);
783  };
784 }
785 
786 #endif
787 /* -----------------------------------------------------------------
788  * local variables:
789  * eval: (load-file "../../rapidsvn-dev.el")
790  * end:
791  */
static const Revision UNSPECIFIED
Definition: revision.hpp:55
bool showExternals
Definition: client.hpp:95
void doExport(const Path &from_path, const Path &to_path, const Revision &revision, bool overwrite=false, const Revision &peg_revision=Revision::UNSPECIFIED, bool ignore_externals=false, bool recurse=true, const char *native_eol=NULL)
svn_revnum_t commit(const Targets &targets, const char *message, bool recurse, bool keep_locks=false)
InfoVector info(const Path &pathOrUrl, bool recurse=false, const Revision &revision=Revision::UNSPECIFIED, const Revision &pegRevision=Revision::UNSPECIFIED)
void propdel(const char *propName, const Path &path, const Revision &revision, bool recurse=false)
Definition: targets.hpp:43
std::vector< Status > StatusEntries
Definition: client.hpp:71
std::string cat(const Path &path, const Revision &revision, const Revision &peg_revision=Revision::UNSPECIFIED)
void relocate(const Path &path, const char *from_url, const char *to_url, bool recurse)
std::vector< Info > InfoVector
Definition: client.hpp:69
void cleanup(const Path &path)
PathPropertiesMapList proplist(const Path &path, const Revision &revision, bool recurse=false)
void mkdir(const Path &path)
void add(const Path &path, bool recurse)
virtual ~Client()
Definition: revision.hpp:42
void propset(const char *propName, const char *propValue, const Path &path, const Revision &revision, bool recurse=false, bool skip_checks=true)
DirEntries list(const char *pathOrUrl, svn_opt_revision_t *revision, bool recurse)
bool showUnversioned
Definition: client.hpp:90
std::string diff(const Path &tmpPath, const Path &path, const Revision &revision1, const Revision &revision2, const bool recurse, const bool ignoreAncestry, const bool noDiffDeleted)
Definition: context.hpp:48
Definition: path.hpp:37
bool showConflicted
Definition: client.hpp:93
void unlock(const Targets &targets, bool force)
std::vector< LogEntry > LogEntries
Definition: client.hpp:70
bool showIgnored
Definition: client.hpp:94
Definition: annotate_line.hpp:31
std::vector< AnnotateLine > AnnotatedFile
Definition: client.hpp:65
Definition: client.hpp:87
svn_revnum_t revpropset(const char *propName, const char *propValue, const Path &path, const Revision &revision, bool force=false)
std::pair< svn_revnum_t, std::string > revpropget(const char *propName, const Path &path, const Revision &revision)
bool showUnmodified
Definition: client.hpp:91
const LogEntries * log(const char *path, const Revision &revisionStart, const Revision &revisionEnd, bool discoverChangedPaths=false, bool strictNodeHistory=true)
void lock(const Targets &targets, bool force, const char *comment)
void merge(const Path &path1, const Revision &revision1, const Path &path2, const Revision &revision2, const Path &localPath, bool force, bool recurse, bool notice_ancestry=false, bool dry_run=false)
AnnotatedFile * annotate(const Path &path, const Revision &revisionStart, const Revision &revisionEnd)
std::vector< DirEntry > DirEntries
Definition: client.hpp:68
bool showModified
this includes showConflicted as well
Definition: client.hpp:92
svn_revnum_t revpropdel(const char *propName, const Path &path, const Revision &revision, bool force=false)
svn_revnum_t doSwitch(const Path &path, const char *url, const Revision &revision, bool recurse)
void ignore(const Path &path)
PathPropertiesMapList propget(const char *propName, const Path &path, const Revision &revision, bool recurse=false)
std::vector< PathPropertiesMapEntry > PathPropertiesMapList
Definition: client.hpp:79
void revert(const Targets &targets, bool recurse)
std::pair< svn_revnum_t, PropertiesMap > revproplist(const Path &path, const Revision &revision)
svn_revnum_t checkout(const char *moduleName, const Path &destPath, const Revision &revision, bool recurse, bool ignore_externals=false, const Revision &peg_revision=Revision::UNSPECIFIED)
std::vector< svn_revnum_t > update(const Targets &targets, const Revision &revision, bool recurse, bool ignore_externals)
const Context * getContext() const
void move(const Path &srcPath, const Revision &srcRevision, const Path &destPath, bool force)
std::map< std::string, std::string > PropertiesMap
Definition: client.hpp:75
void setContext(Context *context=NULL)
StatusEntries status(const char *path, const bool descend=false, const bool get_all=true, const bool update=false, const bool no_ignore=false, const bool ignore_externals=false)
void resolved(const Path &path, bool recurse)
void copy(const Path &srcPath, const Revision &srcRevision, const Path &destPath)
Client(Context *context=0)
StatusFilter()
Definition: client.hpp:97
Definition: exception.hpp:74
std::pair< std::string, PropertiesMap > PathPropertiesMapEntry
Definition: client.hpp:77
Definition: client.hpp:109