mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Backport missing implementation of revision info for RCS
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39238 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3c5d2d063f
commit
6df25e08c2
@ -19434,7 +19434,13 @@ Revision info
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Standard
|
\begin_layout Standard
|
||||||
LyX supports RCS version number information (only), see
|
LyX supports RCS version number, author name, date and time of last commit.
|
||||||
|
All those are extracted from
|
||||||
|
\family typewriter
|
||||||
|
rlog -r <file-name>
|
||||||
|
\family default
|
||||||
|
.
|
||||||
|
For other details see
|
||||||
\begin_inset CommandInset ref
|
\begin_inset CommandInset ref
|
||||||
LatexCommand ref
|
LatexCommand ref
|
||||||
reference "sub:VCS-Revision-Information"
|
reference "sub:VCS-Revision-Information"
|
||||||
|
@ -352,14 +352,73 @@ bool RCS::toggleReadOnlyEnabled()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string RCS::revisionInfo(LyXVC::RevisionInfo const info)
|
string RCS::revisionInfo(LyXVC::RevisionInfo const info)
|
||||||
{
|
{
|
||||||
if (info == LyXVC::File)
|
if (info == LyXVC::File)
|
||||||
return version_;
|
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();
|
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)
|
bool RCS::prepareFileRevision(string const &revis, string & f)
|
||||||
{
|
{
|
||||||
string rev = revis;
|
string rev = revis;
|
||||||
|
@ -176,6 +176,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void scanMaster();
|
virtual void scanMaster();
|
||||||
private:
|
private:
|
||||||
|
bool getRevisionInfo();
|
||||||
/**
|
/**
|
||||||
* The version of the VC file. I am not sure if this can be a
|
* The version of the VC file. I am not sure if this can be a
|
||||||
* string or if it must be a float/int.
|
* string or if it must be a float/int.
|
||||||
@ -183,6 +184,12 @@ private:
|
|||||||
std::string version_;
|
std::string version_;
|
||||||
/// The user currently keeping the lock on the VC file (or "Unlocked").
|
/// The user currently keeping the lock on the VC file (or "Unlocked").
|
||||||
std::string locker_;
|
std::string locker_;
|
||||||
|
/// Cache for revision info.
|
||||||
|
std::string rev_date_cache_;
|
||||||
|
///
|
||||||
|
std::string rev_time_cache_;
|
||||||
|
///
|
||||||
|
std::string rev_author_cache_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,6 +142,9 @@ What's new
|
|||||||
|
|
||||||
- Fix LaTeX export when the file encoding changes after a float (bug 7645).
|
- Fix LaTeX export when the file encoding changes after a float (bug 7645).
|
||||||
|
|
||||||
|
- Fix missing VCS revision information for RCS (author/date/time).
|
||||||
|
|
||||||
|
|
||||||
* USER INTERFACE
|
* USER INTERFACE
|
||||||
|
|
||||||
- Fixed crash relating to outliner and mouse movement.
|
- Fixed crash relating to outliner and mouse movement.
|
||||||
|
Loading…
Reference in New Issue
Block a user