You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2001/04/24 23:28:36 UTC

Re: CVS update: subversion/subversion/tests/libsvn_repos repos-test.c

On Mon, Apr 23, 2001 at 02:43:32PM -0000, cmpilato@tigris.org wrote:
>...
>   +   The caller must call editor->close_edit on EDIT_BATON;
>   +   svn_fs_dir_delta does not close the edit itself.
>   +
>   +   Do any allocation necessary for the delta computation in POOL.
>   +   This function's maximum memory consumption is at most roughly
>   +   proportional to the greatest depth of SOURCE_PATH under
>   +   TARGET_ROOT, not the total size of the delta.  */
>   +svn_error_t *
>   +svn_repos_update (svn_fs_root_t *target_root,
>   +                  svn_fs_root_t *source_root,
>   +                  svn_string_t *parent_dir,
>   +                  svn_string_t *entry,
>   +                  apr_hash_t *source_rev_diffs,
>   +                  const svn_delta_edit_fns_t *editor,
>   +                  void *edit_baton,
>   +                  apr_pool_t *pool);

I don't understand the rationale for this function. Why do we have it, and
what is the key difference from svn_repos_dir_delta? Can that be clarified
in the documentation? They both seem to do the same thing, but with slightly
different arguments.

And *WHAT* is the reason for neither of them calling close_edit? Both of
them call set_target_revision and replace_root, so why not close_edit? It is
a pain in the butt for users of these functions to never touch the editor
*except* to have to go and clean up after the function, using a close_edit.
Why?

>...
>   --- merge.c	2001/04/18 14:03:45	1.6
>   +++ merge.c	2001/04/23 14:43:31	1.7
>   @@ -402,9 +402,12 @@
>      mrc.root = committed_root;
>      mrc.repos = repos;
>    
>   -  serr = svn_repos_dir_delta(previous_root, "/", revs,
>   -                             committed_root, "/",
>   +  serr = svn_repos_dir_delta(previous_root, 
>   +                             svn_string_create ("/", pool), revs,
>   +                             committed_root, 
>   +                             svn_string_create ("/", pool),
>                                 editor, &mrc, pool);

I created a utility variable to hold a single "/" string here, rather than
needing to create two. Also, careful on the style (spaces).

Further, this whole thing for creating an svn_string_t for a *CONSTANT* is
*really* started to peeve me. The darned function isn't going to do any
modification of the string, so why use an svn_string_t?

I really think we need to reconsider our use of svn_string_t everywhere. It
is kind of silly to use it for constants. In many cases, we're just wrapping
these darn constants in the svn_string_t header plus copying the value
again. That is a lot less efficient than the occasional strlen().

The number of places where I need to do svn_string_create because of some
dumb API, when I *know* it doesn't need the svn_string_t memory buffering
gunk is growing, and is becoming somewhat silly.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: CVS update: subversion/subversion/tests/libsvn_repos repos-test.c

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Apr 25, 2001 at 02:22:20PM -0500, Ben Collins-Sussman wrote:
> cmpilato@collab.net writes:
> 
> > Greg Stein <gs...@lyra.org> writes:
> > 
> > > Is dir_delta obsolete? Does repos_update handle both dirs and files? If not,
> > > then can we make it so?
> > 
> > Yes and no.  I mean, everything that *we* want to do with dir_delta
> > can be done with repos_update.  But Jim expressed concern that being
> > able to describe the differences between any 2 arbitrary filesystem
> > directories might be useful to someone else using the FS interface.
> 
> For example, when we want to merge a branch dir into a trunk dir
> someday.  Very useful.

Right!

Or simply when you've made a copy and want to compare the two lines of
development.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: CVS update: subversion/subversion/tests/libsvn_repos repos-test.c

Posted by Ben Collins-Sussman <su...@collab.net>.
cmpilato@collab.net writes:

> Greg Stein <gs...@lyra.org> writes:
> 
> > Is dir_delta obsolete? Does repos_update handle both dirs and files? If not,
> > then can we make it so?
> 
> Yes and no.  I mean, everything that *we* want to do with dir_delta
> can be done with repos_update.  But Jim expressed concern that being
> able to describe the differences between any 2 arbitrary filesystem
> directories might be useful to someone else using the FS interface.

For example, when we want to merge a branch dir into a trunk dir
someday.  Very useful.

Re: CVS update: subversion/subversion/tests/libsvn_repos repos-test.c

Posted by cm...@collab.net.
Greg Stein <gs...@lyra.org> writes:

> Is dir_delta obsolete? Does repos_update handle both dirs and files? If not,
> then can we make it so?

Yes and no.  I mean, everything that *we* want to do with dir_delta
can be done with repos_update.  But Jim expressed concern that being
able to describe the differences between any 2 arbitrary filesystem
directories might be useful to someone else using the FS interface.

Note that repos_update uses the same path, just under two different
roots.  To fully combine these two functions into one, I think
repos_update would need to lose the PARENT_DIR and ENTRY arguments,
and gain SOURCE_PARENT_DIR, SOURCE_ENTRY, TARGET_PARENT_DIR, and
TARGET_ENTRY arguments.  Which is fine, if that's what is necessary.
But it's not really a high priority for me right now, since I know
both users of the filesystem code, and they don't need this
functionality.  :-)

> > Perhaps I should put all that in svn_repos.h ?
> 
> Please. Your description is great, but that information certainly wasn't
> "extractable" in any easy form from the header. When somebody needs to build
> code, and needs to choose an API, then the guidance will be helpful.

