[LyX/master] Use right style for private member

2020-12-18 Thread Richard Kimberly Heck
commit 81be2e8a9b7f4a99cdc15afa457c1fa06e81fbb0
Author: Richard Kimberly Heck 
Date:   Thu Dec 17 16:56:50 2020 -0500

Use right style for private member
---
 src/LyXVC.cpp |  114 
 src/LyXVC.h   |2 +-
 2 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index 7e36a1c..fa4d4c8 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -43,12 +43,12 @@ LyXVC::LyXVC()
 
 docstring LyXVC::vcstatus() const
 {
-   if (!vcs)
+   if (!vcs_)
return docstring();
if (locking())
-   return bformat(_("%1$s lock"), from_ascii(vcs->vcname()));
+   return bformat(_("%1$s lock"), from_ascii(vcs_->vcname()));
else
-   return from_ascii(vcs->vcname());
+   return from_ascii(vcs_->vcname());
 }
 
 
@@ -71,27 +71,27 @@ bool LyXVC::file_found_hook(FileName const & fn)
FileName found_file;
// Check if file is under RCS
if (!(found_file = RCS::findFile(fn)).empty()) {
-   vcs.reset(new RCS(found_file, owner_));
+   vcs_.reset(new RCS(found_file, owner_));
return true;
}
// Check if file is under CVS
if (!(found_file = CVS::findFile(fn)).empty()) {
-   vcs.reset(new CVS(found_file, owner_));
+   vcs_.reset(new CVS(found_file, owner_));
return true;
}
// Check if file is under SVN
if (!(found_file = SVN::findFile(fn)).empty()) {
-   vcs.reset(new SVN(found_file, owner_));
+   vcs_.reset(new SVN(found_file, owner_));
return true;
}
// Check if file is under GIT
if (!(found_file = GIT::findFile(fn)).empty()) {
-   vcs.reset(new GIT(found_file, owner_));
+   vcs_.reset(new GIT(found_file, owner_));
return true;
}
 
// file is not under any VCS.
-   vcs.reset(nullptr);
+   vcs_.reset(nullptr);
return false;
 }
 
@@ -152,7 +152,7 @@ bool LyXVC::registrer()
}
 
// it is very likely here that the vcs is not created yet...
-   if (!vcs) {
+   if (!vcs_) {
//check in the root directory of the document
FileName const cvs_entries(onlyPath(filename.absFileName()) + 
"/CVS/Entries");
FileName const svn_entries(onlyPath(filename.absFileName()) + 
"/.svn/entries");
@@ -161,22 +161,22 @@ bool LyXVC::registrer()
if (git_index.isReadableFile()) {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << " with 
GIT");
-   vcs.reset(new GIT(git_index, owner_));
+   vcs_.reset(new GIT(git_index, owner_));
 
} else if (svn_entries.isReadableFile()) {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << " with 
SVN");
-   vcs.reset(new SVN(svn_entries, owner_));
+   vcs_.reset(new SVN(svn_entries, owner_));
 
} else if (cvs_entries.isReadableFile()) {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << " with 
CVS");
-   vcs.reset(new CVS(cvs_entries, owner_));
+   vcs_.reset(new CVS(cvs_entries, owner_));
 
} else {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << " with 
RCS");
-   vcs.reset(new RCS(FileName(), owner_));
+   vcs_.reset(new RCS(FileName(), owner_));
}
}
 
@@ -186,12 +186,12 @@ bool LyXVC::registrer()
_("(no initial description)"));
if (!ok) {
LYXERR(Debug::LYXVC, "LyXVC: user cancelled");
-   vcs.reset(nullptr);
+   vcs_.reset(nullptr);
return false;
}
if (response.empty())
response = _("(no initial description)");
-   vcs->registrer(to_utf8(response));
+   vcs_->registrer(to_utf8(response));
return true;
 }
 
