commit 05551a7cfba74d39d27aa6544226fe48d6c9e4dc
Author: Richard Kimberly Heck <[email protected]>
Date: Fri Dec 18 16:23:31 2020 -0500
Remove unused return values and useless member assignment.
The master_ variable holds a FileName that points to the meta-data
for this file, e.g., CVS/Entries. There is no such thing in SVN or GIT.
So we remove that variable from those classes.
---
src/LyXVC.cpp | 20 ++++++++++----------
src/VCBackend.cpp | 20 +++++++++-----------
src/VCBackend.h | 26 +++++++++++++++-----------
3 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index 8d0255f..1e6cb12 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -58,9 +58,9 @@ bool LyXVC::fileInVC(FileName const & fn)
return true;
if (!CVS::findFile(fn).empty())
return true;
- if (!SVN::findFile(fn).empty())
+ if (SVN::findFile(fn))
return true;
- if (!GIT::findFile(fn).empty())
+ if (GIT::findFile(fn))
return true;
return false;
}
@@ -80,13 +80,13 @@ bool LyXVC::file_found_hook(FileName const & fn)
return true;
}
// Check if file is under SVN
- if (!(found_file = SVN::findFile(fn)).empty()) {
- vcs_.reset(new SVN(found_file, owner_));
+ if (SVN::findFile(fn)) {
+ vcs_.reset(new SVN(owner_));
return true;
}
// Check if file is under GIT
- if (!(found_file = GIT::findFile(fn)).empty()) {
- vcs_.reset(new GIT(found_file, owner_));
+ if (GIT::findFile(fn)) {
+ vcs_.reset(new GIT(owner_));
return true;
}
@@ -104,8 +104,8 @@ bool LyXVC::file_not_found_hook(FileName const & fn)
// checked out.
bool foundRCS = !RCS::findFile(fn).empty();
bool foundCVS = foundRCS ? false : !CVS::findFile(fn).empty();
- bool foundSVN = (foundRCS || foundCVS) ? false :
!SVN::findFile(fn).empty();
- bool foundGIT = (foundRCS || foundCVS || foundSVN) ? false :
!GIT::findFile(fn).empty();
+ bool foundSVN = (foundRCS || foundCVS) ? false : SVN::findFile(fn);
+ bool foundGIT = (foundRCS || foundCVS || foundSVN) ? false :
GIT::findFile(fn);
if (foundRCS || foundCVS || foundSVN || foundGIT) {
docstring const file = makeDisplayPath(fn.absFileName(), 20);
docstring const text =
@@ -159,14 +159,14 @@ bool LyXVC::registrer()
if (!found.empty()) {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << " with
GIT");
- vcs_.reset(new GIT(found, owner_));
+ vcs_.reset(new GIT(owner_));
} else {
found = VCS::checkParentDirs(filename, ".svn/entries");
if (!found.empty()) {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << "
with SVN");
- vcs_.reset(new SVN(found, owner_));
+ vcs_.reset(new SVN(owner_));
} else {
// We only need to check the current directory,
since CVS meta-data
diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index d242a21..f8c2497 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -1157,22 +1157,21 @@ bool CVS::prepareFileRevisionEnabled()
//
/////////////////////////////////////////////////////////////////////
-SVN::SVN(FileName const & m, Buffer * b) : VCS(b)
+SVN::SVN(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_ = false;
scanMaster();
}
-FileName const SVN::findFile(FileName const & file)
+bool SVN::findFile(FileName const & file)
{
// First we check the existence of repository meta data.
if (VCS::checkParentDirs(file, ".svn").empty()) {
LYXERR(Debug::LYXVC, "Cannot find SVN meta data for " << file);
- return FileName();
+ return false;
}
// Now we check the status of the file.
@@ -1181,7 +1180,7 @@ FileName const SVN::findFile(FileName const & file)
bool found = 0 == doVCCommandCall("svn info " + quoteName(fname),
file.onlyPath());
LYXERR(Debug::LYXVC, "SVN control: " << (found ? "enabled" :
"disabled"));
- return found ? file : FileName();
+ return found;
}
@@ -1822,21 +1821,20 @@ bool SVN::toggleReadOnlyEnabled()
//
/////////////////////////////////////////////////////////////////////
-GIT::GIT(FileName const & m, Buffer * b) : VCS(b)
+GIT::GIT(Buffer * b) : VCS(b)
{
// Here we know that the buffer file is either already in GIT or
// about to be registered
- master_ = m;
scanMaster();
}
-FileName const GIT::findFile(FileName const & file)
+bool GIT::findFile(FileName const & file)
{
// First we check the existence of repository meta data.
if (VCS::checkParentDirs(file, ".git").empty()) {
LYXERR(Debug::LYXVC, "Cannot find GIT meta data for " << file);
- return FileName();
+ return false;
}
// Now we check the status of the file.
@@ -1844,7 +1842,7 @@ FileName const GIT::findFile(FileName const & file)
FileName tmpf = tempfile.name();
if (tmpf.empty()) {
LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
- return FileName();
+ return false;
}
string const fname = onlyFileName(file.absFileName());
@@ -1857,7 +1855,7 @@ FileName const GIT::findFile(FileName const & file)
tmpf.refresh();
bool found = !tmpf.isFileEmpty();
LYXERR(Debug::LYXVC, "GIT control: " << (found ? "enabled" :
"disabled"));
- return found ? file : FileName();
+ return found;
}
diff --git a/src/VCBackend.h b/src/VCBackend.h
index b3f4e14..ed4201a 100644
--- a/src/VCBackend.h
+++ b/src/VCBackend.h
@@ -131,12 +131,6 @@ protected:
*/
static int doVCCommandCall(std::string const & cmd, support::FileName
const & path);
- /**
- * The master VC file. For RCS this is *,v or RCS/ *,v. master should
- * have full path.
- */
- support::FileName master_;
-
/// The status of the VC controlled file.
VCStatus vcstatus_;
@@ -217,6 +211,12 @@ protected:
private:
bool getRevisionInfo();
/**
+ * The master VC file. For RCS this is *,v or RCS/ *,v.
+ * master should have full path.
+ */
+ support::FileName master_;
+
+ /**
* The version of the VC file. I am not sure if this can be a
* string or if it must be a float/int.
*/
@@ -322,6 +322,11 @@ protected:
};
private:
+ /**
+ * The master VC file. For CVS this is CVS/Entries
+ * master should have full path.
+ */
+ support::FileName master_;
// revision number from scanMaster
std::string version_;
@@ -379,11 +384,10 @@ class SVN : public VCS {
public:
///
explicit
- SVN(support::FileName const & m, Buffer * b);
+ SVN(Buffer * b);
/// Determine whether the file is under SVN control
- /// \return the file itself if so, else empty
- static support::FileName const findFile(support::FileName const & file);
+ static bool findFile(support::FileName const & file);
/// get file from repo, the caller must ensure that it does not exist
locally
static bool retrieve(support::FileName const & file);
@@ -490,11 +494,11 @@ class GIT : public VCS {
public:
///
explicit
- GIT(support::FileName const & m, Buffer * b);
+ GIT(Buffer * b);
/// Determine whether the file is under GIT control
/// \return the file itself if so, else empty
- static support::FileName const findFile(support::FileName const & file);
+ static bool findFile(support::FileName const & file);
/// get file from repo, the caller must ensure that it does not exist
locally
static bool retrieve(support::FileName const & file);
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs