#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
+#include "support/TempFile.h"
using namespace std;
using namespace lyx::support;
}
-// for the sake of boost::scoped_ptr
-LyXVC::~LyXVC()
-{}
+docstring LyXVC::vcstatus() const
+{
+ if (!vcs)
+ return docstring();
+ if (locking())
+ return bformat(_("%1$s lock"), from_ascii(vcs->vcname()));
+ else
+ return from_ascii(vcs->vcname());
+}
bool LyXVC::fileInVC(FileName const & fn)
if (!vcs)
return string();
//RCS allows checkOut only in ReadOnly mode
- if (vcs->toggleReadOnlyEnabled() && !owner_->isReadonly())
+ if (vcs->toggleReadOnlyEnabled() && !owner_->hasReadonlyFlag())
return string();
LYXERR(Debug::LYXVC, "LyXVC: checkOut");
return log;
}
case VCS::NOLOCKING:
- break;
+ Buffer * b = vcs->owner();
+ bool const newstate = !b->hasReadonlyFlag();
+ string result = "LyXVC: toggle to ";
+ result += (newstate ? "readonly" : "readwrite");
+ LYXERR(Debug::LYXVC, result);
+ b->setReadonly(newstate);
+ return result;
}
return string();
}
if (!vcs)
return string();
- FileName const tmpf = FileName::tempName("lyxvclog");
+ TempFile tempfile("lyxvclog");
+ tempfile.setAutoRemove(false);
+ FileName const tmpf = tempfile.name();
if (tmpf.empty()) {
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
return string();
{
return vcs && vcs->repoUpdateEnabled();
}
-
-
+
+
bool LyXVC::prepareFileRevision(string const & rev, std::string & f)
{
return vcs && vcs->prepareFileRevision(rev, f);