@@ -199,7 +199,7 @@ bool LyXVC::registrer()
 string LyXVC::rename(FileName const & fn)
 {
LYXERR(Debug::LYXVC, "LyXVC: rename");
-   if (!vcs || fileInVC(fn))
+   if (!vcs_ || fileInVC(fn))
return string();
docstring response;
bool ok = Alert::askForText(response, _("LyX VC: Log message"),
@@ -210,7 +210,7 @@ string LyXVC::rename(FileName const & fn)
}
if (response.empty())
response = _("(no log message)");
-   string ret = vcs->rename(fn, to_utf8(response));
+   string ret = vcs_->rename(fn, to_utf8(

[LyX/master] Const

2020-12-18 Thread Richard Kimberly Heck
commit 73e7cfb26ac0a1483f8cfa0e114d851d27ac9552
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 14:55:58 2020 -0500

Const
---
 src/VCBackend.cpp |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index c7ef6e6..feab330 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -565,8 +565,8 @@ void CVS::scanMaster()
LYXERR(Debug::LYXVC, "LyXVC::CVS: scanMaster. \n Checking: " << 
master_);
// Ok now we do the real scan...
ifstream ifs(master_.toFilesystemEncoding().c_str());
-   string name = onlyFileName(owner_->absFileName());
-   string tmpf = '/' + name + '/';
+   string const name = onlyFileName(owner_->absFileName());
+   string const tmpf = '/' + name + '/';
LYXERR(Debug::LYXVC, "\tlooking for `" << tmpf << '\'');
string line;
static regex const reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
@@ -589,8 +589,8 @@ void CVS::scanMaster()
//sm[5]; // tag or tagdate
FileName file(owner_->absFileName());
if (file.isReadableFile()) {
-   time_t mod = file.lastModified();
-   string mod_date = rtrim(asctime(gmtime(&mod)), 
"\n");
+   time_t const mod = file.lastModified();
+   string const mod_date = 
rtrim(asctime(gmtime(&mod)), "\n");
LYXERR(Debug::LYXVC, "Date in Entries: `" << 
file_date
<< "'\nModification date of file: `" << 
mod_date << '\'');
if (file.isReadOnly()) {
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Style

2020-12-18 Thread Richard Kimberly Heck
commit bd306ae11810fec81d5b4925f62baf6fd7f3e5c8
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 14:37:58 2020 -0500

Style
---
 src/VCBackend.cpp |6 +++---
 src/VCBackend.h   |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 8f23927..13a8265 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -105,7 +105,7 @@ bool VCS::makeRCSRevision(string const &version, string 
&revis) const
 }
 
 
-bool VCS::checkparentdirs(FileName const & file, std::string const & vcsdir)
+bool VCS::checkParentDirs(FileName const & file, std::string const & vcsdir)
 {
FileName dirname = file.onlyPath();
do {
@@ -1167,7 +1167,7 @@ SVN::SVN(FileName const & m, Buffer * b) : VCS(b)
 FileName const SVN::findFile(FileName const & file)
 {
// First we check the existence of repository meta data.
-   if (!VCS::checkparentdirs(file, ".svn")) {
+   if (!VCS::checkParentDirs(file, ".svn")) {
LYXERR(Debug::LYXVC, "Cannot find SVN meta data for " << file);
return FileName();
}
@@ -1839,7 +1839,7 @@ GIT::GIT(FileName const & m, Buffer * b) : VCS(b)
 FileName const GIT::findFile(FileName const & file)
 {
// First we check the existence of repository meta data.
-   if (!VCS::checkparentdirs(file, ".git")) {
+   if (!VCS::checkParentDirs(file, ".git")) {
LYXERR(Debug::LYXVC, "Cannot find GIT meta data for " << file);
return FileName();
}
diff --git a/src/VCBackend.h b/src/VCBackend.h
index 6d4743b..07192d9 100644
--- a/src/VCBackend.h
+++ b/src/VCBackend.h
@@ -105,7 +105,7 @@ public:
 
/// Check the directory of file and all parent directories
/// for the existence of repository-info like .git or .svn
-   static bool checkparentdirs(support::FileName const & file, std::string 
const & vcsdir);
+   static bool checkParentDirs(support::FileName const & file, std::string 
const & vcsdir);
 
 protected:
/// parse information from the version file
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Remove unused file output

2020-12-18 Thread Richard Kimberly Heck
commit 68e60f95d3ec3e1b80da986c120293e97151ddad
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 14:51:56 2020 -0500

Remove unused file output
---
 src/VCBackend.cpp |   10 +-
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 93b55e4..c7ef6e6 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -1175,17 +1175,9 @@ FileName const SVN::findFile(FileName const & file)
}
 
// Now we check the status of the file.
-   TempFile tempfile("lyxvcout");
-   FileName tmpf = tempfile.name();
-   if (tmpf.empty()) {
-   LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
-   return FileName();
-   }
-
string const fname = onlyFileName(file.absFileName());
LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under svn control for 
`" << fname << '\'');
-   bool found = 0 == doVCCommandCall("svn info " + quoteName(fname)
-   + " > " + 
quoteName(tmpf.toFilesystemEncoding()),
+   bool found = 0 == doVCCommandCall("svn info " + quoteName(fname),
file.onlyPath());
LYXERR(Debug::LYXVC, "SVN control: " << (found ? "enabled" : 
"disabled"));
return found ? file : FileName();
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Style

2020-12-18 Thread Richard Kimberly Heck
commit 2405788d84718f19be47ff8c03f93ef316a900f5
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 14:56:18 2020 -0500

Style
---
 src/VCBackend.cpp |   32 
 src/VCBackend.h   |6 +++---
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index feab330..26ac809 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -201,7 +201,7 @@ void RCS::scanMaster()
// get locker here
if (contains(token, ';')) {
locker_ = "Unlocked";
-   vcstatus = UNLOCKED;
+   vcstatus_ = UNLOCKED;
continue;
}
string tmpt;
@@ -215,7 +215,7 @@ void RCS::scanMaster()
// s2 is user, and s1 is version
if (s1 == version_) {
locker_ = s2;
-   vcstatus = LOCKED;
+   vcstatus_ = LOCKED;
break;
}
} while (!contains(tmpt, ';'));
@@ -595,15 +595,15 @@ void CVS::scanMaster()
<< "'\nModification date of file: `" << 
mod_date << '\'');
if (file.isReadOnly()) {
// readonly checkout is unlocked
-   vcstatus = UNLOCKED;
+   vcstatus_ = UNLOCKED;
} else {
FileName 
bdir(addPath(master_.onlyPath().absFileName(),"Base"));
FileName 
base(addName(bdir.absFileName(),name));
// if base version is existent "cvs 
edit" was used to lock
-   vcstatus = base.isReadableFile() ? 
LOCKED : NOLOCKING;
+   vcstatus_ = base.isReadableFile() ? 
LOCKED : NOLOCKING;
}
} else {
-   vcstatus = NOLOCKING;
+   vcstatus_ = NOLOCKING;
}
break;
}
@@ -813,7 +813,7 @@ void CVS::getDiff(OperationMode opmode, FileName const & 
tmpf)
 
 int CVS::edit()
 {
-   vcstatus = LOCKED;
+   vcstatus_ = LOCKED;
return doVCCommand("cvs -q edit " + getTarget(File),
FileName(owner_->filePath()));
 }
@@ -821,7 +821,7 @@ int CVS::edit()
 
 int CVS::unedit()
 {
-   vcstatus = UNLOCKED;
+   vcstatus_ = UNLOCKED;
return doVCCommand("cvs -q unedit " + getTarget(File),
FileName(owner_->filePath()));
 }
@@ -860,7 +860,7 @@ LyXVC::CommandResult CVS::checkIn(string const & msg, 
string & log)
CvsStatus status = getStatus();
switch (status) {
case UpToDate:
-   if (vcstatus != NOLOCKING)
+   if (vcstatus_ != NOLOCKING)
if (unedit())
return LyXVC::ErrorCommand;
log = "CVS: Proceeded";
@@ -902,7 +902,7 @@ bool CVS::isLocked() const
 
 bool CVS::checkInEnabled()
 {
-   if (vcstatus != NOLOCKING)
+   if (vcstatus_ != NOLOCKING)
return isLocked();
else
return true;
@@ -918,7 +918,7 @@ bool CVS::isCheckInWithConfirmation()
 
 string CVS::checkOut()
 {
-   if (vcstatus != NOLOCKING && edit())
+   if (vcstatus_ != NOLOCKING && edit())
return string();
TempFile tempfile("lyxvout");
FileName tmpf = tempfile.name();
@@ -945,7 +945,7 @@ string CVS::checkOut()
 
 bool CVS::checkOutEnabled()
 {
-   if (vcstatus != NOLOCKING)
+   if (vcstatus_ != NOLOCKING)
return !isLocked();
else
return true;
@@ -1035,7 +1035,7 @@ bool CVS::revert()
CvsStatus status = getStatus();
switch (status) {
case UpToDate:
-   if (vcstatus != NOLOCKING)
+   if (vcstatus_ != NOLOCKING)
return 0 == unedit();
break;
case NeedsMerge:
@@ -1188,12 +1188,12 @@ void SVN::scanMaster()
 {
// vcstatus code is somewhat superflous,
// until we want to implement read-only toggle for svn.
-   vcstatus = NOLOCKING;
+   vcstatus_ = NOLOCKING;
if (checkLockMode()) {
if (isLocked())
-   vcstatus = LOCKED;
+   vcstatus_ = LOCKED;
else
-   vcstatus = UNLOCKED;
+   vcstatus_ = UNLOCKED;
}
 }
 
@@ -1864,7 +1864,7 @@ void GIT::scanMaster()
 {
// vcstatus code i

[LyX/master] Comment

2020-12-18 Thread Richard Kimberly Heck
commit fd4d546d5b62525ed94032393f18b0f3429b922b
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 14:50:13 2020 -0500

Comment
---
 src/VCBackend.cpp |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 13a8265..93b55e4 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -538,6 +538,8 @@ FileName const CVS::findFile(FileName const & file)
 {
// First we look for the CVS/Entries in the same dir
// where we have file.
+   // Note that it is not necessary to search parent directories, since
+   // there will be a CVS/Entries file in every subdirectory.
FileName const entries(onlyPath(file.absFileName()) + "/CVS/Entries");
string const tmpf = '/' + onlyFileName(file.absFileName()) + '/';
LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under cvs in `" << 
entries
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Allow registration of files with svn when parents directory is not yet registered.

2020-12-18 Thread Richard Kimberly Heck
commit 77cdef1fe0ca069c916e0f824c1b7ff98f771748
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 16:01:43 2020 -0500

Allow registration of files with svn when parents directory is not yet 
registered.
---
 src/LyXVC.cpp |2 --
 src/VCBackend.cpp |2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index b18bcdf..8d0255f 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -198,8 +198,6 @@ bool LyXVC::registrer()
}
if (response.empty())
response = _("(no initial description)");
-   // FIXME This will fail with svn if the current directory has not
-   // itself been added.
vcs_->registrer(to_utf8(response));
return true;
 }
diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 680af81..d242a21 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -1251,7 +1251,7 @@ bool SVN::retrieve(FileName const & file)
 
 void SVN::registrer(string const & /*msg*/)
 {
-   doVCCommand("svn add -q " + 
quoteName(onlyFileName(owner_->absFileName())),
+   doVCCommand("svn add -q --parents " + 
quoteName(onlyFileName(owner_->absFileName())),
FileName(owner_->filePath()));
 }
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Comment

2020-12-18 Thread Richard Kimberly Heck
commit 750af391396ee60c95e20f3cf5ac06b1804860b5
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 15:53:45 2020 -0500

Comment
---
 src/LyXVC.cpp |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index ed0a799..b18bcdf 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -98,9 +98,10 @@ bool LyXVC::file_found_hook(FileName const & fn)
 
 bool LyXVC::file_not_found_hook(FileName const & fn)
 {
-   // Check if file is under RCS.
-   // This happens if we are trying to load non existent
-   // file on disk, but existent in ,v version.
+   // Check if file is under version control.
+   // This happens if we are trying to load does not exist.
+   // It may yet exist in the repository and so could be
+   // 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();
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Fix bug with registering files for VC when they are in repo subdirs.

2020-12-18 Thread Richard Kimberly Heck
commit fdbbddecb7f208692923c36f1fa7edf0dc17b40d
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 15:48:51 2020 -0500

Fix bug with registering files for VC when they are in repo subdirs.
---
 src/LyXVC.cpp |   46 ++--
 src/VCBackend.cpp |   17 ---
 src/VCBackend.h   |   12 --
 src/support/filetools.cpp |   13 
 src/support/filetools.h   |6 -
 5 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
index fa4d4c8..ed0a799 100644
--- a/src/LyXVC.cpp
+++ b/src/LyXVC.cpp
@@ -153,30 +153,36 @@ bool LyXVC::registrer()
 
// it is very likely here that the vcs is not created yet...
if (!vcs_) {
-   //check in the root directory of the document
-   FileName const cvs_entries(onlyPath(filename.absFileName()) + 
"/CVS/Entries");
-   FileName const svn_entries(onlyPath(filename.absFileName()) + 
"/.svn/entries");
-   FileName const git_index(onlyPath(filename.absFileName()) + 
"/.git/index");
+   FileName found = VCS::checkParentDirs(filename, ".git/index");
 
-   if (git_index.isReadableFile()) {
+   if (!found.empty()) {
LYXERR(Debug::LYXVC, "LyXVC: registering "
<< to_utf8(filename.displayName()) << " with 
GIT");
-   vcs_.reset(new GIT(git_index, owner_));
-
-   } else if (svn_entries.isReadableFile()) {
-   LYXERR(Debug::LYXVC, "LyXVC: registering "
-   << to_utf8(filename.displayName()) << " with 
SVN");
-   vcs_.reset(new SVN(svn_entries, owner_));
-
-   } else if (cvs_entries.isReadableFile()) {
-   LYXERR(Debug::LYXVC, "LyXVC: registering "
-   << to_utf8(filename.displayName()) << " with 
CVS");
-   vcs_.reset(new CVS(cvs_entries, owner_));
+   vcs_.reset(new GIT(found, owner_));
 
} else {
-   LYXERR(Debug::LYXVC, "LyXVC: registering "
-   << to_utf8(filename.displayName()) << " with 
RCS");
-   vcs_.reset(new RCS(FileName(), owner_));
+   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_));
+
+   } else {
+   // We only need to check the current directory, 
since CVS meta-data
+   // is in every sub-directory.
+   FileName const 
cvs_entries(onlyPath(filename.absFileName()) + "/CVS/Entries");
+   if (cvs_entries.isReadableFile()) {
+   LYXERR(Debug::LYXVC, "LyXVC: 
registering "
+   << 
to_utf8(filename.displayName()) << " with CVS");
+   vcs_.reset(new CVS(cvs_entries, 
owner_));
+
+   } else {
+   // If all else fails, use RCS
+   LYXERR(Debug::LYXVC, "LyXVC: 
registering "
+   << 
to_utf8(filename.displayName()) << " with RCS");
+   vcs_.reset(new RCS(FileName(), owner_));
+   }
+   }
}
}
 
@@ -191,6 +197,8 @@ bool LyXVC::registrer()
}
if (response.empty())
response = _("(no initial description)");
+   // FIXME This will fail with svn if the current directory has not
+   // itself been added.
vcs_->registrer(to_utf8(response));
return true;
 }
diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 26ac809..680af81 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -105,18 +105,19 @@ bool VCS::makeRCSRevision(string const &version, string 
&revis) const
 }
 
 
-bool VCS::checkParentDirs(FileName const & file, std::string const & vcsdir)
+FileName VCS::checkParentDirs(FileName const & start, std::string const & file)
 {
-   FileName dirname = file.onlyPath();
+   static FileName empty;
+   FileName dirname = start.onlyPath();
do {
-   FileName tocheck = FileName(addName(dirname.absFileName(), 
vcsdir));
+   FileName tocheck = FileName(addPathName(dirname.absFileName(), 
file));
LYXERR(Debug::LYXVC, "check file: " << tocheck.absFileName());
if (tocheck.exists())
-   return true;

[LyX/master] Comments

2020-12-18 Thread Richard Kimberly Heck
commit 49506153c16d6e435e993e40b7520a5ce2b2471c
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 16:19:05 2020 -0500

Comments
---
 src/VCBackend.h |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/VCBackend.h b/src/VCBackend.h
index 24758d7..d983906 100644
--- a/src/VCBackend.h
+++ b/src/VCBackend.h
@@ -152,7 +152,8 @@ public:
explicit
RCS(support::FileName const & m, Buffer * b);
 
-   /// return the revision file for the given file, if found
+   /// Determine whether the file is under RCS control
+   /// \return the file containing the meta-data (FILE,v) if so, else empty
static support::FileName const findFile(support::FileName const & file);
 
/// get file from repo, the caller must ensure that it does not exist 
locally
@@ -238,7 +239,8 @@ public:
explicit
CVS(support::FileName const & m, Buffer * b);
 
-   /// return the revision file for the given file, if found
+   /// Determine whether the file is under CVS control
+   /// \return the file containing the meta-data (CVS/entries) if so, else 
empty
static support::FileName const findFile(support::FileName const & file);
 
/// get file from repo, the caller must ensure that it does not exist 
locally
@@ -379,7 +381,8 @@ public:
explicit
SVN(support::FileName const & m, Buffer * b);
 
-   /// return the revision file for the given file, if found
+   /// 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);
 
/// get file from repo, the caller must ensure that it does not exist 
locally
@@ -489,7 +492,8 @@ public:
explicit
GIT(support::FileName const & m, Buffer * b);
 
-   /// return the revision file for the given file, if found
+   /// Determine whether the file is under RCS control
+   /// \return the file itself if so, else empty
static support::FileName const findFile(support::FileName const & file);
 
/// get file from repo, the caller must ensure that it does not exist 
locally
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] typo

2020-12-18 Thread Richard Kimberly Heck
commit a4c9a5010e616e9f68a5e9dd981d5fb91386d6b1
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 16:19:28 2020 -0500

typo
---
 src/VCBackend.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/VCBackend.h b/src/VCBackend.h
index d983906..b3f4e14 100644
--- a/src/VCBackend.h
+++ b/src/VCBackend.h
@@ -492,7 +492,7 @@ public:
explicit
GIT(support::FileName const & m, Buffer * b);
 
-   /// Determine whether the file is under RCS control
+   /// 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);
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Remove unused return values and useless member assignment.

2020-12-18 Thread Richard Kimberly Heck
commit 05551a7cfba74d39d27aa6544226fe48d6c9e4dc
Author: Richard Kimberly Heck 
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

[LyX/master] Simplify checking whether files are controlled by SVN and GIT.

2020-12-18 Thread Richard Kimberly Heck
commit 7e5c42593e45424676b466db257e5c377329c2e4
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 16:43:52 2020 -0500

Simplify checking whether files are controlled by SVN and GIT.
---
 src/VCBackend.cpp |   40 
 1 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index f8c2497..01d546d 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -537,25 +537,19 @@ CVS::CVS(FileName const & m, Buffer * b) : VCS(b)
 
 FileName const CVS::findFile(FileName const & file)
 {
-   // First we look for the CVS/Entries in the same dir
-   // where we have file.
+   LYXERR(Debug::LYXVC, "LyXVC: Checking if "
+  << onlyFileName(file.absFileName()) << "is under cvs");
+   // First we look for the CVS/Entries in the same dir where we have file.
// Note that it is not necessary to search parent directories, since
// there will be a CVS/Entries file in every subdirectory.
FileName const entries(onlyPath(file.absFileName()) + "/CVS/Entries");
-   string const tmpf = '/' + onlyFileName(file.absFileName()) + '/';
-   LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under cvs in `" << 
entries
-<< "' for `" << tmpf << '\'');
if (entries.isReadableFile()) {
-   // Ok we are at least in a CVS dir. Parse the CVS/Entries
-   // and see if we can find this file. We do a fast and
-   // dirty parse here.
-   ifstream ifs(entries.toFilesystemEncoding().c_str());
-   string line;
-   while (getline(ifs, line)) {
-   LYXERR(Debug::LYXVC, "\tEntries: " << line);
-   if (contains(line, tmpf))
-   return entries;
-   }
+   // We are in a CVS-managed directory
+   // See if the file is known to CVS
+   string const cmd = "cvs log " + 
quoteName(file.toFilesystemEncoding());
+   int const ret = doVCCommandCall(cmd, file.onlyPath());
+   if (ret == 0)
+   return entries;
}
return FileName();
 }
@@ -1837,23 +1831,13 @@ bool GIT::findFile(FileName const & file)
return false;
}
 
-   // Now we check the status of the file.
-   TempFile tempfile("lyxvcout");
-   FileName tmpf = tempfile.name();
-   if (tmpf.empty()) {
-   LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
-   return false;
-   }
-
+   // Now we check if the file is known to git.
string const fname = onlyFileName(file.absFileName());
LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under git control for 
`"
<< fname << '\'');
-   doVCCommandCall("git ls-files " +
-   quoteName(fname) + " > " +
-   quoteName(tmpf.toFilesystemEncoding()),
+   int const ret = doVCCommandCall("git log " + quoteName(fname),
file.onlyPath());
-   tmpf.refresh();
-   bool found = !tmpf.isFileEmpty();
+   bool const found = (ret == 0);
LYXERR(Debug::LYXVC, "GIT control: " << (found ? "enabled" : 
"disabled"));
return found;
 }
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Minor code simplification

2020-12-18 Thread Richard Kimberly Heck
commit 03897206bb2863f18138a1eb37d0486bf27b7acb
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 16:59:55 2020 -0500

Minor code simplification
---
 src/VCBackend.cpp |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 01d546d..7f97455 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -1183,12 +1183,8 @@ void SVN::scanMaster()
// vcstatus code is somewhat superflous,
// until we want to implement read-only toggle for svn.
vcstatus_ = NOLOCKING;
-   if (checkLockMode()) {
-   if (isLocked())
-   vcstatus_ = LOCKED;
-   else
-   vcstatus_ = UNLOCKED;
-   }
+   if (checkLockMode())
+   vcstatus_ = isLocked() ? LOCKED : UNLOCKED;
 }
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Remove unnecessary change.

2020-12-18 Thread Richard Kimberly Heck
commit 49f019e129cf6a63ec942cd863107459e3ffa321
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 17:11:05 2020 -0500

Remove unnecessary change.
---
 src/VCBackend.cpp |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 7f97455..f1f19b2 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -107,7 +107,6 @@ bool VCS::makeRCSRevision(string const &version, string 
&revis) const
 
 FileName VCS::checkParentDirs(FileName const & start, std::string const & file)
 {
-   static FileName empty;
FileName dirname = start.onlyPath();
do {
FileName tocheck = FileName(addPathName(dirname.absFileName(), 
file));
@@ -117,7 +116,7 @@ FileName VCS::checkParentDirs(FileName const & start, 
std::string const & file)
// this construct because of #8295
dirname = FileName(dirname.absFileName()).parentPath();
} while (!dirname.empty());
-   return empty;
+   return FileName();
 }
 
 
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Typo

2020-12-18 Thread Richard Kimberly Heck
commit 8c805db9d3c6c333291374ba6b1b9728f87187cc
Author: Richard Kimberly Heck 
Date:   Fri Dec 18 17:35:58 2020 -0500

Typo
---
 src/VCBackend.cpp |4 ++--
 src/VCBackend.h   |3 ++-
 src/support/filetools.cpp |2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index f1f19b2..48cb618 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -161,8 +161,8 @@ bool RCS::retrieve(FileName const & file)
 {
LYXERR(Debug::LYXVC, "LyXVC::RCS: retrieve.\n\t" << file);
// The caller ensures that file does not exist, so no need to check 
that.
-   return doVCCommandCall("co -q -r " + 
quoteName(file.toFilesystemEncoding()),
-  FileName()) == 0;
+   int const ret = doVCCommandCall("co -q -r " + 
quoteName(file.toFilesystemEncoding()));
+   return ret == 0;
 }
 
 
diff --git a/src/VCBackend.h b/src/VCBackend.h
index ed4201a..e7dc735 100644
--- a/src/VCBackend.h
+++ b/src/VCBackend.h
@@ -129,7 +129,8 @@ protected:
 * @param path the path from which to execute
 * @return exit status
 */
-   static int doVCCommandCall(std::string const & cmd, support::FileName 
const & path);
+   static int doVCCommandCall(std::string const & cmd,
+   support::FileName const & path = support::FileName());
 
/// The status of the VC controlled file.
VCStatus vcstatus_;
diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index 88b8be1..a5168d4 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -1147,7 +1147,7 @@ cmd_ret const runCommand(string const & cmd)
 FileName const findtexfile(string const & fil, string const & /*format*/,
   bool const onlykpse)
 {
-   /* There is no problem to extend this function too use other
+   /* There is no problem to extend this function to use other
   methods to look for files. It could be setup to look
   in environment paths and also if wanted as a last resort
   to a recursive find. One of the easier extensions would
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs