LYXERR(Debug::LYXVC, "doVCCommandCall: " << cmd);
Systemcall one;
support::PathChanger p(path);
- return one.startscript(Systemcall::Wait, cmd, false);
+ return one.startscript(Systemcall::Wait, cmd, string(), false);
}
return false;
}
+
string RCS::revisionInfo(LyXVC::RevisionInfo const info)
{
if (info == LyXVC::File)
return version_;
+ // fill the rest of the attributes for a single file
+ if (rev_date_cache_.empty())
+ if (!getRevisionInfo())
+ return string();
+
+ switch (info) {
+ case LyXVC::Author:
+ return rev_author_cache_;
+ case LyXVC::Date:
+ return rev_date_cache_;
+ case LyXVC::Time:
+ return rev_time_cache_;
+ default: ;
+ }
+
return string();
}
+bool RCS::getRevisionInfo()
+{
+ FileName tmpf = FileName::tempName("lyxvcout");
+ if (tmpf.empty()) {
+ LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
+ return false;
+ }
+ doVCCommand("rlog -r " + quoteName(onlyFileName(owner_->absFileName()))
+ + " > " + quoteName(tmpf.toFilesystemEncoding()),
+ FileName(owner_->filePath()));
+
+ if (tmpf.empty())
+ return false;
+
+ ifstream ifs(tmpf.toFilesystemEncoding().c_str());
+ string line;
+
+ // we reached to the entry, i.e. after initial log message
+ bool entry=false;
+ // line with critical info, e.g:
+ //"date: 2011/07/02 11:02:54; author: sanda; state: Exp; lines: +17 -2"
+ string result;
+
+ while (ifs) {
+ getline(ifs, line);
+ LYXERR(Debug::LYXVC, line);
+ if (entry && prefixIs(line, "date:")) {
+ result = line;
+ break;
+ }
+ if (prefixIs(line, "revision"))
+ entry = true;
+ }
+ if (result.empty())
+ return false;
+
+ rev_date_cache_ = token(result, ' ', 1);
+ rev_time_cache_ = rtrim(token(result, ' ', 2), ";");
+ rev_author_cache_ = trim(token(token(result, ';', 1), ':', 1));
+
+ return !rev_author_cache_.empty();
+}
+
bool RCS::prepareFileRevision(string const &revis, string & f)
{
string rev = revis;
FileName tmpf = FileName::tempName("lyxvcrev_" + rev + "_");
if (tmpf.empty()) {
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
- return N_("Error: Could not generate logfile.");
+ return false;
}
doVCCommand("co -p" + rev + " "
FileName tmpf = FileName::tempName("lyxvcout");
if (tmpf.empty()){
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
- return N_("Error: Could not generate logfile.");
+ return false;
}
LYXERR(Debug::LYXVC, "Detecting locking mode...");
FileName tmpf = FileName::tempName("lyxvcout");
if (tmpf.empty()) {
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
- return N_("Error: Could not generate logfile.");
+ return false;
}
doVCCommand("svn info --xml " + quoteName(onlyFileName(owner_->absFileName()))
FileName tmpf = FileName::tempName("lyxvcout");
if (tmpf.empty()) {
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
- return N_("Error: Could not generate logfile.");
+ return false;
}
doVCCommand("svnversion -n . > " + quoteName(tmpf.toFilesystemEncoding()),