X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FVCBackend.cpp;h=bee398cc4eb6dc4cd866b3cb7c7c5f1bd74e38b2;hb=4ea841fe24ec0f171577b3125425b74afdd0f28a;hp=edbf096e75ef6e1401114fac7f5360d2d1c63b68;hpb=95e7abadc0e3c8c250c25b0c5f27575644b94ca7;p=lyx.git diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index edbf096e75..bee398cc4e 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -13,7 +13,6 @@ #include "VCBackend.h" #include "Buffer.h" -#include "DispatchResult.h" #include "LyX.h" #include "FuncRequest.h" @@ -392,7 +391,7 @@ void RCS::undoLast() bool RCS::undoLastEnabled() { - return true; + return owner_->hasReadonlyFlag(); } @@ -734,12 +733,14 @@ void CVS::getRevisionInfo() LYXERR(Debug::LYXVC, line << '\n'); if (prefixIs(line, "date:")) { smatch sm; - regex_match(line, sm, reg); - //sm[0]; // whole matched string - rev_date_cache_ = sm[1]; - rev_time_cache_ = sm[2]; - //sm[3]; // GMT offset - rev_author_cache_ = sm[4]; + if (regex_match(line, sm, reg)) { + //sm[0]; // whole matched string + rev_date_cache_ = sm[1]; + rev_time_cache_ = sm[2]; + //sm[3]; // GMT offset + rev_author_cache_ = sm[4]; + } else + LYXERR(Debug::LYXVC, "\tCannot parse line. Skipping."); break; } } @@ -969,7 +970,7 @@ string CVS::repoUpdate() dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName())); ret = frontend::Alert::prompt(_("Changes detected"), text, 0, 1, _("&Continue"), _("&Abort")); - hideDialogs("file", 0); + hideDialogs("file", nullptr); } if (ret == 1) return string(); @@ -1154,7 +1155,7 @@ SVN::SVN(FileName const & m, Buffer * b) : VCS(b) // Here we know that the buffer file is either already in SVN or // about to be registered master_ = m; - locked_mode_ = 0; + locked_mode_ = false; scanMaster(); } @@ -1530,7 +1531,7 @@ string SVN::repoUpdate() dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName())); ret = frontend::Alert::prompt(_("Changes detected"), text, 0, 1, _("&Yes"), _("&No")); - hideDialogs("file", 0); + hideDialogs("file", nullptr); } if (ret == 1) return string(); @@ -2123,14 +2124,20 @@ string GIT::revisionInfo(LyXVC::RevisionInfo const info) // fill the rest of the attributes for a single file if (rev_file_cache_.empty()) - if (!getFileRevisionInfo()) + if (!getFileRevisionInfo()) { rev_file_cache_ = "?"; + rev_file_abbrev_cache_ = "?"; + } switch (info) { case LyXVC::File: if (rev_file_cache_ == "?") return string(); return rev_file_cache_; + case LyXVC::FileAbbrev: + if (rev_file_abbrev_cache_ == "?") + return string(); + return rev_file_abbrev_cache_; case LyXVC::Author: return rev_author_cache_; case LyXVC::Date: @@ -2154,7 +2161,7 @@ bool GIT::getFileRevisionInfo() return false; } - doVCCommand("git log -n 1 --pretty=format:%H%n%an%n%ai " + quoteName(onlyFileName(owner_->absFileName())) + doVCCommand("git log -n 1 --pretty=format:%H%n%h%n%an%n%ai " + quoteName(onlyFileName(owner_->absFileName())) + " > " + quoteName(tmpf.toFilesystemEncoding()), FileName(owner_->filePath())); @@ -2165,6 +2172,8 @@ bool GIT::getFileRevisionInfo() if (ifs) getline(ifs, rev_file_cache_); + if (ifs) + getline(ifs, rev_file_abbrev_cache_); if (ifs) getline(ifs, rev_author_cache_); if (ifs) { @@ -2188,7 +2197,8 @@ bool GIT::getTreeRevisionInfo() } doVCCommand("git describe --abbrev --dirty --long > " + quoteName(tmpf.toFilesystemEncoding()), - FileName(owner_->filePath())); + FileName(owner_->filePath()), + false); //git describe returns $?=128 when no tag found (but git repo still exists) if (tmpf.empty()) return false;