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

[PATCH] v3. replace alls svn_wc_entry() in libsvn_client/patch.c

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Wed, 19 Aug 2009 16:14:27 +0200

On Tue, Aug 18, 2009 at 12:17:30PM -0500, Hyrum K. Wright wrote:
> On Aug 18, 2009, at 12:12 PM, Julian Foad wrote:
> > Replacing one line of code with a long block, eight times
> > over, cannot be a good thing. Can you make a replacement function that
> > does exactly what we need in one line, and so avoid this code bloat?
> > Even a local helper function in this file would be an improvement,
> > but I
> > assume this same pattern will be repeated in many files so a new
> > svn_wc__... function would be best.
> My inner self is saying the same thing here.
> svn_wc__get_entry_versioned() was intentioned to replace
> svn_wc__entry_versioned(), and we've found a few places where we can
> get away with using it in place of svn_wc_entry(), but a modified
> helper would be nice at this point.

My bad. I was assumning that since this was a temporary solution I could
get away with a long nasty repeating block of code.

I call the new function svn_wc__maybe_get_entry(). I guess I've seen
better names but I couldn't come up with anything else!

> >> [[[
> >> Replaced svn_wc_entry() with svn_wc__get_entry_versioned(). Catch
> >> SVN_ERR_ENTRY_NOT_FOUND since it is not expected.
> >
> > I know you know why you're doing this, but tell us in the log message:
> >
> > As part of getting rid of adm_access batons for WC-NG, replace
> > some calls to svn_wc_entry() with svn_wc__get_entry_versioned().
> >

Point taken. Trying this instead:

As part of getting rid of adm_access batons for WC-NG, replace some
calls to svn_wc_entry() with svn_wc__maybe_get_entry().

* subversion/include/private/svn_wc_private.h
  (svn_wc__maybe_get_entry): Declare.

* subversion/libsvn_wc/entries.c
  (svn_wc__maybe_get_entry): New. Wrapper for
    svn_wc__get_entry_versioned() with error and return semantics like

* subversion/libsvn_client/patch.c
  (merge_file_changed, merge_file_added, merge_file_deleted,
  merge_dir_added, init_patch_target): Replaced svn_wc_entry() with
    svn_wc__maybe_get_entry(). Use absolute paths.

Two test failures (also on trunk):
switch_tests 18 21


Received on 2009-08-19 16:15:50 CEST

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.