X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FVCBackend.cpp;h=bf117d249462f3e94d3b4d8b0afae8da2f1afddf;hb=6891e077d05ea1cd5c95d35d95066b8b7fb3fa68;hp=c8afe18d3d5f6d2a1442a5c429f7f356da2f659f;hpb=1f1c3a3ea8f348ff2c1f4627127ba28e7603cc38;p=lyx.git diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index c8afe18d3d..bf117d2494 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -12,8 +12,11 @@ #include "VCBackend.h" #include "Buffer.h" +#include "LyXFunc.h" +#include "FuncRequest.h" #include "frontends/alert.h" +#include "frontends/Application.h" #include "support/debug.h" #include "support/filetools.h" @@ -41,7 +44,7 @@ int VCS::doVCCommandCall(string const & cmd, FileName const & path) LYXERR(Debug::LYXVC, "doVCCommandCall: " << cmd); Systemcall one; support::PathChanger p(path); - return one.startscript(Systemcall::Wait, cmd); + return one.startscript(Systemcall::Wait, cmd, false); } @@ -209,14 +212,14 @@ bool RCS::checkOutEnabled() } -string RCS::repoSynchro() +string RCS::repoUpdate() { lyxerr << "Sorry, not implemented." << endl; return string(); } -bool RCS::repoSynchroEnabled() +bool RCS::repoUpdateEnabled() { return false; } @@ -397,14 +400,14 @@ bool CVS::checkOutEnabled() } -string CVS::repoSynchro() +string CVS::repoUpdate() { lyxerr << "Sorry, not implemented." << endl; return string(); } -bool CVS::repoSynchroEnabled() +bool CVS::repoUpdateEnabled() { return false; } @@ -597,7 +600,7 @@ string SVN::checkIn(string const & msg) fileLock(false, tmpf, log); tmpf.erase(); - return "SVN: " + log; + return log.empty() ? string() : "SVN: " + log; } @@ -646,6 +649,7 @@ void SVN::fileLock(bool lock, FileName const & tmpf, string &status) + " > " + quoteName(tmpf.toFilesystemEncoding()), FileName(owner_->filePath())); + // Lock error messages go unfortunately on stderr and are unreachible this way. ifstream ifs(tmpf.toFilesystemEncoding().c_str()); string line; while (ifs) { @@ -691,7 +695,7 @@ string SVN::checkOut() fileLock(true, tmpf, log); tmpf.erase(); - return "SVN: " + log; + return log.empty() ? string() : "SVN: " + log; } @@ -704,7 +708,7 @@ bool SVN::checkOutEnabled() } -string SVN::repoSynchro() +string SVN::repoUpdate() { FileName tmpf = FileName::tempName("lyxvcout"); if (tmpf.empty()) { @@ -720,23 +724,30 @@ string SVN::repoSynchro() LYXERR(Debug::LYXVC, "Diff detected:\n" << res); docstring const file = from_utf8(owner_->filePath()); docstring text = bformat(_("There were detected changes " - "in the working directory.\n" - "Synchronizing with repository will discard " - "any uncommitted changes in the directory:\n%1$s" + "in the working directory:\n%1$s\n\n" + "In case of file conflict version of the local directory files " + "will be preferred." "\n\nContinue?"), file); - int const ret = frontend::Alert::prompt(_("Changes detected"), + int ret = frontend::Alert::prompt(_("Changes detected"), + text, 0, 1, _("&Yes"), _("&No"), _("View &Log ...")); + if (ret == 2 ) { + dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFilename())); + ret = frontend::Alert::prompt(_("Changes detected"), text, 0, 1, _("&Yes"), _("&No")); - if (ret) { + hideDialogs("file", 0); + } + if (ret == 1 ) { tmpf.erase(); return string(); } } - doVCCommand("svn revert -R " + quoteName(owner_->filePath()) - + " > " + quoteName(tmpf.toFilesystemEncoding()), - FileName(owner_->filePath())); - res = "Revert log:\n" + tmpf.fileContents("UTF-8"); - doVCCommand("svn update " + quoteName(owner_->filePath()) + // Reverting looks too harsh, see bug #6255. + // doVCCommand("svn revert -R " + quoteName(owner_->filePath()) + // + " > " + quoteName(tmpf.toFilesystemEncoding()), + // FileName(owner_->filePath())); + // res = "Revert log:\n" + tmpf.fileContents("UTF-8"); + doVCCommand("svn update --accept mine-full " + quoteName(owner_->filePath()) + " > " + quoteName(tmpf.toFilesystemEncoding()), FileName(owner_->filePath())); res += "Update log:\n" + tmpf.fileContents("UTF-8"); @@ -747,7 +758,7 @@ string SVN::repoSynchro() } -bool SVN::repoSynchroEnabled() +bool SVN::repoUpdateEnabled() { return true; }