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

[PATCH][merge-tracking] get_merge_info_for_path brings no result while eliding

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-10-10 11:52:03 CEST

Hi All,
Find the attached patch and log.

With regards
Kamesh Jayachandran

[[[
Patch by: Kamesh Jayachandran <kamesh@collab.net>

get_merge_info_path fails in the cases if the path is '/a/b/c/d/e'
and the repo has the mergeinfo only for '/a/b/c' and no mergeinfo
for '/a/b/c/d'.

* subversion/libsvn_fs_util/merge-info-sqlite-index.c
  (global): remove NEGATIVE_CACHE_RESULT.
  (get_merge_info_for_path):
   Irrespective of 'setresult' translate the hash keys of 'elided parent->path'
   and set it to cache, so that we don't loose the 'mergeinfo' of '/a/b/c'
   during unwinding phase of recursion with path '/a/b/c/d'.
   
]]]

Index: subversion/libsvn_fs_util/merge-info-sqlite-index.c
===================================================================
--- subversion/libsvn_fs_util/merge-info-sqlite-index.c (revision 21862)
+++ subversion/libsvn_fs_util/merge-info-sqlite-index.c (working copy)
@@ -37,10 +37,6 @@
 /* Following are defines that specify the textual elements of the
    native filesystem directories and revision files. */
 
-/* We want to cache that we saw no mergeinfo for a path as well,
- so we use a -1 converted to a pointer to represent this. */
-#define NEGATIVE_CACHE_RESULT ((void *)(-1))
-
 /* SQLITE->SVN quick error wrap, much like SVN_ERR. */
 #define SQLITE_ERR(x, db) do \
 { \
@@ -405,10 +401,9 @@
   svn_boolean_t has_no_mergeinfo = FALSE;
 
   cacheresult = apr_hash_get(cache, path, APR_HASH_KEY_STRING);
- if (cacheresult != 0)
+ if (cacheresult && setresult)
     {
- if (cacheresult != NEGATIVE_CACHE_RESULT && setresult)
- apr_hash_set(result, path, APR_HASH_KEY_STRING, cacheresult);
+ apr_hash_set(result, path, APR_HASH_KEY_STRING, cacheresult);
       return SVN_NO_ERROR;
     }
 
@@ -450,8 +445,6 @@
     {
       svn_stringbuf_t *parentpath;
 
- apr_hash_set(cache, path, APR_HASH_KEY_STRING, NEGATIVE_CACHE_RESULT);
-
       /* It is possible we are already at the root. */
       if (strcmp(path, "") == 0)
         return SVN_NO_ERROR;
@@ -467,23 +460,19 @@
       SVN_ERR(get_merge_info_for_path(db, parentpath->data, rev,
                                       result, cache, FALSE, include_parents,
                                       pool));
- if (setresult)
+
+ /* Now translate the cache for our parent to our path */
+ cacheresult = apr_hash_get(cache, parentpath->data, APR_HASH_KEY_STRING);
+ if (cacheresult)
         {
- /* Now translate the result for our parent to our path */
- cacheresult = apr_hash_get(cache, parentpath->data,
- APR_HASH_KEY_STRING);
- if (cacheresult == NEGATIVE_CACHE_RESULT)
- apr_hash_set(result, path, APR_HASH_KEY_STRING, NULL);
- else if (cacheresult)
- {
- apr_hash_t *translatedhash;
- const char *toappend = &path[parentpath->len + 1];
+ apr_hash_t *translatedhash;
+ const char *toappend = &path[parentpath->len + 1];
 
- append_component_to_paths(&translatedhash, cacheresult,
- toappend, pool);
- apr_hash_set(result, path, APR_HASH_KEY_STRING,
- translatedhash);
- }
+ append_component_to_paths(&translatedhash, cacheresult,
+ toappend, pool);
+ apr_hash_set(cache, path, APR_HASH_KEY_STRING, translatedhash);
+ if (setresult)
+ apr_hash_set(result, path, APR_HASH_KEY_STRING, translatedhash);
         }
     }
   return SVN_NO_ERROR;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 10 11:51:27 2006

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

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