mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Slowly toward version control + comparison
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33443 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d5f77d6dc2
commit
c6f6d20cdb
@ -19,6 +19,7 @@
|
||||
#include "frontends/alert.h"
|
||||
#include "frontends/Application.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/debug.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/gettext.h"
|
||||
@ -981,6 +982,38 @@ void SVN::getLog(FileName const & tmpf)
|
||||
}
|
||||
|
||||
|
||||
bool SVN::prepareFileRevision(int rev, string & f)
|
||||
{
|
||||
if (rev <= 0)
|
||||
if (!getFileRevisionInfo())
|
||||
return false;
|
||||
if (rev == 0)
|
||||
rev = convert<int>(rev_file_cache_);
|
||||
// go back for minus rev
|
||||
else if (rev < 0) {
|
||||
rev = rev + convert<int>(rev_file_cache_);
|
||||
if (rev < 1)
|
||||
return false;
|
||||
}
|
||||
|
||||
FileName tmpf = FileName::tempName("lyxvcrev");
|
||||
if (tmpf.empty()) {
|
||||
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
|
||||
return N_("Error: Could not generate logfile.");
|
||||
}
|
||||
|
||||
doVCCommand("svn cat -r " + convert<string>(rev) + " "
|
||||
+ quoteName(onlyFilename(owner_->absFileName()))
|
||||
+ " > " + quoteName(tmpf.toFilesystemEncoding()),
|
||||
FileName(owner_->filePath()));
|
||||
if (tmpf.isFileEmpty())
|
||||
return false;
|
||||
|
||||
f = tmpf.absFilename();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool SVN::toggleReadOnlyEnabled()
|
||||
{
|
||||
return false;
|
||||
|
@ -275,6 +275,14 @@ protected:
|
||||
bool isLocked() const;
|
||||
/// acquire/release write lock for the current file
|
||||
void fileLock(bool lock, support::FileName const & tmpf, std::string & status);
|
||||
/**
|
||||
* Prepare revision rev of the file into newly created temporary file
|
||||
* and save the filename into parameter f.
|
||||
* Parameter rev can be either revision number or negative number
|
||||
* which is interpreted as how many revision back from the current
|
||||
* one do we want. rev=0 is reserved for the last (committed) revision.
|
||||
*/
|
||||
bool prepareFileRevision(int rev, std::string & f);
|
||||
|
||||
private:
|
||||
support::FileName file_;
|
||||
@ -287,7 +295,7 @@ private:
|
||||
* was already unsuccessful.
|
||||
*/
|
||||
bool getFileRevisionInfo();
|
||||
/// cache for file revision number, "?" if already unsuccessful
|
||||
/// cache for file revision number, "?" if already unsuccessful, isNumber==true
|
||||
std::string rev_file_cache_;
|
||||
/// cache for author of last commit
|
||||
std::string rev_author_cache_;
|
||||
|
Loading…
Reference in New Issue
Block a user