FileName tmp(file.absFilename() + ",v");
LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under rcs: " << tmp);
if (tmp.isReadableFile()) {
- LYXERR(Debug::LYXVC, "Yes " << file << " is under rcs.");
+ LYXERR(Debug::LYXVC, "Yes, " << file << " is under rcs.");
return tmp;
}
tmp = FileName(addName(addPath(onlyPath(file.absFilename()), "RCS"), file.absFilename()) + ",v");
LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under rcs: " << tmp);
if (tmp.isReadableFile()) {
- LYXERR(Debug::LYXVC, "Yes " << file << " it is under rcs.");
+ LYXERR(Debug::LYXVC, "Yes, " << file << " is under rcs.");
return tmp;
}
return owner_ && owner_->isReadonly();
}
+string RCS::lockingToggle()
+{
+ lyxerr << "Sorry, not implemented." << endl;
+ return string();
+}
+
+
+bool RCS::lockingToggleEnabled()
+{
+ return false;
+}
+
void RCS::revert()
{
// cvs update or perhaps for cvs this should be a noop
// we need to detect conflict (eg "C" in output)
// before we can do this.
- lyxerr << "Sorry not implemented." << endl;
+ lyxerr << "Sorry, not implemented." << endl;
return string();
}
}
+string CVS::lockingToggle()
+{
+ lyxerr << "Sorry, not implemented." << endl;
+ return string();
+}
+
+
+bool CVS::lockingToggleEnabled()
+{
+ return false;
+}
+
+
void CVS::revert()
{
// Reverts to the version in CVS repository and
// merge the current with the previous version
// in a reverse patch kind of way, so that the
// result is to revert the last changes.
- lyxerr << "Sorry not implemented." << endl;
+ lyxerr << "Sorry, not implemented." << endl;
}
void SVN::scanMaster()
{
- // if we want some locking under svn
- // we need different infrastructure around
- locker_ = "Unlocked";
- vcstatus = UNLOCKED;
+ locker_.clear();
+ vcstatus = NOLOCKING;
+ if (checkLockMode()) {
+ if (isLocked()) {
+ locker_ = "Locked";
+ vcstatus = LOCKED;
+ } else {
+ locker_ = "Unlocked";
+ vcstatus = LOCKED;
+ }
+ }
}
}
-bool SVN::isLocked()
+bool SVN::isLocked() const
{
//refresh file info
FileName file(file_.absFilename());
string res = scanLogFile(tmpf, log);
if (!res.empty())
frontend::Alert::error(_("Revision control error."),
- _("Error when commiting to repository.\n"
+ _("Error when committing to repository.\n"
"You have to manually resolve the problem.\n"
"After pressing OK, LyX will reopen the document."));
else
ifs.close();
return line;
}
+ if (contains(line, "svn:needs-lock")) {
+ ifs.close();
+ return line;
+ }
}
ifs.close();
return string();
if (!isLocked() && lock)
frontend::Alert::error(_("Revision control error."),
_("Error when acquiring write lock.\n"
- "Most probably some other user edit the current document now!\n"
- "Check also the access to the repository."));
+ "Most probably another user is editing\n"
+ "the current document now!\n"
+ "Also check the access to the repository."));
if (isLocked() && !lock)
frontend::Alert::error(_("Revision control error."),
_("Error when releasing write lock.\n"
}
+string SVN::lockingToggle()
+{
+ FileName tmpf = FileName::tempName("lyxvcout");
+ if (tmpf.empty()) {
+ LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
+ return N_("Error: Could not generate logfile.");
+ }
+
+ int ret = doVCCommand("svn proplist " + quoteName(onlyFilename(owner_->absFileName()))
+ + " > " + quoteName(tmpf.toFilesystemEncoding()),
+ FileName(owner_->filePath()));
+ if (ret)
+ return string();
+
+ string log;
+ string res = scanLogFile(tmpf, log);
+ bool locking = contains(res, "svn:needs-lock");
+ if (!locking)
+ ret = doVCCommand("svn propset svn:needs-lock ON "
+ + quoteName(onlyFilename(owner_->absFileName()))
+ + " > " + quoteName(tmpf.toFilesystemEncoding()),
+ FileName(owner_->filePath()));
+ else
+ ret = doVCCommand("svn propdel svn:needs-lock "
+ + quoteName(onlyFilename(owner_->absFileName()))
+ + " > " + quoteName(tmpf.toFilesystemEncoding()),
+ FileName(owner_->filePath()));
+ if (ret)
+ return string();
+
+ tmpf.erase();
+ frontend::Alert::warning(_("VCN File Locking"),
+ (locking ? _("Locking property unset.") : _("Locking property set.")) + "\n"
+ + _("Do not forget to commit the locking property into the repository."),
+ true);
+
+ return string("SVN: ") + N_("Locking property set.");
+}
+
+
+bool SVN::lockingToggleEnabled()
+{
+ return true;
+}
+
void SVN::revert()
{
// Reverts to the version in CVS repository and
// merge the current with the previous version
// in a reverse patch kind of way, so that the
// result is to revert the last changes.
- lyxerr << "Sorry not implemented." << endl;
+ lyxerr << "Sorry, not implemented." << endl;
}