mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
This should bring cvs revision control to usable state.
LyXVC API was too narrow to master both cvs and rcs, so we have to change interface. We still need one more operation for cvs update, but i need to sleep sometimes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25750 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
41e8a73f66
commit
4b00e7f527
@ -461,15 +461,17 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
enable = !buf->lyxvc().inUse();
|
||||
break;
|
||||
case LFUN_VC_CHECK_IN:
|
||||
enable = buf->lyxvc().inUse() && !buf->isReadonly();
|
||||
enable = buf->lyxvc().checkInEnabled();
|
||||
break;
|
||||
case LFUN_VC_CHECK_OUT:
|
||||
enable = buf->lyxvc().inUse() && buf->isReadonly();
|
||||
enable = buf->lyxvc().checkOutEnabled();
|
||||
break;
|
||||
case LFUN_VC_REVERT:
|
||||
case LFUN_VC_UNDO_LAST:
|
||||
enable = buf->lyxvc().inUse();
|
||||
break;
|
||||
case LFUN_VC_UNDO_LAST:
|
||||
enable = buf->lyxvc().undoLastEnabled();
|
||||
break;
|
||||
case LFUN_BUFFER_RELOAD:
|
||||
enable = !buf->isUnnamed() && buf->fileName().exists()
|
||||
&& (!buf->isClean() || buf->isExternallyModified(Buffer::timestamp_method));
|
||||
|
@ -228,4 +228,22 @@ string const LyXVC::getLogFile() const
|
||||
}
|
||||
|
||||
|
||||
bool LyXVC::checkOutEnabled()
|
||||
{
|
||||
return vcs && vcs->checkOutEnabled();
|
||||
}
|
||||
|
||||
|
||||
bool LyXVC::checkInEnabled()
|
||||
{
|
||||
return vcs && vcs->checkInEnabled();
|
||||
}
|
||||
|
||||
|
||||
bool LyXVC::undoLastEnabled()
|
||||
{
|
||||
return vcs && vcs->undoLastEnabled();
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -70,15 +70,21 @@ public:
|
||||
|
||||
/// Unlock and commit changes.
|
||||
void checkIn();
|
||||
/// Does the current VC supports this operation?
|
||||
bool checkInEnabled();
|
||||
|
||||
/// Lock and prepare to edit document.
|
||||
void checkOut();
|
||||
/// Does the current VC supports this operation?
|
||||
bool checkOutEnabled();
|
||||
|
||||
/// Revert to last version
|
||||
void revert();
|
||||
|
||||
/// Undo last check-in.
|
||||
void undoLast();
|
||||
/// Does the current VC supports this operation?
|
||||
bool undoLastEnabled();
|
||||
|
||||
/**
|
||||
* Generate a log file and return the filename.
|
||||
|
@ -163,6 +163,10 @@ void RCS::checkIn(string const & msg)
|
||||
FileName(owner_->filePath()));
|
||||
}
|
||||
|
||||
bool RCS::checkInEnabled()
|
||||
{
|
||||
return owner_ && !owner_->isReadonly();
|
||||
}
|
||||
|
||||
void RCS::checkOut()
|
||||
{
|
||||
@ -172,6 +176,12 @@ void RCS::checkOut()
|
||||
}
|
||||
|
||||
|
||||
bool RCS::checkOutEnabled()
|
||||
{
|
||||
return owner_ && owner_->isReadonly();
|
||||
}
|
||||
|
||||
|
||||
void RCS::revert()
|
||||
{
|
||||
doVCCommand("co -f -u" + version() + " "
|
||||
@ -191,6 +201,12 @@ void RCS::undoLast()
|
||||
}
|
||||
|
||||
|
||||
bool RCS::undoLastEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void RCS::getLog(FileName const & tmpf)
|
||||
{
|
||||
doVCCommand("rlog " + quoteName(onlyFilename(owner_->absFileName()))
|
||||
@ -297,6 +313,12 @@ void CVS::checkIn(string const & msg)
|
||||
}
|
||||
|
||||
|
||||
bool CVS::checkInEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CVS::checkOut()
|
||||
{
|
||||
// cvs update or perhaps for cvs this should be a noop
|
||||
@ -304,6 +326,12 @@ void CVS::checkOut()
|
||||
}
|
||||
|
||||
|
||||
bool CVS::checkOutEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CVS::revert()
|
||||
{
|
||||
// Reverts to the version in CVS repository and
|
||||
@ -325,6 +353,12 @@ void CVS::undoLast()
|
||||
}
|
||||
|
||||
|
||||
bool CVS::undoLastEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void CVS::getLog(FileName const & tmpf)
|
||||
{
|
||||
doVCCommand("cvs log " + quoteName(onlyFilename(owner_->absFileName()))
|
||||
|
@ -36,12 +36,18 @@ public:
|
||||
virtual void registrer(std::string const & msg) = 0;
|
||||
/// check in the current revision
|
||||
virtual void checkIn(std::string const & msg) = 0;
|
||||
// can be this operation processed in the current RCS?
|
||||
virtual bool checkInEnabled() = 0;
|
||||
/// check out for editing
|
||||
virtual void checkOut() = 0;
|
||||
// can be this operation processed in the current RCS?
|
||||
virtual bool checkOutEnabled() = 0;
|
||||
/// revert current edits
|
||||
virtual void revert() = 0;
|
||||
/// FIXME
|
||||
virtual void undoLast() = 0;
|
||||
// can be this operation processed in the current RCS?
|
||||
virtual bool undoLastEnabled() = 0;
|
||||
/**
|
||||
* getLog - read the revision log into the given file
|
||||
* @param fname file name to read into
|
||||
@ -109,12 +115,18 @@ public:
|
||||
|
||||
virtual void checkIn(std::string const & msg);
|
||||
|
||||
virtual bool checkInEnabled();
|
||||
|
||||
virtual void checkOut();
|
||||
|
||||
virtual bool checkOutEnabled();
|
||||
|
||||
virtual void revert();
|
||||
|
||||
virtual void undoLast();
|
||||
|
||||
virtual bool undoLastEnabled();
|
||||
|
||||
virtual void getLog(support::FileName const &);
|
||||
|
||||
virtual std::string const versionString() const {
|
||||
@ -140,12 +152,18 @@ public:
|
||||
|
||||
virtual void checkIn(std::string const & msg);
|
||||
|
||||
virtual bool checkInEnabled();
|
||||
|
||||
virtual void checkOut();
|
||||
|
||||
virtual bool checkOutEnabled();
|
||||
|
||||
virtual void revert();
|
||||
|
||||
virtual void undoLast();
|
||||
|
||||
virtual bool undoLastEnabled();
|
||||
|
||||
virtual void getLog(support::FileName const &);
|
||||
|
||||
virtual std::string const versionString() const {
|
||||
|
Loading…
Reference in New Issue
Block a user