[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [TSVN] Tentative path for SVNFolderStatus

From: SteveKing <stefankueng_at_gmail.com>
Date: 2004-10-28 15:19:55 CEST

On Thu, 28 Oct 2004 13:44:10 +0100, Will Dean <svn@indcomp.co.uk> wrote:
> Index: SVNFolderStatus.cpp
> ===================================================================
> --- SVNFolderStatus.cpp (revision 1869)
> +++ SVNFolderStatus.cpp (working copy)
> @@ -21,6 +21,7 @@
>
> #include "SVNFolderStatus.h"
> #include "UnicodeUtils.h"
> +#include "PreserveChdir.h"
>
> // get / auto-alloc a string "copy"
>
> @@ -179,11 +180,21 @@
> //since subversion can do this in one step
> TCHAR pathbuf[MAX_PATH+4];
> _tcscpy(pathbuf, filepath);
> - const TCHAR * p = _tcsrchr(filepath, '/');
> - if (p)
> - pathbuf[p-filepath] = '\0';
> + if(!isFolder)
> + {
> + const TCHAR * p = _tcsrchr(filepath, '/');
> + if (p)
> + pathbuf[p-filepath] = '\0';
> + }

The check for "not a folder" shoudln't be necessary, because we never
should get here if it's a folder. I know, the if
(shellCache.IsRecursive() && !PathFileExists(exfile)) makes you think
otherwise (and I agree, we just should return svn_wc_status_normal if
that expression is false) but the 'parent' function which acutally
calls this one already filters out folders when in non-recursive mode.

So to fix that, I suggest to just
return &invalidstatus;

>
> - internalpath = svn_path_internal_style
> (CUnicodeUtils::StdGetUTF8(pathbuf).c_str(), pool);
> + if(isFolder)
> + {
> + internalpath = "";
> + }
> + else
> + {
> + internalpath = svn_path_internal_style
> (CUnicodeUtils::StdGetUTF8(pathbuf).c_str(), pool);
> + }
> ctx->auth_baton = NULL;

Yikes!
Remember: a few lines above, you remove the filename part from the
path. That means here, it always _is_ a folder, no matter what
isFolder tells you!

> statushash = apr_hash_make(pool);
> @@ -192,6 +203,13 @@
> rev.kind = svn_opt_revision_unspecified;
> try
> {
> + PreserveChdir preserveChdir;

Don't do that here. It's already done at the beginning of the COM-function.

> + if(isFolder)
> + {
> + SetCurrentDirectory(pathbuf);
> + }
> +

Drop the if (isFolder) and you're fine.

> err = svn_client_status (&youngest,
> internalpath,
> &rev,
> @@ -241,13 +259,6 @@
> {
> TCHAR * filepathnonconst = (LPTSTR)filepath;
>
> - //first change the filename to 'internal' format
> - for (UINT i=0; i<_tcsclen(filepath); i++)
> - {
> - if (filepath[i] == _T('\\'))
> - filepathnonconst[i] = _T('/');
> - } // for (int i=0; i<_tcsclen(filename); i++)
> -

Why do you want to remove that?

> if (! shellCache.IsPathAllowed(filepath))
> return &invalidstatus;
>
> @@ -283,6 +294,7 @@
> }
> filestatuscache * ret = NULL;
> std::map<stdstring, filestatuscache>::iterator iter;
> +
> if ((iter = m_cache.find(filepath)) != m_cache.end())
> {
> ATLTRACE2(_T("cache found for %s - %s\n"), filepath, pathbuf);
> @@ -300,6 +312,7 @@
> void SVNFolderStatus::fillstatusmap(void * baton, const char * path,
> svn_wc_status_t * status)
> {
> SVNFolderStatus * Stat = (SVNFolderStatus *)baton;
> +
> if
> ((status->entry)&&(Stat->shellCache.IsRecursive())&&(status->entry->kind ==
> svn_node_dir))
> return;
>
> @@ -327,7 +340,11 @@
> s.askedcounter = SVNFOLDERSTATUS_CACHETIMES;
> stdstring str;
> if (path)
> - str = CUnicodeUtils::StdGetUnicode(path);
> + {
> + char fullPath[_MAX_PATH+1];
> + _fullpath(fullPath, path, _MAX_PATH);
> + str = CUnicodeUtils::StdGetUnicode(fullPath);
> + }

AFAIK Subversion returns full paths here, no matter what path you pass
in for the function. Don't know for sure, I have to test that first.

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu Oct 28 16:27:51 2004

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.