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 { return version_
; }
54 /// return the user who has locked the file
55 std::string
const & locker() const { return locker_
; }
56 /// set the owning buffer
57 void owner(Buffer
* b
) { owner_
= b
; }
58 /// return the owning buffer
59 Buffer
* owner() const { return owner_
; }
60 /// return the lock status of this file
61 VCStatus
status() const { return vcstatus
; }
63 /// parse information from the version file
64 virtual void scanMaster() = 0;
67 * doVCCommand - call out to the version control utility
68 * @param cmd the command to execute
69 * @param path the path from which to execute
72 static int doVCCommand(std::string
const & cmd
, support::FileName
const & path
);
75 * The master VC file. For RCS this is *,v or RCS/ *,v. master should
78 support::FileName master_
;
80 /// The status of the VC controlled file.
84 * The version of the VC file. I am not sure if this can be a
85 * string or if it must be a float/int.
89 /// The user currently keeping the lock on the VC file.
91 /// The buffer using this VC
97 class RCS
: public VCS
{
101 RCS(support::FileName
const & m
);
103 /// return the revision file for the given file, if found
104 static support::FileName
const findFile(support::FileName
const & file
);
106 static void retrieve(support::FileName
const & file
);
108 virtual void registrer(std::string
const & msg
);
110 virtual void checkIn(std::string
const & msg
);
112 virtual void checkOut();
114 virtual void revert();
116 virtual void undoLast();
118 virtual void getLog(support::FileName
const &);
120 virtual std::string
const versionString() const {
121 return "RCS: " + version_
;
125 virtual void scanMaster();
130 class CVS
: public VCS
{
134 CVS(support::FileName
const & m
, support::FileName
const & f
);
136 /// return the revision file for the given file, if found
137 static support::FileName
const findFile(support::FileName
const & file
);
139 virtual void registrer(std::string
const & msg
);
141 virtual void checkIn(std::string
const & msg
);
143 virtual void checkOut();
145 virtual void revert();
147 virtual void undoLast();
149 virtual void getLog(support::FileName
const &);
151 virtual std::string
const versionString() const {
152 return "CVS: " + version_
;
156 virtual void scanMaster();
159 support::FileName file_
;
164 #endif // VCBACKEND_H