4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
15 #include "support/FileName.h"
24 /// A simple version control system interface
27 /// the status of the managed file
35 /// register a file for version control
36 virtual void registrer(std::string const & msg) = 0;
37 /// check in the current revision
38 virtual void checkIn(std::string const & msg) = 0;
39 // can be this operation processed in the current RCS?
40 virtual bool checkInEnabled() = 0;
41 /// check out for editing
42 virtual void checkOut() = 0;
43 // can be this operation processed in the current RCS?
44 virtual bool checkOutEnabled() = 0;
45 /// revert current edits
46 virtual void revert() = 0;
48 virtual void undoLast() = 0;
49 // can be this operation processed in the current RCS?
50 virtual bool undoLastEnabled() = 0;
52 * getLog - read the revision log into the given file
53 * @param fname file name to read into
55 virtual void getLog(support::FileName const &) = 0;
56 /// return the current version description
57 virtual std::string const versionString() const = 0;
58 /// return the current version
59 std::string const & version() const { return version_; }
60 /// return the user who has locked the file
61 std::string const & locker() const { return locker_; }
62 /// set the owning buffer
63 void owner(Buffer * b) { owner_ = b; }
64 /// return the owning buffer
65 Buffer * owner() const { return owner_; }
66 /// return the lock status of this file
67 VCStatus status() const { return vcstatus; }
68 /// do we need special handling for read-only toggling?
69 virtual bool toggleReadOnlyEnabled() = 0;
71 /// parse information from the version file
72 virtual void scanMaster() = 0;
75 * doVCCommand - call out to the version control utility
76 * @param cmd the command to execute
77 * @param path the path from which to execute
80 static int doVCCommand(std::string const & cmd, support::FileName const & path);
83 * The master VC file. For RCS this is *,v or RCS/ *,v. master should
86 support::FileName master_;
88 /// The status of the VC controlled file.
92 * The version of the VC file. I am not sure if this can be a
93 * string or if it must be a float/int.
97 /// The user currently keeping the lock on the VC file.
99 /// The buffer using this VC
105 class RCS : public VCS {
109 RCS(support::FileName const & m);
111 /// return the revision file for the given file, if found
112 static support::FileName const findFile(support::FileName const & file);
114 static void retrieve(support::FileName const & file);
116 virtual void registrer(std::string const & msg);
118 virtual void checkIn(std::string const & msg);
120 virtual bool checkInEnabled();
122 virtual void checkOut();
124 virtual bool checkOutEnabled();
126 virtual void revert();
128 virtual void undoLast();
130 virtual bool undoLastEnabled();
132 virtual void getLog(support::FileName const &);
134 virtual std::string const versionString() const {
135 return "RCS: " + version_;
138 virtual bool toggleReadOnlyEnabled();
141 virtual void scanMaster();
146 class CVS : public VCS {
150 CVS(support::FileName const & m, support::FileName const & f);
152 /// return the revision file for the given file, if found
153 static support::FileName const findFile(support::FileName const & file);
155 virtual void registrer(std::string const & msg);
157 virtual void checkIn(std::string const & msg);
159 virtual bool checkInEnabled();
161 virtual void checkOut();
163 virtual bool checkOutEnabled();
165 virtual void revert();
167 virtual void undoLast();
169 virtual bool undoLastEnabled();
171 virtual void getLog(support::FileName const &);
173 virtual std::string const versionString() const {
174 return "CVS: " + version_;
177 virtual bool toggleReadOnlyEnabled();
180 virtual void scanMaster();
183 support::FileName file_;
188 class SVN : public VCS {
192 SVN(support::FileName const & m, support::FileName const & f);
194 /// return the revision file for the given file, if found
195 static support::FileName const findFile(support::FileName const & file);
197 virtual void registrer(std::string const & msg);
199 virtual void checkIn(std::string const & msg);
201 virtual bool checkInEnabled();
203 virtual void checkOut();
205 virtual bool checkOutEnabled();
207 virtual void revert();
209 virtual void undoLast();
211 virtual bool undoLastEnabled();
213 virtual void getLog(support::FileName const &);
215 virtual std::string const versionString() const {
216 return "SVN: " + version_;
219 virtual bool toggleReadOnlyEnabled();
222 virtual void scanMaster();
225 support::FileName file_;
230 #endif // VCBACKEND_H