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

Re: svn commit: r35309 - in trunk/subversion: include libsvn_fs libsvn_fs_base/bdb libsvn_fs_fs

From: David Glasser <glasser_at_davidglasser.net>
Date: Sun, 18 Jan 2009 22:32:56 -0500

On Sat, Jan 17, 2009 at 8:42 PM, Bert Huijben <rhuijben_at_sharpsvn.net> wrote:
> Author: rhuijben
> Date: Sat Jan 17 17:42:15 2009
> New Revision: 35309
>
> Log:
> Following up on r35253, make the svn_fs_path_change2_t type future extensible
> by adding a constructor function.
>
> * subversion/include/svn_fs.h
> (svn_fs_path_change2_t): Document as future extensible.
> (svn_fs_path_change2_create): New function.
> * subversion/libsvn_fs/util.c: Add new file
> (svn_fs_path_change2_create): Implement constructor.
> * subversion/libsvn_fs_base/bdb/changes-table.c
> (fold_change): Use svn_fs_path_change2_create to create
> svn_fs_path_change2_t.
> * subversion/libsvn_fs_fs/fs_fs.c
> (svn_fs_fs__add_change): Use svn_fs_path_change2_create to create
> svn_fs_path_change2_t.
>
> Added:
> trunk/subversion/libsvn_fs/util.c (contents, props changed)
> Modified:
> trunk/subversion/include/svn_fs.h
> trunk/subversion/libsvn_fs_base/bdb/changes-table.c
> trunk/subversion/libsvn_fs_fs/fs_fs.c
>
> Modified: trunk/subversion/include/svn_fs.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_fs.h?pathrev=35309&r1=35308&r2=35309
> ==============================================================================
> --- trunk/subversion/include/svn_fs.h Sat Jan 17 17:00:25 2009 (r35308)
> +++ trunk/subversion/include/svn_fs.h Sat Jan 17 17:42:15 2009 (r35309)
> @@ -1047,6 +1047,10 @@ typedef enum
>
> /** Change descriptor.
> *
> + * @note Fields may be added to the end of this structure in future
> + * versions. Therefore, to preserve binary compatibility, users
> + * should not directly allocate structures of this type.
> + *
> * @since New in 1.6. */
> typedef struct svn_fs_path_change2_t
> {
> @@ -1072,6 +1076,8 @@ typedef struct svn_fs_path_change2_t
> svn_revnum_t copyfrom_rev;
> const char *copyfrom_path;
>
> + /* NOTE! Please update svn_fs_path_change2_dup() when adding new
> + fields here. */

Does this exist?

--dave

> } svn_fs_path_change2_t;
>
>
> @@ -1097,6 +1103,20 @@ typedef struct svn_fs_path_change_t
>
> } svn_fs_path_change_t;
>
> +/**
> + * Allocate an @c svn_fs_path_change2_t structure in @a pool, initialize and
> + * return it.
> + *
> + * Set the @c node_rev_id field of the created struct to @a node_rev_id, and
> + * @c change_kind to @a change_kind. Set all other fields to their
> + * @c _unknown, @c NULL or invalid value, respectively.
> + *
> + * @since New in 1.6.
> + */
> +svn_fs_path_change2_t *
> +svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
> + svn_fs_path_change_kind_t change_kind,
> + apr_pool_t *pool);
>
> /** Determine what has changed under a @a root.
> *
>
> Added: trunk/subversion/libsvn_fs/util.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs/util.c?pathrev=35309
> ==============================================================================
> --- /dev/null 00:00:00 1970 (empty, because file is newly added)
> +++ trunk/subversion/libsvn_fs/util.c Sat Jan 17 17:42:15 2009 (r35309)
> @@ -0,0 +1,34 @@
> +/*
> + * util.c: FS utility routines
> + *
> + * ====================================================================
> + * Copyright (c) 2009 CollabNet. All rights reserved.
> + *
> + * This software is licensed as described in the file COPYING, which
> + * you should have received as part of this distribution. The terms
> + * are also available at http://subversion.tigris.org/license-1.html.
> + * If newer versions of this license are posted there, you may use a
> + * newer version instead, at your option.
> + *
> + * This software consists of voluntary contributions made by many
> + * individuals. For exact contribution history, see the revision
> + * history and logs, available at http://subversion.tigris.org/.
> + * ====================================================================
> + */
> +
> +#include <apr_pools.h>
> +#include "svn_fs.h"
> +
> +svn_fs_path_change2_t *
> +svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
> + svn_fs_path_change_kind_t change_kind,
> + apr_pool_t *pool)
> +{
> + svn_fs_path_change2_t *change;
> +
> + change = apr_pcalloc(pool, sizeof(*change));
> + change->node_rev_id = node_rev_id;
> + change->change_kind = change_kind;
> +
> + return change;
> +}
>
> Modified: trunk/subversion/libsvn_fs_base/bdb/changes-table.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_base/bdb/changes-table.c?pathrev=35309&r1=35308&r2=35309
> ==============================================================================
> --- trunk/subversion/libsvn_fs_base/bdb/changes-table.c Sat Jan 17 17:00:25 2009 (r35308)
> +++ trunk/subversion/libsvn_fs_base/bdb/changes-table.c Sat Jan 17 17:42:15 2009 (r35309)
> @@ -217,10 +217,10 @@ fold_change(apr_hash_t *changes,
> /* This change is new to the hash, so make a new public change
> structure from the internal one (in the hash's pool), and dup
> the path into the hash's pool, too. */
> - new_change = apr_pcalloc(pool, sizeof(*new_change));
> - new_change->node_rev_id = svn_fs_base__id_copy(change->noderev_id,
> - pool);
> - new_change->change_kind = change->kind;
> + new_change = svn_fs_path_change2_create(
> + svn_fs_base__id_copy(change->noderev_id, pool),
> + change->kind,
> + pool);
> new_change->text_mod = change->text_mod;
> new_change->prop_mod = change->prop_mod;
> new_change->node_kind = svn_node_unknown;
>
> Modified: trunk/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_fs/fs_fs.c?pathrev=35309&r1=35308&r2=35309
> ==============================================================================
> --- trunk/subversion/libsvn_fs_fs/fs_fs.c Sat Jan 17 17:00:25 2009 (r35308)
> +++ trunk/subversion/libsvn_fs_fs/fs_fs.c Sat Jan 17 17:42:15 2009 (r35309)
> @@ -4742,14 +4742,13 @@ svn_fs_fs__add_change(svn_fs_t *fs,
> apr_pool_t *pool)
> {
> apr_file_t *file;
> - svn_fs_path_change2_t *change = apr_pcalloc(pool, sizeof(*change));
> + svn_fs_path_change2_t *change;
>
> SVN_ERR(svn_io_file_open(&file, path_txn_changes(fs, txn_id, pool),
> APR_APPEND | APR_WRITE | APR_CREATE
> | APR_BUFFERED, APR_OS_DEFAULT, pool));
>
> - change->node_rev_id = id;
> - change->change_kind = change_kind;
> + change = svn_fs_path_change2_create(id, change_kind, pool);
> change->text_mod = text_mod;
> change->prop_mod = prop_mod;
> change->node_kind = node_kind;
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1031665
>

-- 
glasser_at_davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/
Received on 2009-01-19 04:33:16 CET

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.