You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/06/19 18:06:01 UTC
svn commit: r1351758 - /subversion/trunk/subversion/libsvn_ra_serf/blame.c
Author: gstein
Date: Tue Jun 19 16:06:01 2012
New Revision: 1351758
URL: http://svn.apache.org/viewvc?rev=1351758&view=rev
Log:
Clean out obsolete code.
* subversion/libsvn_ra_serf/blame.c:
(NONE, blame_info_t, push_state, create_propval, start_blame,
end_blame, cdata_blame): removed
Modified:
subversion/trunk/subversion/libsvn_ra_serf/blame.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/blame.c?rev=1351758&r1=1351757&r2=1351758&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/blame.c Tue Jun 19 16:06:01 2012
@@ -46,7 +46,6 @@
* This enum represents the current state of our XML parsing for a REPORT.
*/
typedef enum blame_state_e {
- NONE = 0,
INITIAL = 0,
FILE_REVS_REPORT,
FILE_REV,
@@ -57,42 +56,6 @@ typedef enum blame_state_e {
TXDELTA
} blame_state_e;
-#if 0
-typedef struct blame_info_t {
- /* Current pool. */
- apr_pool_t *pool;
-
- /* our suspicious file */
- const char *path;
-
- /* the intended suspect */
- svn_revnum_t rev;
-
- /* Hashtable of revision properties */
- apr_hash_t *rev_props;
-
- /* Added and removed properties (svn_prop_t*'s) */
- apr_array_header_t *prop_diffs;
-
- /* txdelta */
- svn_txdelta_window_handler_t txdelta;
- void *txdelta_baton;
-
- /* returned txdelta stream */
- svn_stream_t *stream;
-
- /* Is this property base64-encoded? */
- svn_boolean_t prop_base64;
-
- /* The currently collected value as we build it up */
- const char *prop_name;
- svn_stringbuf_t *prop_value;
-
- /* Merged revision flag */
- svn_boolean_t merged_revision;
-
-} blame_info_t;
-#endif
typedef struct blame_context_t {
/* pool passed to get_file_revs */
@@ -310,265 +273,6 @@ blame_cdata(svn_ra_serf__xml_estate_t *x
return SVN_NO_ERROR;
}
-#if 0
-
-static blame_info_t *
-push_state(svn_ra_serf__xml_parser_t *parser,
- blame_context_t *blame_ctx,
- blame_state_e state)
-{
- svn_ra_serf__xml_push_state(parser, state);
-
- if (state == FILE_REV)
- {
- blame_info_t *info;
-
- info = apr_pcalloc(parser->state->pool, sizeof(*info));
-
- info->pool = parser->state->pool;
-
- info->rev = SVN_INVALID_REVNUM;
-
- info->rev_props = apr_hash_make(info->pool);
- info->prop_diffs = apr_array_make(info->pool, 0, sizeof(svn_prop_t));
-
- info->prop_value = svn_stringbuf_create_empty(info->pool);
-
- parser->state->private = info;
- }
-
- return parser->state->private;
-}
-
-
-static const svn_string_t *
-create_propval(blame_info_t *info)
-{
- if (info->prop_base64)
- {
- const svn_string_t *morph;
-
- morph = svn_stringbuf__morph_into_string(info->prop_value);
-#ifdef SVN_DEBUG
- info->prop_value = NULL; /* morph killed the stringbuf. */
-#endif
- return svn_base64_decode_string(morph, info->pool);
- }
-
- return svn_string_create_from_buf(info->prop_value, info->pool);
-}
-
-static svn_error_t *
-start_blame(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- const char **attrs,
- apr_pool_t *scratch_pool)
-{
- blame_context_t *blame_ctx = parser->user_data;
- blame_state_e state;
-
- state = parser->state->current_state;
-
- if (state == NONE && strcmp(name.name, "file-revs-report") == 0)
- {
- push_state(parser, blame_ctx, FILE_REVS_REPORT);
- }
- else if (state == FILE_REVS_REPORT &&
- strcmp(name.name, "file-rev") == 0)
- {
- blame_info_t *info;
-
- info = push_state(parser, blame_ctx, FILE_REV);
-
- info->path = apr_pstrdup(info->pool,
- svn_xml_get_attr_value("path", attrs));
- info->rev = SVN_STR_TO_REV(svn_xml_get_attr_value("rev", attrs));
- }
- else if (state == FILE_REV)
- {
- blame_info_t *info;
- const char *enc;
-
- info = parser->state->private;
-
- if (strcmp(name.name, "rev-prop") == 0)
- {
- push_state(parser, blame_ctx, REV_PROP);
- }
- else if (strcmp(name.name, "set-prop") == 0)
- {
- push_state(parser, blame_ctx, SET_PROP);
- }
- if (strcmp(name.name, "remove-prop") == 0)
- {
- push_state(parser, blame_ctx, REMOVE_PROP);
- }
- else if (strcmp(name.name, "merged-revision") == 0)
- {
- push_state(parser, blame_ctx, MERGED_REVISION);
- }
- else if (strcmp(name.name, "txdelta") == 0)
- {
- SVN_ERR(blame_ctx->file_rev(blame_ctx->file_rev_baton,
- info->path, info->rev,
- info->rev_props, info->merged_revision,
- &info->txdelta, &info->txdelta_baton,
- info->prop_diffs, info->pool));
-
- info->stream = svn_base64_decode
- (svn_txdelta_parse_svndiff(info->txdelta, info->txdelta_baton,
- TRUE, info->pool), info->pool);
-
- push_state(parser, blame_ctx, TXDELTA);
- }
-
- state = parser->state->current_state;
-
- switch (state)
- {
- case REV_PROP:
- case SET_PROP:
- case REMOVE_PROP:
- info->prop_name = apr_pstrdup(info->pool,
- svn_xml_get_attr_value("name", attrs));
- svn_stringbuf_setempty(info->prop_value);
-
- enc = svn_xml_get_attr_value("encoding", attrs);
- if (enc && strcmp(enc, "base64") == 0)
- {
- info->prop_base64 = TRUE;
- }
- else
- {
- info->prop_base64 = FALSE;
- }
- break;
- case MERGED_REVISION:
- info->merged_revision = TRUE;
- break;
- default:
- break;
- }
- }
-
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-end_blame(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- apr_pool_t *scratch_pool)
-{
- blame_context_t *blame_ctx = parser->user_data;
- blame_state_e state;
- blame_info_t *info;
-
- state = parser->state->current_state;
- info = parser->state->private;
-
- if (state == NONE)
- {
- return SVN_NO_ERROR;
- }
-
- if (state == FILE_REVS_REPORT &&
- strcmp(name.name, "file-revs-report") == 0)
- {
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == FILE_REV &&
- strcmp(name.name, "file-rev") == 0)
- {
- /* no file changes. */
- if (!info->stream)
- {
- SVN_ERR(blame_ctx->file_rev(blame_ctx->file_rev_baton,
- info->path, info->rev,
- info->rev_props, FALSE,
- NULL, NULL,
- info->prop_diffs, info->pool));
- }
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == REV_PROP &&
- strcmp(name.name, "rev-prop") == 0)
- {
- apr_hash_set(info->rev_props,
- info->prop_name, APR_HASH_KEY_STRING,
- create_propval(info));
-
- svn_ra_serf__xml_pop_state(parser);
- }
- else if ((state == SET_PROP &&
- strcmp(name.name, "set-prop") == 0) ||
- (state == REMOVE_PROP &&
- strcmp(name.name, "remove-prop") == 0))
- {
- svn_prop_t *prop = apr_array_push(info->prop_diffs);
- prop->name = info->prop_name;
- prop->value = create_propval(info);
-
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == MERGED_REVISION &&
- strcmp(name.name, "merged-revision") == 0)
- {
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == TXDELTA &&
- strcmp(name.name, "txdelta") == 0)
- {
- SVN_ERR(svn_stream_close(info->stream));
-
- svn_ra_serf__xml_pop_state(parser);
- }
-
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-cdata_blame(svn_ra_serf__xml_parser_t *parser,
- const char *data,
- apr_size_t len,
- apr_pool_t *scratch_pool)
-{
- blame_context_t *blame_ctx = parser->user_data;
- blame_state_e state;
- blame_info_t *info;
-
- UNUSED_CTX(blame_ctx);
-
- state = parser->state->current_state;
- info = parser->state->private;
-
- if (state == NONE)
- {
- return SVN_NO_ERROR;
- }
-
- switch (state)
- {
- case REV_PROP:
- case SET_PROP:
- svn_stringbuf_appendbytes(info->prop_value, data, len);
- break;
- case TXDELTA:
- if (info->stream)
- {
- apr_size_t ret_len;
-
- ret_len = len;
-
- SVN_ERR(svn_stream_write(info->stream, data, &ret_len));
- }
- break;
- default:
- break;
- }
-
- return SVN_NO_ERROR;
-}
-#endif
/* Implements svn_ra_serf__request_body_delegate_t */
static svn_error_t *