]> git.lyx.org Git - lyx.git/blobdiff - src/vc-backend.C
Fix working of the spellchecker dialog with ispell when there are no
[lyx.git] / src / vc-backend.C
index 7b042baf465ccd732ab44a0f4df186d713f0bd46..c745b38fb2c2ac2a80e9748c5fade3c1e6411ff3 100644 (file)
@@ -13,7 +13,9 @@
 #include "support/LSubstring.h"
 #include "support/path.h"
 #include "support/filetools.h"
+#include "support/lstrings.h"
 #include "buffer.h"
+#include "BufferView.h"
 #include "LyXView.h"
 #include "lyxfunc.h"
 
@@ -110,7 +112,9 @@ void RCS::scanMaster()
                                vcstatus = UNLOCKED;
                                continue;
                        }
-                       string tmpt, s1, s2;
+                       string tmpt;
+                       string s1;
+                       string s2;
                        do {
                                ifs >> tmpt;
                                s1 = strip(tmpt, ';');
@@ -134,7 +138,6 @@ void RCS::scanMaster()
                                << endl;
                }
        }
-       version_ = "RCS: " + version_;
 }
 
 
@@ -146,7 +149,7 @@ void RCS::registrer(string const & msg)
        cmd += OnlyFilename(owner_->fileName());
        cmd += "\"";
        doVCCommand(cmd, owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -154,7 +157,7 @@ void RCS::checkIn(string const & msg)
 {
        doVCCommand("ci -q -u -m\"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -163,7 +166,7 @@ void RCS::checkOut()
        owner_->markLyxClean();
        doVCCommand("co -q -l \""
                    + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -174,7 +177,7 @@ void RCS::revert()
        // We ignore changes and just reload!
        owner_->markLyxClean();
        owner_->getUser()->owner()
-               ->getLyXFunc()->Dispatch("buffer-reload");
+               ->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -182,7 +185,8 @@ void RCS::undoLast()
 {
        lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
        doVCCommand("rcs -o" + version() + " \""
-                   + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
+                   + OnlyFilename(owner_->fileName()) + "\"",
+                   owner_->filepath);
 }
 
 
@@ -242,8 +246,7 @@ void CVS::scanMaster()
                        LRegex::SubMatches const & sm = reg.exec(line);
                        //sm[0]; // whole matched string
                        //sm[1]; // filename
-                       version_ = "CVS: ";
-                       version_ += LSubstring(line, sm[2].first,
+                       version_ = LSubstring(line, sm[2].first,
                                              sm[2].second);
                        string file_date = LSubstring(line, sm[3].first,
                                                      sm[3].second);
@@ -275,15 +278,16 @@ void CVS::registrer(string const & msg)
 {
        doVCCommand("cvs -q add -m \"" + msg + "\" \""
                    + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
 void CVS::checkIn(string const & msg)
 {
        doVCCommand("cvs -q commit -m \"" + msg + "\" \""
-                   + OnlyFilename(owner_->fileName()) + "\"", owner_->filepath);
-       owner_->getUser()->owner()->getLyXFunc()->Dispatch("buffer-reload");
+                   + OnlyFilename(owner_->fileName()) + "\"",
+                   owner_->filepath);
+       owner_->getUser()->owner()->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -296,10 +300,15 @@ void CVS::checkOut()
 
 void CVS::revert()
 {
-       // not sure how to do this...
-       // rm file
-       // cvs update
-       lyxerr << "Sorry not implemented." << endl;
+       // Reverts to the version in CVS repository and
+       // gets the updated version from the repository.
+       string const fil = OnlyFilename(owner_->fileName());
+       
+       doVCCommand("rm -f \"" + fil + "\"; cvs update \"" + fil + "\"",
+                   owner_->filepath);
+       owner_->markLyxClean();
+       owner_->getUser()->owner()
+               ->getLyXFunc()->dispatch("buffer-reload");
 }
 
 
@@ -312,7 +321,9 @@ void CVS::undoLast()
 }
 
 
-void CVS::getLog(string const &)
+void CVS::getLog(string const & tmpf)
 {
-       lyxerr << "Sorry not implemented." << endl;
+       doVCCommand("cvs log \""
+                   + OnlyFilename(owner_->fileName()) + "\" > " + tmpf,
+                   owner_->filepath);
 }