SVN client - prefix error constants.
Avoid Windows clashes on common names (NO_ERROR, etc)
This commit is contained in:
parent
c391fcd345
commit
4d26e144ab
@ -154,10 +154,6 @@ namespace {
|
||||
|
||||
headerLength = p - _ptr;
|
||||
_ptr = p;
|
||||
|
||||
if (sourceViewOffset != 0) {
|
||||
cout << "sourceViewOffset:" << sourceViewOffset << endl;
|
||||
}
|
||||
}
|
||||
|
||||
bool apply(std::vector<char>& output, std::istream& source)
|
||||
@ -168,7 +164,7 @@ namespace {
|
||||
while (_ptr < pEnd) {
|
||||
int op = ((*_ptr >> 6) & 0x3);
|
||||
if (op >= 3) {
|
||||
std::cerr << "weird opcode" << endl;
|
||||
SG_LOG(SG_IO, SG_INFO, "SVNDeltaWindow: bad opcode:" << op);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -180,7 +176,7 @@ namespace {
|
||||
}
|
||||
|
||||
if (length == 0) {
|
||||
std::cerr << "malformed stream, 0 length" << std::endl;
|
||||
SG_LOG(SG_IO, SG_INFO, "SVNDeltaWindow: malformed stream, 0 length" << op);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -233,7 +229,7 @@ class SVNReportParser::SVNReportParserPrivate
|
||||
public:
|
||||
SVNReportParserPrivate(SVNRepository* repo) :
|
||||
tree(repo),
|
||||
status(SVNRepository::NO_ERROR),
|
||||
status(SVNRepository::SVN_NO_ERROR),
|
||||
parserInited(false),
|
||||
currentPath(repo->fsBase())
|
||||
{
|
||||
@ -247,7 +243,7 @@ public:
|
||||
|
||||
void startElement (const char * name, const char** attributes)
|
||||
{
|
||||
if (status != SVNRepository::NO_ERROR) {
|
||||
if (status != SVNRepository::SVN_NO_ERROR) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -365,7 +361,7 @@ public:
|
||||
|
||||
void endElement (const char * name)
|
||||
{
|
||||
if (status != SVNRepository::NO_ERROR) {
|
||||
if (status != SVNRepository::SVN_NO_ERROR) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -373,7 +369,7 @@ public:
|
||||
tagStack.pop_back();
|
||||
if (!strcmp(name, SVN_TXDELTA_TAG)) {
|
||||
if (!decodeTextDelta(currentPath)) {
|
||||
fail(SVNRepository::ERROR_TXDELTA);
|
||||
fail(SVNRepository::SVN_ERROR_TXDELTA);
|
||||
}
|
||||
} else if (!strcmp(name, SVN_ADD_FILE_TAG)) {
|
||||
finishFile(currentDir->addChildFile(currentPath.file()));
|
||||
@ -400,7 +396,7 @@ public:
|
||||
} else if (!strcmp(name, SVN_DAV_MD5_CHECKSUM)) {
|
||||
// validate against (presumably) just written file
|
||||
if (decodedFileMd5 != md5Sum) {
|
||||
fail(SVNRepository::ERROR_CHECKSUM);
|
||||
fail(SVNRepository::SVN_ERROR_CHECKSUM);
|
||||
}
|
||||
} else if (!strcmp(name, SVN_OPEN_DIRECTORY_TAG)) {
|
||||
if (currentDir->parent()) {
|
||||
@ -425,7 +421,7 @@ public:
|
||||
|
||||
void data (const char * s, int length)
|
||||
{
|
||||
if (status != SVNRepository::NO_ERROR) {
|
||||
if (status != SVNRepository::SVN_NO_ERROR) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -525,7 +521,7 @@ SVNReportParser::~SVNReportParser()
|
||||
SVNRepository::ResultCode
|
||||
SVNReportParser::innerParseXML(const char* data, int size)
|
||||
{
|
||||
if (_d->status != SVNRepository::NO_ERROR) {
|
||||
if (_d->status != SVNRepository::SVN_NO_ERROR) {
|
||||
return _d->status;
|
||||
}
|
||||
|
||||
@ -537,7 +533,7 @@ SVNReportParser::innerParseXML(const char* data, int size)
|
||||
|
||||
XML_ParserFree(_d->xmlParser);
|
||||
_d->parserInited = false;
|
||||
return SVNRepository::ERROR_XML;
|
||||
return SVNRepository::SVN_ERROR_XML;
|
||||
} else if (isEnd) {
|
||||
XML_ParserFree(_d->xmlParser);
|
||||
_d->parserInited = false;
|
||||
@ -549,7 +545,7 @@ SVNReportParser::innerParseXML(const char* data, int size)
|
||||
SVNRepository::ResultCode
|
||||
SVNReportParser::parseXML(const char* data, int size)
|
||||
{
|
||||
if (_d->status != SVNRepository::NO_ERROR) {
|
||||
if (_d->status != SVNRepository::SVN_NO_ERROR) {
|
||||
return _d->status;
|
||||
}
|
||||
|
||||
@ -567,7 +563,7 @@ SVNReportParser::parseXML(const char* data, int size)
|
||||
|
||||
SVNRepository::ResultCode SVNReportParser::finishParse()
|
||||
{
|
||||
if (_d->status != SVNRepository::NO_ERROR) {
|
||||
if (_d->status != SVNRepository::SVN_NO_ERROR) {
|
||||
return _d->status;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
SVNRepoPrivate(SVNRepository* parent) :
|
||||
p(parent),
|
||||
isUpdating(false),
|
||||
status(SVNRepository::NO_ERROR)
|
||||
status(SVNRepository::SVN_NO_ERROR)
|
||||
{ ; }
|
||||
|
||||
SVNRepository* p; // link back to outer
|
||||
@ -161,11 +161,11 @@ namespace { // anonmouse
|
||||
if (responseCode() == 207) {
|
||||
// fine
|
||||
} else if (responseCode() == 404) {
|
||||
_repo->propFindFailed(this, SVNRepository::ERROR_NOT_FOUND);
|
||||
_repo->propFindFailed(this, SVNRepository::SVN_ERROR_NOT_FOUND);
|
||||
} else {
|
||||
SG_LOG(SG_IO, SG_WARN, "request for:" << url() <<
|
||||
" return code " << responseCode());
|
||||
_repo->propFindFailed(this, SVNRepository::ERROR_SOCKET);
|
||||
_repo->propFindFailed(this, SVNRepository::SVN_ERROR_SOCKET);
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,12 +261,12 @@ protected:
|
||||
_repo->svnUpdateDone();
|
||||
}
|
||||
} else if (responseCode() == 404) {
|
||||
_repo->updateFailed(this, SVNRepository::ERROR_NOT_FOUND);
|
||||
_repo->updateFailed(this, SVNRepository::SVN_ERROR_NOT_FOUND);
|
||||
_failed = true;
|
||||
} else {
|
||||
SG_LOG(SG_IO, SG_WARN, "SVN: request for:" << url() <<
|
||||
" return code " << responseCode());
|
||||
_repo->updateFailed(this, SVNRepository::ERROR_SOCKET);
|
||||
_repo->updateFailed(this, SVNRepository::SVN_ERROR_SOCKET);
|
||||
_failed = true;
|
||||
}
|
||||
}
|
||||
@ -351,7 +351,7 @@ bool SVNRepository::isBare() const
|
||||
|
||||
void SVNRepository::update()
|
||||
{
|
||||
_d->status = NO_ERROR;
|
||||
_d->status = SVN_NO_ERROR;
|
||||
if (_d->targetRevision.empty() || _d->vccUrl.empty()) {
|
||||
_d->isUpdating = true;
|
||||
PropFindRequest* pfr = new PropFindRequest(_d.get());
|
||||
@ -373,7 +373,7 @@ void SVNRepository::update()
|
||||
|
||||
bool SVNRepository::isDoingSync() const
|
||||
{
|
||||
if (_d->status != NO_ERROR) {
|
||||
if (_d->status != SVN_NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ void SVNRepoPrivate::propFindComplete(HTTP::Request* req, DAVCollection* c)
|
||||
|
||||
void SVNRepoPrivate::propFindFailed(HTTP::Request *req, SVNRepository::ResultCode err)
|
||||
{
|
||||
if (err != SVNRepository::ERROR_NOT_FOUND) {
|
||||
if (err != SVNRepository::SVN_ERROR_NOT_FOUND) {
|
||||
SG_LOG(SG_IO, SG_WARN, "PropFind failed for:" << req->url());
|
||||
}
|
||||
|
||||
|
@ -55,13 +55,13 @@ public:
|
||||
bool isDoingSync() const;
|
||||
|
||||
enum ResultCode {
|
||||
NO_ERROR = 0,
|
||||
ERROR_NOT_FOUND,
|
||||
ERROR_SOCKET,
|
||||
ERROR_XML,
|
||||
ERROR_TXDELTA,
|
||||
ERROR_IO,
|
||||
ERROR_CHECKSUM
|
||||
SVN_NO_ERROR = 0,
|
||||
SVN_ERROR_NOT_FOUND,
|
||||
SVN_ERROR_SOCKET,
|
||||
SVN_ERROR_XML,
|
||||
SVN_ERROR_TXDELTA,
|
||||
SVN_ERROR_IO,
|
||||
SVN_ERROR_CHECKSUM
|
||||
};
|
||||
|
||||
ResultCode failure() const;
|
||||
|
@ -415,10 +415,10 @@ bool SGTerraSync::SvnThread::syncTreeInternal(const char* dir)
|
||||
_http.update(100);
|
||||
}
|
||||
|
||||
if (_repository->failure() == SVNRepository::ERROR_NOT_FOUND) {
|
||||
if (_repository->failure() == SVNRepository::SVN_ERROR_NOT_FOUND) {
|
||||
// this is fine, but maybe we should use a different return code
|
||||
// in the future to higher layers can distuinguish this case
|
||||
} else if (_repository->failure() != SVNRepository::NO_ERROR) {
|
||||
} else if (_repository->failure() != SVNRepository::SVN_NO_ERROR) {
|
||||
result = false;
|
||||
} else {
|
||||
SG_LOG(SG_IO, SG_DEBUG, "sync of " << command.str() << " finished ("
|
||||
|
Loading…
Reference in New Issue
Block a user