]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
Improve how add_to_preamble and insert_to_preamble work, and audit the
[lyx.git] / src / VCBackend.cpp
index 208161bb24a928eed815748e483273d951c5b2ae..b3d5e97507fefb4639766b2ac4fcd8ebc57e9816 100644 (file)
@@ -195,6 +195,12 @@ bool RCS::checkInEnabled()
        return owner_ && !owner_->isReadonly();
 }
 
+bool RCS::isCheckInWithConfirmation()
+{
+       //FIXME diff
+       return true;
+}
+
 
 string RCS::checkOut()
 {
@@ -226,6 +232,9 @@ bool RCS::repoUpdateEnabled()
 
 string RCS::lockingToggle()
 {
+       //FIXME this might be actually possible, study rcs -U, rcs -L.
+       //State should be easy to get inside scanMaster.
+       //It would fix #4370 and make rcs/svn usage even more closer.
        lyxerr << "Sorry, not implemented." << endl;
        return string();
 }
@@ -247,6 +256,13 @@ void RCS::revert()
 }
 
 
+bool RCS::isRevertWithConfirmation()
+{
+       //FIXME owner && diff ?
+       return true;
+}
+
+
 void RCS::undoLast()
 {
        LYXERR(Debug::LYXVC, "LyXVC: undoLast");
@@ -430,7 +446,9 @@ string const CVS::getTarget(OperationMode opmode) const
 {
        switch(opmode) {
        case Directory:
-               return quoteName(owner_->filePath());
+               // in client server mode CVS does not like full path operand for directory operation
+               // since LyX switches to the repo dir "." is good enough as target
+               return ".";
        case File:
                return quoteName(onlyFileName(owner_->absFileName()));
        }
@@ -612,6 +630,13 @@ bool CVS::checkInEnabled()
 }
 
 
+bool CVS::isCheckInWithConfirmation()
+{
+       CvsStatus status = getStatus();
+       return status == LocallyModified || status == LocallyAdded;
+}
+
+
 string CVS::checkOut()
 {
        if (vcstatus != NOLOCKING && edit())
@@ -705,6 +730,13 @@ bool CVS::lockingToggleEnabled()
 }
 
 
+bool CVS::isRevertWithConfirmation()
+{
+       CvsStatus status = getStatus();
+       return !owner_->isClean() || status == LocallyModified || status == NeedsMerge;
+}
+
+
 void CVS::revert()
 {
        // Reverts to the version in CVS repository and
@@ -724,17 +756,22 @@ void CVS::revert()
                owner_->markClean();
                break;
        }
-       case LocallyAdded:
+       case LocallyAdded: {
+               docstring const file = owner_->fileName().displayName(20);
                frontend::Alert::error(_("Revision control error."),
-                       _("The current file is not in repository.\n"
-                         "You have to check in the first revision before you can revert.")) ;
+                       bformat(_("The document %1$s is not in repository.\n"
+                                 "You have to check in the first revision before you can revert."),
+                               file)) ;
                break;
-       default:
+       }
+       default: {
+               docstring const file = owner_->fileName().displayName(20);
                frontend::Alert::error(_("Revision control error."),
-                       bformat(_("Bad status when checking in changes.\n"
-                                         "\n'%1$s'\n\n"),
-                               toString(status)));
+                       bformat(_("Cannot revert document %1$s to repository version.\n"
+                                 "The status '%2$s' is unexpected."),
+                               file, toString(status)));
                break;
+               }
        }
 }
 
@@ -928,6 +965,13 @@ bool SVN::checkInEnabled()
 }
 
 
+bool SVN::isCheckInWithConfirmation()
+{
+       //FIXME diff
+       return true;
+}
+
+
 // FIXME Correctly return code should be checked instead of this.
 // This would need another solution than just plain startscript.
 // Hint from Andre': QProcess::readAllStandardError()...
@@ -1129,7 +1173,7 @@ bool SVN::lockingToggleEnabled()
 
 void SVN::revert()
 {
-       // Reverts to the version in CVS repository and
+       // Reverts to the version in SVN repository and
        // gets the updated version from the repository.
        string const fil = quoteName(onlyFileName(owner_->absFileName()));
 
@@ -1139,6 +1183,13 @@ void SVN::revert()
 }
 
 
+bool SVN::isRevertWithConfirmation()
+{
+       //FIXME owner && diff
+       return true;
+}
+
+
 void SVN::undoLast()
 {
        // merge the current with the previous version