From 9fdbf7eff5a29a4a6e3161c2cc3ca75af71be0c9 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Tue, 22 Jul 2008 10:16:54 +0000 Subject: [PATCH] scanLog for checkout svn in VCS. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25795 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/VCBackend.cpp | 36 +++++++++++++++++++++++++++++++++++- src/VCBackend.h | 2 ++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index bacad51916..ff722f0d19 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -461,11 +461,45 @@ bool SVN::checkInEnabled() return true; } +// FIXME Correctly return code should be checked instead of this. +// This would need another solution than just plain startscript. +string SVN::scanLogFile(FileName const & f) +{ + ifstream ifs(f.toFilesystemEncoding().c_str()); + string line; + + while (ifs){ + getline(ifs,line); + lyxerr<absFileName())), + FileName tmpf = FileName::tempName("lyxvcout"); + if (tmpf.empty()){ + LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf); + return; + } + + doVCCommand("svn update " + quoteName(onlyFilename(owner_->absFileName())) + + " > " + tmpf.toFilesystemEncoding(), FileName(owner_->filePath())); + + string res = scanLogFile(tmpf); + if (!res.empty()) + frontend::Alert::error(_("Revision control error."), + bformat(_("Error when updating from repository.\n" + "You have to manually resolve the conflicts NOW!\n'%1$s'.\n\n" + "After pressing OK, LyX will try to reopen resolved document."), + from_ascii(res))); + tmpf.erase(); } diff --git a/src/VCBackend.h b/src/VCBackend.h index d44bb045f9..1b663e8b9b 100644 --- a/src/VCBackend.h +++ b/src/VCBackend.h @@ -221,6 +221,8 @@ public: protected: virtual void scanMaster(); + /// Check for error messages in svn output. + std::string scanLogFile(support::FileName const & f); private: support::FileName file_; -- 2.39.2