[prev in list] [next in list] [prev in thread] [next in thread]
List: subversion-cvs
Subject: svn commit: r9584 - trunk/subversion/libsvn_client
From: sussman () tigris ! org
Date: 2004-04-30 15:45:29
Message-ID: 200404301545.i3UFjTY29383 () morbius ! ch ! collab ! net
[Download RAW message or body]
Author: sussman
Date: Fri Apr 30 10:45:22 2004
New Revision: 9584
Modified:
trunk/subversion/libsvn_client/ra.c
Log:
Issue #1093: tweaks to history-tracing code, based on kfogel's review.
* libsvn_client/ra.c
(log_reciver_baton): move this code next to log_receiver, for clarity.
(svn_client__prev_log_path): return a more specific errorcode.
Also, check for regular addition (not just add-with-history)
and return a NULL prev-path in that case.
(log_receiver): document this a bit, and deal with a NULL prev-path.
Modified: trunk/subversion/libsvn_client/ra.c
==============================================================================
--- trunk/subversion/libsvn_client/ra.c (original)
+++ trunk/subversion/libsvn_client/ra.c Fri Apr 30 10:45:22 2004
@@ -325,30 +325,6 @@
}
-struct log_receiver_baton
-{
- /* The kind of the path we're tracing. */
- svn_node_kind_t kind;
-
- /* The path at which we are trying to find our versioned resource in
- the log output. */
- const char *last_path;
-
- /* Input revisions and output paths; the whole point of this little game. */
- svn_revnum_t start_revision;
- const char *start_path;
- svn_revnum_t end_revision;
- const char *end_path;
- svn_revnum_t peg_revision;
- const char *peg_path;
-
- /* Client context baton. */
- svn_client_ctx_t *ctx;
-
- /* A pool from which to allocate stuff stored in this baton. */
- apr_pool_t *pool;
-};
-
svn_error_t *
svn_client__prev_log_path (const char **prev_path_p,
@@ -361,6 +337,9 @@
svn_log_changed_path_t *change;
const char *prev_path = NULL;
+ /* It's impossible to find the predecessor path of a NULL path. */
+ assert(path);
+
/* If PATH was explicitly changed in this revision, that makes
things easy -- we keep the path (but check to see). If so,
we'll either use the path, or, if was copied, use its
@@ -370,8 +349,13 @@
{
if (change->copyfrom_path)
prev_path = apr_pstrdup (pool, change->copyfrom_path);
+ else if (change->action == 'A')
+ prev_path = NULL;
else
prev_path = path;
+
+ *prev_path_p = prev_path;
+ return SVN_NO_ERROR;
}
else if (apr_hash_count (changed_paths))
{
@@ -425,7 +409,7 @@
if (kind == svn_node_dir)
prev_path = apr_pstrdup (pool, path);
else
- return svn_error_createf (APR_EGENERAL, NULL,
+ return svn_error_createf (SVN_ERR_CLIENT_UNRELATED_RESOURCES, NULL,
"Missing changed-path information for "
"'%s' in revision %" SVN_REVNUM_T_FMT,
path, revision);
@@ -435,9 +419,35 @@
return SVN_NO_ERROR;
}
+struct log_receiver_baton
+{
+ /* The kind of the path we're tracing. */
+ svn_node_kind_t kind;
-/* Implements svn_log_message_receiver_t; helper for
- svn_client__repos_locations. */
+ /* The path at which we are trying to find our versioned resource in
+ the log output. */
+ const char *last_path;
+
+ /* Input revisions and output paths; the whole point of this little game. */
+ svn_revnum_t start_revision;
+ const char *start_path;
+ svn_revnum_t end_revision;
+ const char *end_path;
+ svn_revnum_t peg_revision;
+ const char *peg_path;
+
+ /* Client context baton. */
+ svn_client_ctx_t *ctx;
+
+ /* A pool from which to allocate stuff stored in this baton. */
+ apr_pool_t *pool;
+};
+
+
+/* Implements svn_log_message_receiver_t; helper for
+ svn_client__repos_locations. As input, takes log_receiver_baton
+ (defined above) and attempts to "fill in" all three paths in the
+ baton over the course of many iterations. */
static svn_error_t *
log_receiver (void *baton,
apr_hash_t *changed_paths,
@@ -477,7 +487,9 @@
/* Squirrel away our "next place to look" path (suffer the strcmp
hit to save on allocations). */
- if (strcmp (prev_path, current_path) != 0)
+ if (! prev_path)
+ lrb->last_path = NULL;
+ else if (strcmp (prev_path, current_path) != 0)
lrb->last_path = apr_pstrdup (lrb->pool, prev_path);
return SVN_NO_ERROR;
---------------------------------------------------------------------
To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
For additional commands, e-mail: svn-help@subversion.tigris.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic