Remove partial support for non-buffer files in VCS

This reverts a small part of 0526eb9d and gets rid of the double calls of
SVN::findFile() and GIT::findFile(). Please note that git detection does
currently not work because of 26dd4d0c.
This commit is contained in:
Georg Baum 2013-04-10 22:31:38 +02:00
parent d25afed517
commit ceb2303e2b
3 changed files with 20 additions and 26 deletions

View File

@ -327,7 +327,6 @@ string LyXVC::toggleReadOnly()
return log; return log;
} }
case VCS::NOLOCKING: case VCS::NOLOCKING:
case VCS::UNVERSIONED:
break; break;
} }
return string(); return string();
@ -337,7 +336,7 @@ string LyXVC::toggleReadOnly()
bool LyXVC::inUse() const bool LyXVC::inUse() const
{ {
if (vcs) if (vcs)
return vcs->status() != VCS::UNVERSIONED; return true;
return false; return false;
} }

View File

@ -68,7 +68,7 @@ int VCS::doVCCommand(string const & cmd, FileName const & path, bool reportError
bool VCS::makeRCSRevision(string const &version, string &revis) const bool VCS::makeRCSRevision(string const &version, string &revis) const
{ {
string rev = revis; string rev = revis;
if (isStrInt(rev)) { if (isStrInt(rev)) {
int back = convert<int>(rev); int back = convert<int>(rev);
// if positive use as the last number in the whole revision string // if positive use as the last number in the whole revision string
@ -124,6 +124,8 @@ bool VCS::checkparentdirs(FileName const & file, std::string const & pathname)
RCS::RCS(FileName const & m, Buffer * b) : VCS(b) RCS::RCS(FileName const & m, Buffer * b) : VCS(b)
{ {
// Here we know that the buffer file is either already in RCS or
// about to be registered
master_ = m; master_ = m;
scanMaster(); scanMaster();
} }
@ -404,7 +406,7 @@ bool RCS::toggleReadOnlyEnabled()
// This got broken somewhere along lfuns dispatch reorganization. // This got broken somewhere along lfuns dispatch reorganization.
// reloadBuffer would be needed after this, but thats problematic // reloadBuffer would be needed after this, but thats problematic
// since we are inside Buffer::dispatch. // since we are inside Buffer::dispatch.
// return return status() != UNVERSIONED; // return true;
return false; return false;
} }
@ -513,6 +515,8 @@ bool RCS::prepareFileRevisionEnabled()
CVS::CVS(FileName const & m, Buffer * b) : VCS(b) CVS::CVS(FileName const & m, Buffer * b) : VCS(b)
{ {
// Here we know that the buffer file is either already in CVS or
// about to be registered
master_ = m; master_ = m;
have_rev_info_ = false; have_rev_info_ = false;
scanMaster(); scanMaster();
@ -553,7 +557,6 @@ void CVS::scanMaster()
LYXERR(Debug::LYXVC, "\tlooking for `" << tmpf << '\''); LYXERR(Debug::LYXVC, "\tlooking for `" << tmpf << '\'');
string line; string line;
static regex const reg("/(.*)/(.*)/(.*)/(.*)/(.*)"); static regex const reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
vcstatus = UNVERSIONED;
while (getline(ifs, line)) { while (getline(ifs, line)) {
LYXERR(Debug::LYXVC, "\t line: " << line); LYXERR(Debug::LYXVC, "\t line: " << line);
if (contains(line, tmpf)) { if (contains(line, tmpf)) {
@ -1139,6 +1142,8 @@ bool CVS::prepareFileRevisionEnabled()
SVN::SVN(FileName const & m, Buffer * b) : VCS(b) 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; master_ = m;
locked_mode_ = 0; locked_mode_ = 0;
scanMaster(); scanMaster();
@ -1173,19 +1178,14 @@ FileName const SVN::findFile(FileName const & file)
void SVN::scanMaster() void SVN::scanMaster()
{ {
// vcstatus code other than UNVERSIONED is somewhat superflous, // vcstatus code is somewhat superflous,
// until we want to implement read-only toggle for svn. // until we want to implement read-only toggle for svn.
FileName f = findFile(owner_->fileName()); vcstatus = NOLOCKING;
if (f.empty()) { if (checkLockMode()) {
vcstatus = UNVERSIONED; if (isLocked())
} else { vcstatus = LOCKED;
vcstatus = NOLOCKING; else
if (checkLockMode()) { vcstatus = UNLOCKED;
if (isLocked())
vcstatus = LOCKED;
else
vcstatus = UNLOCKED;
}
} }
} }
@ -1813,6 +1813,8 @@ bool SVN::toggleReadOnlyEnabled()
GIT::GIT(FileName const & m, Buffer * b) : VCS(b) GIT::GIT(FileName const & m, Buffer * b) : VCS(b)
{ {
// Here we know that the buffer file is either already in GIT or
// about to be registered
master_ = m; master_ = m;
scanMaster(); scanMaster();
} }
@ -1867,13 +1869,9 @@ FileName const GIT::findFile(FileName const & file)
void GIT::scanMaster() void GIT::scanMaster()
{ {
// vcstatus code other than UNVERSIONED is somewhat superflous, // vcstatus code is somewhat superflous,
// until we want to implement read-only toggle for git. // until we want to implement read-only toggle for git.
FileName f = findFile(owner_->fileName()); vcstatus = NOLOCKING;
if (f.empty())
vcstatus = UNVERSIONED;
else
vcstatus = NOLOCKING;
} }

View File

@ -33,9 +33,6 @@ public:
UNLOCKED, UNLOCKED,
LOCKED, LOCKED,
NOLOCKING, NOLOCKING,
/// This file is not in version control, but it could be aded
/// (because the path is under version control)
UNVERSIONED,
}; };
VCS(Buffer * b) : owner_(b) {} VCS(Buffer * b) : owner_(b) {}