mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
VCS: Extended API for revision info
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33425 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
22b98a7ca4
commit
7b227d6899
@ -287,6 +287,15 @@ string const LyXVC::getLogFile() const
|
||||
}
|
||||
|
||||
|
||||
std::string const LyXVC::revisionInfo(RevisionInfo const info)
|
||||
{
|
||||
if (!vcs)
|
||||
return string();
|
||||
|
||||
return vcs->revisionInfo(info);
|
||||
}
|
||||
|
||||
|
||||
bool LyXVC::checkOutEnabled() const
|
||||
{
|
||||
return vcs && vcs->checkOutEnabled();
|
||||
|
15
src/LyXVC.h
15
src/LyXVC.h
@ -123,8 +123,7 @@ public:
|
||||
/// Is the document under administration by VCS?
|
||||
bool inUse() const;
|
||||
|
||||
/// FIXME resurrect version once we add version info
|
||||
/// into SVN. RCS parser is already prepared.
|
||||
/// FIXME Either rename or kill, we have revisionInfo now.
|
||||
/// Returns the version number.
|
||||
//std::string const & version() const;
|
||||
/// Returns the version number.
|
||||
@ -144,6 +143,18 @@ public:
|
||||
*/
|
||||
std::string const & locker() const;
|
||||
|
||||
// type of the revision information
|
||||
enum RevisionInfo {
|
||||
File = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Return revision info specified by the argument.
|
||||
* Its safe to call it regardless VCS is in usage or this
|
||||
* info is (un)available. Returns empty string in such a case.
|
||||
*/
|
||||
std::string const revisionInfo(RevisionInfo const info);
|
||||
|
||||
private:
|
||||
///
|
||||
Buffer * owner_;
|
||||
|
@ -280,6 +280,12 @@ bool RCS::toggleReadOnlyEnabled()
|
||||
return false;
|
||||
}
|
||||
|
||||
// FIXME This could be implemented with cache from scanMaster
|
||||
string const RCS::revisionInfo(LyXVC::RevisionInfo const)
|
||||
{
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -475,6 +481,13 @@ bool CVS::toggleReadOnlyEnabled()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
string const CVS::revisionInfo(LyXVC::RevisionInfo const)
|
||||
{
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SVN
|
||||
@ -844,7 +857,25 @@ bool SVN::undoLastEnabled()
|
||||
}
|
||||
|
||||
|
||||
string SVN::getFileRevisionInfo(){
|
||||
string const SVN::revisionInfo(LyXVC::RevisionInfo const info)
|
||||
{
|
||||
switch (info) {
|
||||
case LyXVC::File:
|
||||
if (_rev_file_cache.empty())
|
||||
_rev_file_cache = getFileRevisionInfo();
|
||||
if (_rev_file_cache.empty())
|
||||
_rev_file_cache = "?";
|
||||
if (_rev_file_cache == "?")
|
||||
return string();
|
||||
|
||||
return _rev_file_cache;
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
std::string SVN::getFileRevisionInfo()
|
||||
{
|
||||
FileName tmpf = FileName::tempName("lyxvcout");
|
||||
|
||||
doVCCommand("svn info --xml " + quoteName(onlyFilename(owner_->absFileName()))
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "LyXVC.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -77,6 +79,8 @@ public:
|
||||
/// do we need special handling for read-only toggling?
|
||||
/// (also used for check-out operation)
|
||||
virtual bool toggleReadOnlyEnabled() = 0;
|
||||
/// Return revision info specified by the argument.
|
||||
virtual std::string const revisionInfo(LyXVC::RevisionInfo const info) = 0;
|
||||
protected:
|
||||
/// parse information from the version file
|
||||
virtual void scanMaster() = 0;
|
||||
@ -157,6 +161,8 @@ public:
|
||||
|
||||
virtual bool toggleReadOnlyEnabled();
|
||||
|
||||
virtual std::string const revisionInfo(LyXVC::RevisionInfo const info);
|
||||
|
||||
protected:
|
||||
virtual void scanMaster();
|
||||
};
|
||||
@ -204,6 +210,8 @@ public:
|
||||
|
||||
virtual bool toggleReadOnlyEnabled();
|
||||
|
||||
virtual std::string const revisionInfo(LyXVC::RevisionInfo const info);
|
||||
|
||||
protected:
|
||||
virtual void scanMaster();
|
||||
|
||||
@ -254,7 +262,7 @@ public:
|
||||
|
||||
virtual bool toggleReadOnlyEnabled();
|
||||
|
||||
std::string getFileRevisionInfo();
|
||||
virtual std::string const revisionInfo(LyXVC::RevisionInfo const info);
|
||||
|
||||
protected:
|
||||
virtual void scanMaster();
|
||||
@ -271,6 +279,10 @@ private:
|
||||
support::FileName file_;
|
||||
/// is the loaded file under locking policy?
|
||||
bool locked_mode_;
|
||||
/// real code for obtaining file revision info
|
||||
std::string getFileRevisionInfo();
|
||||
/// cache for file revision number, "?" if already unsuccessful
|
||||
std::string _rev_file_cache;
|
||||
};
|
||||
|
||||
} // namespace lyx
|
||||
|
Loading…
Reference in New Issue
Block a user