Yessir.

> All righty. Let's say that close_edit will go into dir_delta unless Jim (or
> anybody else) can explain why it shouldn't.

Sounds good to me.

Re: CVS update: subversion/subversion/tests/libsvn_repos repos-test.c

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Apr 25, 2001 at 09:19:02AM -0500, cmpilato@collab.net wrote:
> Greg Stein <gs...@lyra.org> writes:
> 
> > I don't understand the rationale for this function.
> 
> Rationale?  Is that a prerequisite for code submission? :-)

No :-) ... I should have used the word "requirement" ... i.e. how / where
does it get used. Which you explained wonderfully.

>...
> So, what I really need is a way to say, "Mr. Update Editor Driver, I
> want you to have full knowledge of the directory A/D, but I need you
> promise to only pay attention to the entry G in that directory."
> 
> And svn_repos_update complies.

Is dir_delta obsolete? Does repos_update handle both dirs and files? If not,
then can we make it so?

[ they are just *so* close, it is a shame to have two APIs which only
  slightly vary, in non-obvious ways ]

> Perhaps I should put all that in svn_repos.h ?

Please. Your description is great, but that information certainly wasn't
"extractable" in any easy form from the header. When somebody needs to build
code, and needs to choose an API, then the guidance will be helpful.

> > And *WHAT* is the reason for neither of them calling close_edit? Both of
> > them call set_target_revision and replace_root, so why not close_edit? It is
> > a pain in the butt for users of these functions to never touch the editor
> > *except* to have to go and clean up after the function, using a close_edit.
> > Why?
> 
> Umm...Jim?

All righty. Let's say that close_edit will go into dir_delta unless Jim (or
anybody else) can explain why it shouldn't.

>...
> > Further, this whole thing for creating an svn_string_t for a *CONSTANT* is
> > *really* started to peeve me. The darned function isn't going to do any
> > modification of the string, so why use an svn_string_t?
> 
> <snip svn_string_t micro-rant>
> 
> I have no complaints with an svn_string_t review occurring in the
> future, but right now my primary concern is to make the stuff work.
> When Subversion is in such shape that I feel I can spare more time to
> debatable stylistic issues, perhaps I'll do the review myself.  Anyone
> else wishing to perform such a review right now is welcome to do so.
> 
> Me?  I'm plugging away toward a golden one-point-oh.

No problem. That part wasn't directed at you :-)

I just want to bring it up occasionally, and especially when it gets in the
way sometimes. Keep it in people's heads. As with you, when we have a bit of
breathing room, I'll want to do a review, too. (of course, that presumes an
acceptance for using "const char *" in some places)

The obvious problem is using svn_string_t in some places, and const char *
in others. Consistency can be good sometimes.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: CVS update: subversion/subversion/tests/libsvn_repos repos-test.c

Posted by cm...@collab.net.
Greg Stein <gs...@lyra.org> writes:

> I don't understand the rationale for this function.

Rationale?  Is that a prerequisite for code submission? :-)

> Why do we have it, and what is the key difference from
> svn_repos_dir_delta?  Can that be clarified in the documentation?

svn_repos_update exist because of the following situation:

Say I have a Greek Tree at revision 1 in my working copy.  I type `svn
up A/mu'.  svn_repos_dir_delta doesn't know what to do with files--it
only takes directory args.  svn_repos_update, on the other hand, can
handle this.  

Now, take the dir case.  Let's say that someone has removed the
directory A/D/G and added a new file A/D/G.  I type `svn up A/D/G.'
Once again, svn_repos_dir_delta would croak because it isn't looking
at two directories.  

"So, why don't you just do the delta from one level higher," you might
be tempted to say.  

"Fine," I reply, "but that means that everthing in A/D gets
updated...this is NOT what I requested."

So, what I really need is a way to say, "Mr. Update Editor Driver, I
want you to have full knowledge of the directory A/D, but I need you
promise to only pay attention to the entry G in that directory."

And svn_repos_update complies.

Perhaps I should put all that in svn_repos.h ?

> And *WHAT* is the reason for neither of them calling close_edit? Both of
> them call set_target_revision and replace_root, so why not close_edit? It is
> a pain in the butt for users of these functions to never touch the editor
> *except* to have to go and clean up after the function, using a close_edit.
> Why?

Umm...Jim?  This was in the docstring for svn_repos_dir_delta well
before I re-wrote them--I have no idea what the original designer's
intent was.  Personally, I'd like to see this function call
close_edit...it seems weird to have the whole editor drive
encapsulated, except (and there's the crux of the matter, that pesky
word 'except') the cleanup.  As long as we have the
you-can't-call-multiple-replace-roots rule, it's not as though the
caller could actually do anything interesting with the editor between
the calls to svn_repos_update and the close_edit call.

> I created a utility variable to hold a single "/" string here, rather than
> needing to create two. Also, careful on the style (spaces).

Oops.  Sorry.

> Further, this whole thing for creating an svn_string_t for a *CONSTANT* is
> *really* started to peeve me. The darned function isn't going to do any
> modification of the string, so why use an svn_string_t?

<snip svn_string_t micro-rant>

I have no complaints with an svn_string_t review occurring in the
future, but right now my primary concern is to make the stuff work.
When Subversion is in such shape that I feel I can spare more time to
debatable stylistic issues, perhaps I'll do the review myself.  Anyone
else wishing to perform such a review right now is welcome to do so.

Me?  I'm plugging away toward a golden one-point-oh.