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

[TSVN] Tentative path for SVNFolderStatus

From: Will Dean <svn_at_indcomp.co.uk>
Date: 2004-10-28 14:44:10 CEST

Hi Stefan,

I've done a lot of playing around with SVNFolderStatus, and think I have
discovered some problems with it, as well as a way to work around the SVN
excessive recursion bug.

The attached patch does a couple of things:

1. Stops TSVN inappropriately asking for SVN status on the folder above the
current one.
2. Does a svn status on the *current* directory, rather than by explicit
path (avoids an SVN performance bug)

'2' creates fallout in that the return from SVN is now relative paths, so I
had to _fullpath them before adding them to the cache. This has the
positive side-effect of keeping the cache in 'native' /\ direction, so that
you don't have to reverse the '\' chars at that the start of a cache
lookup. (Which incidentally had strlen in the for() statement, which was
rather inefficient...)

My mods to BuildCache are deliberately clunky - I test 'isFolder' about
four times - hopefully there can be a little bit of tidying there.

Anyway, *I* think it's an improvement, and that's without adding the 11592
patch from SVN.

I'd be interested in comments, good or bad.

Cheers,

Will

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';
+ }

- 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;

          statushash = apr_hash_make(pool);
@@ -192,6 +203,13 @@
          rev.kind = svn_opt_revision_unspecified;
          try
          {
+ PreserveChdir preserveChdir;
+
+ if(isFolder)
+ {
+ SetCurrentDirectory(pathbuf);
+ }
+
                  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++)
-
          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);
+ }
          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 15:47:47 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.