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 /// check out for editing
40 virtual void checkOut() = 0;
41 /// revert current edits
42 virtual void revert() = 0;
44 virtual void undoLast() = 0;
46 * getLog - read the revision log into the given file
47 * @param fname file name to read into
49 virtual void getLog(support::FileName const &) = 0;
50 /// return the current version description
51 virtual std::string const versionString() const = 0;
52 /// return the current version
53 std::string const & version() const {
56 /// return the user who has locked the file
57 std::string const & locker() const { return locker_; }
58 /// set the owning buffer
59 void owner(Buffer * b) { owner_ = b; }
60 /// return the owning buffer
61 Buffer * owner() const { return owner_; }
62 /// return the lock status of this file
63 VCStatus status() const { return vcstatus; }
65 /// parse information from the version file
66 virtual void scanMaster() = 0;
69 * doVCCommand - call out to the version control utility
70 * @param cmd the command to execute
71 * @param path the path from which to execute
74 static int doVCCommand(std::string const & cmd, std::string const & path);
77 * The master VC file. For RCS this is *,v or RCS/ *,v. master should
80 support::FileName master_;
82 /// The status of the VC controlled file.
86 * The version of the VC file. I am not sure if this can be a
87 * string or if it must be a float/int.
91 /// The user currently keeping the lock on the VC file.
93 /// The buffer using this VC
99 class RCS : public VCS {
103 RCS(support::FileName const & m);
105 /// return the revision file for the given file, if found
106 static support::FileName const find_file(support::FileName const & file);
108 static void retrieve(support::FileName const & file);
110 virtual void registrer(std::string const & msg);
112 virtual void checkIn(std::string const & msg);
114 virtual void checkOut();
116 virtual void revert();
118 virtual void undoLast();
120 virtual void getLog(support::FileName const &);
122 virtual std::string const versionString() const {
123 return "RCS: " + version_;
127 virtual void scanMaster();
132 class CVS : public VCS {
136 CVS(support::FileName const & m, support::FileName const & f);
138 /// return the revision file for the given file, if found
139 static support::FileName const find_file(support::FileName const & file);
141 virtual void registrer(std::string const & msg);
143 virtual void checkIn(std::string const & msg);
145 virtual void checkOut();
147 virtual void revert();
149 virtual void undoLast();
151 virtual void getLog(support::FileName const &);
153 virtual std::string const versionString() const {
154 return "CVS: " + version_;
158 virtual void scanMaster();
161 support::FileName file_;
166 #endif // VCBACKEND_H