2003-08-23 00:17:00 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file LyXVC.cpp
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Allan Rae
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "LyXVC.h"
|
|
|
|
#include "VCBackend.h"
|
|
|
|
#include "Buffer.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
#include "frontends/alert.h"
|
2002-03-25 22:07:48 +00:00
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
2002-03-25 22:07:48 +00:00
|
|
|
#include "support/filetools.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/gettext.h"
|
2007-11-13 23:50:28 +00:00
|
|
|
#include "support/lstrings.h"
|
2014-06-09 11:05:50 +00:00
|
|
|
#include "support/TempFile.h"
|
2002-03-25 22:07:48 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 18:57:56 +00:00
|
|
|
using namespace lyx::support;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
namespace Alert = frontend::Alert;
|
2006-10-07 16:47:54 +00:00
|
|
|
|
2003-05-13 09:48:57 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
LyXVC::LyXVC()
|
|
|
|
{
|
1999-11-09 23:52:04 +00:00
|
|
|
owner_ = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-03 17:47:28 +00:00
|
|
|
// for the sake of boost::scoped_ptr
|
1999-09-27 18:44:28 +00:00
|
|
|
LyXVC::~LyXVC()
|
2003-11-03 17:47:28 +00:00
|
|
|
{}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
2012-11-15 21:01:19 +00:00
|
|
|
bool LyXVC::fileInVC(FileName const & fn)
|
|
|
|
{
|
|
|
|
if (!RCS::findFile(fn).empty())
|
|
|
|
return true;
|
|
|
|
if (!CVS::findFile(fn).empty())
|
|
|
|
return true;
|
|
|
|
if (!SVN::findFile(fn).empty())
|
|
|
|
return true;
|
2013-02-06 21:07:31 +00:00
|
|
|
if (!GIT::findFile(fn).empty())
|
|
|
|
return true;
|
2012-11-15 21:01:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
bool LyXVC::file_found_hook(FileName const & fn)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2006-12-02 16:07:15 +00:00
|
|
|
FileName found_file;
|
1999-11-09 23:52:04 +00:00
|
|
|
// Check if file is under RCS
|
2007-11-25 11:18:16 +00:00
|
|
|
if (!(found_file = RCS::findFile(fn)).empty()) {
|
2012-11-13 20:44:36 +00:00
|
|
|
vcs.reset(new RCS(found_file, owner_));
|
1999-11-09 23:52:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// Check if file is under CVS
|
2007-11-25 11:18:16 +00:00
|
|
|
if (!(found_file = CVS::findFile(fn)).empty()) {
|
2012-11-13 20:44:36 +00:00
|
|
|
vcs.reset(new CVS(found_file, owner_));
|
1999-09-27 18:44:28 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-07-22 08:59:15 +00:00
|
|
|
// Check if file is under SVN
|
|
|
|
if (!(found_file = SVN::findFile(fn)).empty()) {
|
2012-11-13 20:44:36 +00:00
|
|
|
vcs.reset(new SVN(found_file, owner_));
|
2008-07-22 08:59:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
2013-02-06 21:07:31 +00:00
|
|
|
// Check if file is under GIT
|
|
|
|
if (!(found_file = GIT::findFile(fn)).empty()) {
|
|
|
|
vcs.reset(new GIT(found_file, owner_));
|
|
|
|
return true;
|
|
|
|
}
|
2008-07-22 08:59:15 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// file is not under any VCS.
|
2010-10-23 18:35:13 +00:00
|
|
|
vcs.reset(0);
|
1999-09-27 18:44:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
bool LyXVC::file_not_found_hook(FileName const & fn)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2008-07-22 08:59:47 +00:00
|
|
|
// Check if file is under RCS.
|
|
|
|
// This happens if we are trying to load non existent
|
|
|
|
// file on disk, but existent in ,v version.
|
2012-11-15 21:01:19 +00:00
|
|
|
bool foundRCS = !RCS::findFile(fn).empty();
|
|
|
|
bool foundCVS = foundRCS ? false : !CVS::findFile(fn).empty();
|
|
|
|
bool foundSVN = (foundRCS || foundCVS) ? false : !SVN::findFile(fn).empty();
|
2013-02-06 21:07:31 +00:00
|
|
|
bool foundGIT = (foundRCS || foundCVS || foundSVN) ? false : !GIT::findFile(fn).empty();
|
|
|
|
if (foundRCS || foundCVS || foundSVN || foundGIT) {
|
2010-04-21 01:19:09 +00:00
|
|
|
docstring const file = makeDisplayPath(fn.absFileName(), 20);
|
2010-01-08 18:48:36 +00:00
|
|
|
docstring const text =
|
|
|
|
bformat(_("Do you want to retrieve the document"
|
|
|
|
" %1$s from version control?"), file);
|
|
|
|
int const ret = Alert::prompt(_("Retrieve from version control?"),
|
|
|
|
text, 0, 1, _("&Retrieve"), _("&Cancel"));
|
|
|
|
|
|
|
|
if (ret == 0) {
|
2012-11-15 21:01:19 +00:00
|
|
|
// Since the retrieve commands are implemented using
|
|
|
|
// more general update commands we need to ensure that
|
|
|
|
// we do not change an existing file by accident.
|
|
|
|
if (fn.exists())
|
|
|
|
return false;
|
|
|
|
if (foundRCS)
|
|
|
|
return RCS::retrieve(fn);
|
|
|
|
else if (foundCVS)
|
|
|
|
return CVS::retrieve(fn);
|
2013-02-06 21:07:31 +00:00
|
|
|
else if (foundSVN)
|
2012-11-15 21:01:19 +00:00
|
|
|
return SVN::retrieve(fn);
|
2013-02-06 21:07:31 +00:00
|
|
|
else
|
|
|
|
return GIT::retrieve(fn);
|
2010-01-08 18:48:36 +00:00
|
|
|
}
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-20 17:35:27 +00:00
|
|
|
void LyXVC::setBuffer(Buffer * buf)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
1999-11-09 23:52:04 +00:00
|
|
|
owner_ = buf;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-08 00:14:55 +00:00
|
|
|
bool LyXVC::registrer()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2007-11-03 17:37:37 +00:00
|
|
|
FileName const filename = owner_->fileName();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-05-31 01:14:53 +00:00
|
|
|
// there must be a file to save
|
2007-11-25 11:18:16 +00:00
|
|
|
if (!filename.isReadableFile()) {
|
2006-09-11 08:54:10 +00:00
|
|
|
Alert::error(_("Document not saved"),
|
|
|
|
_("You must save the document "
|
|
|
|
"before it can be registered."));
|
2009-01-08 00:14:55 +00:00
|
|
|
return false;
|
2002-05-31 01:14:53 +00:00
|
|
|
}
|
|
|
|
|
1999-11-09 23:52:04 +00:00
|
|
|
// it is very likely here that the vcs is not created yet...
|
|
|
|
if (!vcs) {
|
2008-07-21 00:18:19 +00:00
|
|
|
//check in the root directory of the document
|
2010-04-21 01:19:09 +00:00
|
|
|
FileName const cvs_entries(onlyPath(filename.absFileName()) + "/CVS/Entries");
|
|
|
|
FileName const svn_entries(onlyPath(filename.absFileName()) + "/.svn/entries");
|
2013-02-06 21:07:31 +00:00
|
|
|
FileName const git_index(onlyPath(filename.absFileName()) + "/.git/index");
|
2008-07-22 08:59:15 +00:00
|
|
|
|
2013-02-06 21:07:31 +00:00
|
|
|
if (git_index.isReadableFile()) {
|
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: registering "
|
|
|
|
<< to_utf8(filename.displayName()) << " with GIT");
|
|
|
|
vcs.reset(new GIT(git_index, owner_));
|
|
|
|
|
|
|
|
} else if (svn_entries.isReadableFile()) {
|
2008-07-22 08:59:15 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: registering "
|
|
|
|
<< to_utf8(filename.displayName()) << " with SVN");
|
2013-02-05 20:40:19 +00:00
|
|
|
vcs.reset(new SVN(svn_entries, owner_));
|
2002-03-26 12:11:43 +00:00
|
|
|
|
2008-07-22 08:59:15 +00:00
|
|
|
} else if (cvs_entries.isReadableFile()) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: registering "
|
|
|
|
<< to_utf8(filename.displayName()) << " with CVS");
|
2012-11-13 20:44:36 +00:00
|
|
|
vcs.reset(new CVS(cvs_entries, owner_));
|
2002-03-26 12:11:43 +00:00
|
|
|
|
|
|
|
} else {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: registering "
|
|
|
|
<< to_utf8(filename.displayName()) << " with RCS");
|
2012-11-13 20:44:36 +00:00
|
|
|
vcs.reset(new RCS(FileName(), owner_));
|
2002-03-26 12:11:43 +00:00
|
|
|
}
|
1999-11-09 23:52:04 +00:00
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: registrer");
|
2007-11-13 23:00:36 +00:00
|
|
|
docstring response;
|
|
|
|
bool ok = Alert::askForText(response, _("LyX VC: Initial description"),
|
|
|
|
_("(no initial description)"));
|
2008-10-30 13:47:41 +00:00
|
|
|
if (!ok) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
|
2010-10-24 13:26:00 +00:00
|
|
|
vcs.reset(0);
|
2009-01-08 00:14:55 +00:00
|
|
|
return false;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2008-10-30 13:47:41 +00:00
|
|
|
if (response.empty())
|
|
|
|
response = _("(no initial description)");
|
2007-11-13 23:00:36 +00:00
|
|
|
vcs->registrer(to_utf8(response));
|
2009-01-08 00:14:55 +00:00
|
|
|
return true;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-05 20:31:58 +00:00
|
|
|
string LyXVC::rename(FileName const & fn)
|
|
|
|
{
|
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: rename");
|
|
|
|
if (!vcs || fileInVC(fn))
|
|
|
|
return string();
|
|
|
|
docstring response;
|
|
|
|
bool ok = Alert::askForText(response, _("LyX VC: Log message"),
|
|
|
|
_("(no log message)"));
|
|
|
|
if (!ok) {
|
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
|
|
|
|
return string();
|
|
|
|
}
|
|
|
|
if (response.empty())
|
|
|
|
response = _("(no log message)");
|
|
|
|
string ret = vcs->rename(fn, to_utf8(response));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string LyXVC::copy(FileName const & fn)
|
|
|
|
{
|
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: copy");
|
|
|
|
if (!vcs || fileInVC(fn))
|
|
|
|
return string();
|
|
|
|
docstring response;
|
|
|
|
bool ok = Alert::askForText(response, _("LyX VC: Log message"),
|
|
|
|
_("(no log message)"));
|
|
|
|
if (!ok) {
|
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
|
|
|
|
return string();
|
|
|
|
}
|
|
|
|
if (response.empty())
|
|
|
|
response = _("(no log message)");
|
|
|
|
string ret = vcs->copy(fn, to_utf8(response));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-04 20:40:28 +00:00
|
|
|
LyXVC::CommandResult LyXVC::checkIn(string & log)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: checkIn");
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
2013-02-04 20:40:28 +00:00
|
|
|
return ErrorBefore;
|
2010-01-10 21:18:41 +00:00
|
|
|
docstring empty(_("(no log message)"));
|
2007-11-13 23:00:36 +00:00
|
|
|
docstring response;
|
2010-10-25 13:27:48 +00:00
|
|
|
bool ok = true;
|
|
|
|
if (vcs->isCheckInWithConfirmation())
|
|
|
|
ok = Alert::askForText(response, _("LyX VC: Log Message"));
|
2007-11-13 23:00:36 +00:00
|
|
|
if (ok) {
|
|
|
|
if (response.empty())
|
2010-01-10 21:18:41 +00:00
|
|
|
response = empty;
|
2011-03-07 00:37:26 +00:00
|
|
|
//shell collisions
|
2013-02-03 16:03:08 +00:00
|
|
|
response = subst(response, from_ascii("\""), from_ascii("\\\""));
|
2013-02-04 20:40:28 +00:00
|
|
|
return vcs->checkIn(to_utf8(response), log);
|
1999-12-30 02:35:43 +00:00
|
|
|
} else {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
|
2013-02-04 20:40:28 +00:00
|
|
|
return Cancelled;
|
1999-12-30 02:35:43 +00:00
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-29 13:14:51 +00:00
|
|
|
string LyXVC::checkOut()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return string();
|
2008-07-22 10:16:12 +00:00
|
|
|
//RCS allows checkOut only in ReadOnly mode
|
2010-03-11 19:40:11 +00:00
|
|
|
if (vcs->toggleReadOnlyEnabled() && !owner_->isReadonly())
|
|
|
|
return string();
|
2008-07-22 10:16:12 +00:00
|
|
|
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: checkOut");
|
2008-07-29 13:14:51 +00:00
|
|
|
return vcs->checkOut();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-14 19:18:06 +00:00
|
|
|
string LyXVC::repoUpdate()
|
2009-10-06 23:20:52 +00:00
|
|
|
{
|
2009-10-14 19:18:06 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: repoUpdate");
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return string();
|
2009-10-14 19:18:06 +00:00
|
|
|
return vcs->repoUpdate();
|
2009-10-06 23:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-25 14:48:11 +00:00
|
|
|
string LyXVC::lockingToggle()
|
|
|
|
{
|
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: toggle locking property");
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return string();
|
2009-06-25 14:48:11 +00:00
|
|
|
return vcs->lockingToggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-06 11:54:08 +00:00
|
|
|
bool LyXVC::revert()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: revert");
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return false;
|
1999-11-09 23:52:04 +00:00
|
|
|
|
2007-11-03 17:37:37 +00:00
|
|
|
docstring const file = owner_->fileName().displayName(20);
|
2006-09-11 08:54:10 +00:00
|
|
|
docstring text = bformat(_("Reverting to the stored version of the "
|
2008-07-22 10:16:30 +00:00
|
|
|
"document %1$s will lose all current changes.\n\n"
|
|
|
|
"Do you want to revert to the older version?"), file);
|
2010-10-25 13:27:48 +00:00
|
|
|
int ret = 0;
|
|
|
|
if (vcs->isRevertWithConfirmation())
|
|
|
|
ret = Alert::prompt(_("Revert to stored version of document?"),
|
|
|
|
text, 0, 1, _("&Revert"), _("&Cancel"));
|
2003-03-29 07:09:13 +00:00
|
|
|
|
2010-11-06 11:54:08 +00:00
|
|
|
return ret == 0 && vcs->revert();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LyXVC::undoLast()
|
|
|
|
{
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return;
|
1999-11-09 23:52:04 +00:00
|
|
|
vcs->undoLast();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-03 18:21:54 +00:00
|
|
|
string LyXVC::toggleReadOnly()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
2013-02-03 18:21:54 +00:00
|
|
|
return string();
|
2008-07-22 09:00:05 +00:00
|
|
|
if (!vcs->toggleReadOnlyEnabled())
|
2013-02-03 18:21:54 +00:00
|
|
|
return string();
|
2008-07-22 09:00:05 +00:00
|
|
|
|
2000-05-17 16:42:35 +00:00
|
|
|
switch (vcs->status()) {
|
1999-11-09 23:52:04 +00:00
|
|
|
case VCS::UNLOCKED:
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: toggle to locked");
|
2013-02-03 18:21:54 +00:00
|
|
|
return checkOut();
|
2013-02-04 20:40:28 +00:00
|
|
|
case VCS::LOCKED: {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "LyXVC: toggle to unlocked");
|
2013-02-04 20:40:28 +00:00
|
|
|
string log;
|
2013-03-18 19:42:20 +00:00
|
|
|
if (checkIn(log) != VCSuccess)
|
2013-02-04 20:40:28 +00:00
|
|
|
return string();
|
|
|
|
return log;
|
|
|
|
}
|
2009-02-01 23:46:41 +00:00
|
|
|
case VCS::NOLOCKING:
|
2009-02-01 23:27:58 +00:00
|
|
|
break;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2013-02-03 18:21:54 +00:00
|
|
|
return string();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 14:40:02 +00:00
|
|
|
bool LyXVC::inUse() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2007-10-20 17:35:27 +00:00
|
|
|
if (vcs)
|
2013-04-10 20:31:38 +00:00
|
|
|
return true;
|
1999-09-27 18:44:28 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 14:06:27 +00:00
|
|
|
string const LyXVC::versionString() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return string();
|
2001-08-19 14:06:27 +00:00
|
|
|
return vcs->versionString();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-12 07:21:11 +00:00
|
|
|
bool LyXVC::locking() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2012-11-25 18:07:57 +00:00
|
|
|
if (!vcs)
|
|
|
|
return false;
|
2010-02-12 07:21:11 +00:00
|
|
|
return vcs->status() != VCS::NOLOCKING;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
1999-11-09 23:52:04 +00:00
|
|
|
|
2003-06-28 01:23:11 +00:00
|
|
|
string const LyXVC::getLogFile() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2001-02-06 17:41:42 +00:00
|
|
|
if (!vcs)
|
|
|
|
return string();
|
1999-10-25 14:18:30 +00:00
|
|
|
|
2014-06-09 11:05:50 +00:00
|
|
|
TempFile tempfile("lyxvclog");
|
|
|
|
tempfile.setAutoRemove(false);
|
|
|
|
FileName const tmpf = tempfile.name();
|
2004-02-25 12:00:53 +00:00
|
|
|
if (tmpf.empty()) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
|
2004-02-25 12:00:53 +00:00
|
|
|
return string();
|
|
|
|
}
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::LYXVC, "Generating logfile " << tmpf);
|
1999-11-09 23:52:04 +00:00
|
|
|
vcs->getLog(tmpf);
|
2010-04-21 01:19:09 +00:00
|
|
|
return tmpf.absFileName();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
2010-09-07 11:29:05 +00:00
|
|
|
string LyXVC::revisionInfo(RevisionInfo const info) const
|
2010-02-12 01:43:59 +00:00
|
|
|
{
|
|
|
|
if (!vcs)
|
|
|
|
return string();
|
|
|
|
|
|
|
|
return vcs->revisionInfo(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-05 20:31:58 +00:00
|
|
|
bool LyXVC::renameEnabled() const
|
|
|
|
{
|
|
|
|
if (!inUse())
|
|
|
|
return false;
|
|
|
|
return vcs->renameEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool LyXVC::copyEnabled() const
|
|
|
|
{
|
2013-02-06 21:07:31 +00:00
|
|
|
if (!inUse())
|
|
|
|
return false;
|
|
|
|
return vcs->copyEnabled();
|
2013-02-05 20:31:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 14:40:02 +00:00
|
|
|
bool LyXVC::checkOutEnabled() const
|
2008-07-21 01:55:58 +00:00
|
|
|
{
|
|
|
|
return vcs && vcs->checkOutEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 14:40:02 +00:00
|
|
|
bool LyXVC::checkInEnabled() const
|
2008-07-21 01:55:58 +00:00
|
|
|
{
|
|
|
|
return vcs && vcs->checkInEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-05 20:31:58 +00:00
|
|
|
bool LyXVC::isCheckInWithConfirmation() const
|
|
|
|
{
|
|
|
|
return vcs && vcs->isCheckInWithConfirmation();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 14:40:02 +00:00
|
|
|
bool LyXVC::lockingToggleEnabled() const
|
2009-06-25 14:48:11 +00:00
|
|
|
{
|
|
|
|
return vcs && vcs->lockingToggleEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-31 14:40:02 +00:00
|
|
|
bool LyXVC::undoLastEnabled() const
|
2008-07-21 01:55:58 +00:00
|
|
|
{
|
|
|
|
return vcs && vcs->undoLastEnabled();
|
|
|
|
}
|
|
|
|
|
2010-10-08 05:26:12 +00:00
|
|
|
|
|
|
|
bool LyXVC::repoUpdateEnabled() const
|
|
|
|
{
|
|
|
|
return vcs && vcs->repoUpdateEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-15 07:10:59 +00:00
|
|
|
bool LyXVC::prepareFileRevision(string const & rev, std::string & f)
|
2010-02-12 12:16:34 +00:00
|
|
|
{
|
|
|
|
return vcs && vcs->prepareFileRevision(rev, f);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool LyXVC::prepareFileRevisionEnabled()
|
|
|
|
{
|
|
|
|
return vcs && vcs->prepareFileRevisionEnabled();
|
|
|
|
}
|
2008-07-21 01:55:58 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|