]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / VCBackend.cpp
index 19dbb9638547653fadbf4b15c0a0bebb7efcdb89..5d8e33d4eaeb0951c70c6e357e22e80456729b6f 100644 (file)
 
 #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);
 }
 
 
@@ -270,7 +273,11 @@ void RCS::getLog(FileName const & tmpf)
 
 bool RCS::toggleReadOnlyEnabled()
 {
-       return true;
+       // This got broken somewhere along lfuns dispatch reorganization.
+       // reloadBuffer would be needed after this, but thats problematic
+       // since we are inside Buffer::dispatch.
+       // return true;
+       return false;
 }
 
 
@@ -513,6 +520,8 @@ FileName const SVN::findFile(FileName const & file)
 void SVN::scanMaster()
 {
        locker_.clear();
+       // vcstatus code is somewhat superflous, until we want
+       // to implement read-only toggle for svn.
        vcstatus = NOLOCKING;
        if (checkLockMode()) {
                if (isLocked()) {
@@ -520,7 +529,7 @@ void SVN::scanMaster()
                        vcstatus = LOCKED;
                } else {
                        locker_ = "Unlocked";
-                       vcstatus = LOCKED;
+                       vcstatus = UNLOCKED;
                }
        }
 }
@@ -560,9 +569,8 @@ bool SVN::checkLockMode()
 
 bool SVN::isLocked() const
 {
-       //refresh file info
-       FileName file(file_.absFilename());
-       return !file.isReadOnly();
+       file_.refresh();
+       return !file_.isReadOnly();
 }
 
 
@@ -597,7 +605,7 @@ string SVN::checkIn(string const & msg)
                fileLock(false, tmpf, log);
 
        tmpf.erase();
-       return "SVN: " + log;
+       return log.empty() ? string() : "SVN: " + log;
 }
 
 
@@ -641,11 +649,12 @@ void SVN::fileLock(bool lock, FileName const & tmpf, string &status)
        if (!locked_mode_ || (isLocked() == lock))
                return;
 
-       string arg = lock ? "lock " : "unlock ";
+       string const arg = lock ? "lock " : "unlock ";
        doVCCommand("svn "+ arg + quoteName(onlyFilename(owner_->absFileName()))
                    + " > " + 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) {
@@ -685,13 +694,13 @@ string SVN::checkOut()
                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."),
+                               "After pressing OK, LyX will try to reopen the resolved document."),
                        from_local8bit(res)));
 
        fileLock(true, tmpf, log);
 
        tmpf.erase();
-       return "SVN: " + log;
+       return log.empty() ? string() : "SVN: " + log;
 }
 
 
@@ -724,9 +733,15 @@ string SVN::repoUpdate()
                                "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();
                }