You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/04/15 16:19:35 UTC
svn commit: r1092714 - in /subversion/trunk/subversion/svnrdump:
dump_editor.c svnrdump.c svnrdump.h util.c
Author: hwright
Date: Fri Apr 15 14:19:34 2011
New Revision: 1092714
URL: http://svn.apache.org/viewvc?rev=1092714&view=rev
Log:
Some code reorganization in svnrdump. This commit adds a couple of files, and
moves a utility function to one of them. It also renames this function to
give it the proper prefix.
* subversion/svnrdump/svnrdump.c
(replay_revstart): Update caller.
* subversion/svnrdump/svnrdump.h:
New.
* subversion/svnrdump/dump_editor.c
(normalize_props): Remove.
(do_dump_props): Update caller.
* subversion/svnrdump/util.c:
New.
Added:
subversion/trunk/subversion/svnrdump/svnrdump.h (with props)
subversion/trunk/subversion/svnrdump/util.c (with props)
Modified:
subversion/trunk/subversion/svnrdump/dump_editor.c
subversion/trunk/subversion/svnrdump/svnrdump.c
Modified: subversion/trunk/subversion/svnrdump/dump_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/dump_editor.c?rev=1092714&r1=1092713&r2=1092714&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/dump_editor.c (original)
+++ subversion/trunk/subversion/svnrdump/dump_editor.c Fri Apr 15 14:19:34 2011
@@ -34,6 +34,8 @@
#include "dump_editor.h"
+#include "svnrdump.h"
+
#define ARE_VALID_COPY_ARGS(p,r) ((p) && SVN_IS_VALID_REVNUM(r))
#if 0
@@ -77,36 +79,6 @@ struct dump_edit_baton {
svn_boolean_t dump_newlines;
};
-/* Normalize the line ending style of the values of properties in PROPS
- * that "need translation" (according to svn_prop_needs_translation(),
- * currently all svn:* props) so that they contain only LF (\n) line endings.
- */
-svn_error_t *
-normalize_props(apr_hash_t *props,
- apr_pool_t *pool)
-{
- apr_hash_index_t *hi;
-
- for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
- {
- const char *key = svn__apr_hash_index_key(hi);
- const svn_string_t *value = svn__apr_hash_index_val(hi);
-
- if (svn_prop_needs_translation(key))
- {
- const char *cstring;
-
- SVN_ERR(svn_subst_translate_cstring2(value->data, &cstring,
- "\n", TRUE,
- NULL, FALSE,
- pool));
- value = svn_string_create(cstring, pool);
- apr_hash_set(props, key, APR_HASH_KEY_STRING, value);
- }
- }
- return SVN_NO_ERROR;
-}
-
/* Make a directory baton to represent the directory at PATH (relative
* to the EDIT_BATON).
*
@@ -174,7 +146,7 @@ do_dump_props(struct dump_edit_baton *eb
if (trigger_var && !*trigger_var)
return SVN_NO_ERROR;
- SVN_ERR(normalize_props(eb->props, eb->pool));
+ SVN_ERR(svn_rdump__normalize_props(eb->props, eb->pool));
svn_stringbuf_setempty(eb->propstring);
propstream = svn_stream_from_stringbuf(eb->propstring, eb->pool);
SVN_ERR(svn_hash_write_incremental(eb->props, eb->deleted_props,
Modified: subversion/trunk/subversion/svnrdump/svnrdump.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.c?rev=1092714&r1=1092713&r2=1092714&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.c (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.c Fri Apr 15 14:19:34 2011
@@ -189,7 +189,7 @@ replay_revstart(svn_revnum_t revision,
SVN_ERR(svn_stream_printf(stdout_stream, pool,
SVN_REPOS_DUMPFILE_REVISION_NUMBER
": %ld\n", revision));
- SVN_ERR(normalize_props(rev_props, pool));
+ SVN_ERR(svn_rdump__normalize_props(rev_props, pool));
propstring = svn_stringbuf_create_ensure(0, pool);
revprop_stream = svn_stream_from_stringbuf(propstring, pool);
SVN_ERR(svn_hash_write2(rev_props, revprop_stream, "PROPS-END", pool));
Added: subversion/trunk/subversion/svnrdump/svnrdump.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.h?rev=1092714&view=auto
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.h (added)
+++ subversion/trunk/subversion/svnrdump/svnrdump.h Fri Apr 15 14:19:34 2011
@@ -0,0 +1,50 @@
+/*
+ * svnrdump.h: Internal header file for svnrdump.
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+
+#ifndef SVNRDUMP_H
+#define SVNRDUMP_H
+
+/*** Includes. ***/
+#include "svn_error.h"
+#include "svn_pools.h"
+#include "svn_hash.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* Normalize the line ending style of the values of properties in PROPS
+ * that "need translation" (according to svn_prop_needs_translation(),
+ * currently all svn:* props) so that they contain only LF (\n) line endings.
+ */
+svn_error_t *
+svn_rdump__normalize_props(apr_hash_t *props,
+ apr_pool_t *pool);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SVNRDUMP_H */
Propchange: subversion/trunk/subversion/svnrdump/svnrdump.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: subversion/trunk/subversion/svnrdump/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/util.c?rev=1092714&view=auto
==============================================================================
--- subversion/trunk/subversion/svnrdump/util.c (added)
+++ subversion/trunk/subversion/svnrdump/util.c Fri Apr 15 14:19:34 2011
@@ -0,0 +1,61 @@
+/*
+ * util.c: A few utility functions.
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#include "svn_error.h"
+#include "svn_pools.h"
+#include "svn_string.h"
+#include "svn_props.h"
+#include "svn_subst.h"
+
+#include "svnrdump.h"
+
+
+/* Normalize the line ending style of the values of properties in PROPS
+ * that "need translation" (according to svn_prop_needs_translation(),
+ * currently all svn:* props) so that they contain only LF (\n) line endings.
+ */
+svn_error_t *
+svn_rdump__normalize_props(apr_hash_t *props,
+ apr_pool_t *pool)
+{
+ apr_hash_index_t *hi;
+
+ for (hi = apr_hash_first(pool, props); hi; hi = apr_hash_next(hi))
+ {
+ const char *key = svn__apr_hash_index_key(hi);
+ const svn_string_t *value = svn__apr_hash_index_val(hi);
+
+ if (svn_prop_needs_translation(key))
+ {
+ const char *cstring;
+
+ SVN_ERR(svn_subst_translate_cstring2(value->data, &cstring,
+ "\n", TRUE,
+ NULL, FALSE,
+ pool));
+ value = svn_string_create(cstring, pool);
+ apr_hash_set(props, key, APR_HASH_KEY_STRING, value);
+ }
+ }
+ return SVN_NO_ERROR;
+}
Propchange: subversion/trunk/subversion/svnrdump/util.c
------------------------------------------------------------------------------
svn:eol-style = native