X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXVC.cpp;h=930680b33bd262373a3210c78f7b68a4a6e0df50;hb=0362c6aae73c293d1c20277c12d362acfe0b2ef6;hp=cb276fd9476328dce3be60a4c46a6f06c18ef762;hpb=f625dd7ea0770f0f1151401ed90d0ef2146595d7;p=lyx.git diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp index cb276fd947..930680b33b 100644 --- a/src/LyXVC.cpp +++ b/src/LyXVC.cpp @@ -17,28 +17,20 @@ #include "LyXVC.h" #include "VCBackend.h" -#include "debug.h" #include "Buffer.h" -#include "gettext.h" #include "frontends/alert.h" +#include "support/debug.h" #include "support/filetools.h" +#include "support/gettext.h" #include "support/lstrings.h" -#include "support/lyxlib.h" +using namespace std; +using namespace lyx::support; namespace lyx { -using support::bformat; -using support::FileName; -using support::makeAbsPath; -using support::tempName; - -using std::endl; -using std::string; -using std::pair; - namespace Alert = frontend::Alert; @@ -57,13 +49,13 @@ bool LyXVC::file_found_hook(FileName const & fn) { FileName found_file; // Check if file is under RCS - if (!(found_file = RCS::find_file(fn)).empty()) { + if (!(found_file = RCS::findFile(fn)).empty()) { vcs.reset(new RCS(found_file)); vcs->owner(owner_); return true; } // Check if file is under CVS - if (!(found_file = CVS::find_file(fn)).empty()) { + if (!(found_file = CVS::findFile(fn)).empty()) { vcs.reset(new CVS(found_file, fn)); vcs->owner(owner_); return true; @@ -76,9 +68,9 @@ bool LyXVC::file_found_hook(FileName const & fn) bool LyXVC::file_not_found_hook(FileName const & fn) { // Check if file is under RCS - if (!RCS::find_file(fn).empty()) + if (!RCS::findFile(fn).empty()) return true; - if (!CVS::find_file(fn).empty()) + if (!CVS::findFile(fn).empty()) return true; return false; } @@ -95,7 +87,7 @@ void LyXVC::registrer() FileName const filename = owner_->fileName(); // there must be a file to save - if (!filename.isFileReadable()) { + if (!filename.isReadableFile()) { Alert::error(_("Document not saved"), _("You must save the document " "before it can be registered.")); @@ -106,31 +98,27 @@ void LyXVC::registrer() if (!vcs) { FileName const cvs_entries(makeAbsPath("CVS/Entries")); - if (cvs_entries.isFileReadable()) { - LYXERR(Debug::LYXVC) - << "LyXVC: registering " - << to_utf8(filename.displayName()) - << " with CVS" << endl; + if (cvs_entries.isReadableFile()) { + LYXERR(Debug::LYXVC, "LyXVC: registering " + << to_utf8(filename.displayName()) << " with CVS"); vcs.reset(new CVS(cvs_entries, filename)); } else { - LYXERR(Debug::LYXVC) - << "LyXVC: registering " - << to_utf8(filename.displayName()) - << " with RCS" << endl; + LYXERR(Debug::LYXVC, "LyXVC: registering " + << to_utf8(filename.displayName()) << " with RCS"); vcs.reset(new RCS(filename)); } vcs->owner(owner_); } - LYXERR(Debug::LYXVC) << "LyXVC: registrer" << endl; + LYXERR(Debug::LYXVC, "LyXVC: registrer"); docstring response; bool ok = Alert::askForText(response, _("LyX VC: Initial description"), _("(no initial description)")); if (!ok || response.empty()) { // should we insist on checking response.empty()? - LYXERR(Debug::LYXVC) << "LyXVC: user cancelled" << endl; + LYXERR(Debug::LYXVC, "LyXVC: user cancelled"); return; } @@ -140,8 +128,7 @@ void LyXVC::registrer() void LyXVC::checkIn() { - - LYXERR(Debug::LYXVC) << "LyXVC: checkIn" << endl; + LYXERR(Debug::LYXVC, "LyXVC: checkIn"); docstring response; bool ok = Alert::askForText(response, _("LyX VC: Log Message")); if (ok) { @@ -149,22 +136,21 @@ void LyXVC::checkIn() response = _("(no log message)"); vcs->checkIn(to_utf8(response)); } else { - LYXERR(Debug::LYXVC) << "LyXVC: user cancelled" << endl; + LYXERR(Debug::LYXVC, "LyXVC: user cancelled"); } } void LyXVC::checkOut() { - LYXERR(Debug::LYXVC) << "LyXVC: checkOut" << endl; - + LYXERR(Debug::LYXVC, "LyXVC: checkOut"); vcs->checkOut(); } void LyXVC::revert() { - LYXERR(Debug::LYXVC) << "LyXVC: revert" << endl; + LYXERR(Debug::LYXVC, "LyXVC: revert"); docstring const file = owner_->fileName().displayName(20); docstring text = bformat(_("Reverting to the stored version of the " @@ -188,11 +174,11 @@ void LyXVC::toggleReadOnly() { switch (vcs->status()) { case VCS::UNLOCKED: - LYXERR(Debug::LYXVC) << "LyXVC: toggle to locked" << endl; + LYXERR(Debug::LYXVC, "LyXVC: toggle to locked"); checkOut(); break; case VCS::LOCKED: - LYXERR(Debug::LYXVC) << "LyXVC: toggle to unlocked" << endl; + LYXERR(Debug::LYXVC, "LyXVC: toggle to unlocked"); checkIn(); break; } @@ -230,13 +216,12 @@ string const LyXVC::getLogFile() const if (!vcs) return string(); - FileName const tmpf(tempName(FileName(), "lyxvclog")); + FileName const tmpf = FileName::tempName("lyxvclog"); if (tmpf.empty()) { - LYXERR(Debug::LYXVC) << "Could not generate logfile " - << tmpf << endl; + LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf); return string(); } - LYXERR(Debug::LYXVC) << "Generating logfile " << tmpf << endl; + LYXERR(Debug::LYXVC, "Generating logfile " << tmpf); vcs->getLog(tmpf); return tmpf.absFilename(); }