#include "frontends/alert.h"
#include "frontends/Application.h"
+#include "support/convert.h"
#include "support/debug.h"
#include "support/filetools.h"
#include "support/gettext.h"
}
+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;
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_;
* 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_;