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

[PATCH] commit.c suggestion

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2006-10-19 03:40:57 CEST

I haven't time to test the attached patch, so I'm using our mailing list
as one-level version control. I've essentially done what Asbjørn has
done, except that I use some different naming, and I have full_path
passed into the dir_baton generator instead of calculated (again) by
that function.

Asbjørn Pettersen wrote:
> Found some "copy&paste" code in /libsvn_repos/commit.c
> Made one new function, called newdirb() replacing 2 code blocks
>
> My suggestion:
>
> static svn_error_t *newdirb(const char *path,
> const void *parent_baton,
> const svn_boolean_t was_copied,
> const svn_revnum_t base_revision,
> apr_pool_t *pool,
> void **child_baton)
> {
> struct dir_baton *new_dirb;
> struct dir_baton *pb = (struct dir_baton *)parent_baton;
> struct edit_baton *eb = pb->edit_baton;
> const char *full_path = svn_path_join(eb->base_path, path, pool);
>
>
> /* Build a new dir baton for this directory */
> new_dirb = apr_pcalloc(pool, sizeof(*new_dirb));
> new_dirb->edit_baton = eb;
> new_dirb->parent = pb;
> new_dirb->pool = pool;
> new_dirb->path = full_path;
> new_dirb->was_copied = was_copied;
> new_dirb->base_rev = base_revision;
>
> *child_baton = new_dirb;
> return SVN_NO_ERROR;
> }
>
> ----------------------------------------------
>
> add_directory()
> {
> ..
> #if 1
> return (newdirb(path, parent_baton, was_copied, SVN_INVALID_REVNUM,
> pool, child_baton));
> #else
> /* Build a new dir baton for this directory. */
> new_dirb = apr_pcalloc(pool, sizeof(*new_dirb));
> new_dirb->edit_baton = eb;
> new_dirb->parent = pb;
> new_dirb->pool = pool;
> new_dirb->path = full_path;
> new_dirb->was_copied = was_copied;
> new_dirb->base_rev = SVN_INVALID_REVNUM;
>
> *child_baton = new_dirb;
>
> return SVN_NO_ERROR;
> #endif
> }
>
> open_directory()
> {
> ...
> #if 1
> return (newdirb(path, parent_baton, pb->was_copied, base_revision,
> pool, child_baton));
> #else
> /* Build a new dir baton for this directory */
> new_dirb = apr_pcalloc(pool, sizeof(*new_dirb));
> new_dirb->edit_baton = eb;
> new_dirb->parent = pb;
> new_dirb->pool = pool;
> new_dirb->path = full_path;
> new_dirb->was_copied = pb->was_copied;
> new_dirb->base_rev = base_revision;
>
> *child_baton = new_dirb;
>
> return SVN_NO_ERROR;
> #endif
> }
>
>

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Thu Oct 19 03:41:26 2006

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