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

[TSVN] Another go at a patch for SVNFolderStatus

From: Will Dean <svn_at_indcomp.co.uk>
Date: 2004-10-28 16:04:23 CEST

Hi,

Here's another go at the same thing, based on Stefan's suggestions.

I've added the "return &invalidstatus". This does work OK now, but I think
it might have been slightly more efficient how I had it before (at least on
my system), because you now get two calls to BuildCache - one for the
folder, which is now rejected by the return &invalidstatus, and one for the
first file in the folder, which causes the whole folder to get stat'd.

It is possible to use that first call to get the status, which means that
the 'first file' then hits on the cache. I doubt there's much in it, though.

I have removed the bogus last check on 'isfolder'.

Anyway, I'd be interested to know if anyone else has good results with this.

I note that the 'excessive recursion' bug in SVN has actually already had a
fix done for it, so only a couple of years to go... Anyway, we can avoid
it like this, and it won't break when their fix makes into released code.

Cheers,

Will

Index: SVNFolderStatus.cpp
===================================================================
--- SVNFolderStatus.cpp (revision 1869)
+++ SVNFolderStatus.cpp (working copy)
@@ -96,7 +96,6 @@
          apr_hash_t * statushash;
          apr_pool_t * pool;
          svn_error_t * err;
- const char * internalpath;

          //dont' build the cache if an instance of TortoiseProc is running
          //since this could interfere with svn commands running (concurrent
@@ -172,6 +171,7 @@
                          ClearPool();
                          return &dirstat;
                  } // if (shellCache.IsRecursive())
+ return &invalidstatus;
          } // if (isFolder)

          //it's a file, not a folder. So fill in the cache with
@@ -179,11 +179,10 @@
          //since subversion can do this in one step
          TCHAR pathbuf[MAX_PATH+4];
          _tcscpy(pathbuf, filepath);
- const TCHAR * p = _tcsrchr(filepath, '/');
+ const TCHAR * p = _tcsrchr(filepath, '\\');
          if (p)
                  pathbuf[p-filepath] = '\0';

- internalpath = svn_path_internal_style
(CUnicodeUtils::StdGetUTF8(pathbuf).c_str(), pool);
          ctx->auth_baton = NULL;

          statushash = apr_hash_make(pool);
@@ -192,8 +191,11 @@
          rev.kind = svn_opt_revision_unspecified;
          try
          {
+ SetCurrentDirectory(pathbuf);
+
                  err = svn_client_status (&youngest,
- internalpath,
+ "", // To avoid a SVN perf bug, we make the target path
+ // the current folder, and pass an empty string in here
                          &rev,
                          fillstatusmap,
                          this,
@@ -241,13 +243,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++)
-
          if (! shellCache.IsPathAllowed(filepath))
                  return &invalidstatus;

@@ -327,7 +322,14 @@
          s.askedcounter = SVNFOLDERSTATUS_CACHETIMES;
          stdstring str;
          if (path)
- str = CUnicodeUtils::StdGetUnicode(path);
+ {
+ char fullPath[_MAX_PATH+1];
+ // When SVN STATUS is run without a path, on local directory, then
+ // it returns short paths, which need expanding to give a reliable
+ // cache-match
+ _fullpath(fullPath, path, _MAX_PATH);
+ str = CUnicodeUtils::StdGetUnicode(fullPath);
+ }
          else
                  str = _T(" ");
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu Oct 28 17:07:50 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.