You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Näslund <da...@longitudo.com> on 2009/09/11 08:00:38 UTC

[PATCH] replace adm_access batons in libsvn_client/patch.c

Hi!

Bert told me that I needed to open an adm_access baton before calling
svn_wc_delete4() or svn_wc_add4() and so I've done. I added a comment
saying that those batons can be removed at a later stage. Perhaps I
should use the ## notation that I've found in other part of the wc code? 
I wasn't sure if they should only be used to discuss design descissions
so I did't use them. 

The absolute paths is set in resolve_target_path(), hence I've removed
the call to svn_dirent_get_absolute() in svn_client_patch(). Perhaps a
follow-up patch can set the abspath only in svn_client_patch().

[[[
As part of WC-NG work, replace adm_access batons.

* subversion/libsvn_client/patch.c
  (init_patch_target): Replace adm_access parameter with path parameter.
    Call resolve_target_path() with path instead of accessing the path
    through the baton.
  (apply_one_patch): Remove adm_access parameter. Call
    init_patch_target() without adm_access. Replace call to
    svn_wc_add3() with svn_wc_add4(). Replace call to svn_wc_delete3()
    with svn_wc_delete4(). Open a write access baton before each call to
    the wc-functions. Currently this baton is retrieved internally by
    them. 
  (apply_textdiffs): Remove adm_access parameter. Call apply_one_patch()
    without adm_access.
  (svn_client_patch): Do not open a adm_access baton. Call
    apply_textdiffs() without adm_access.
]]]

/Daniel Näslund

Sorry about the mime-type. Still problems with mutt and tigris.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2393555

[PATCH] v2. replace adm_access batons in libsvn_client/patch.c

Posted by Daniel Näslund <da...@longitudo.com>.
On Fri, Sep 11, 2009 at 12:04:04PM +0200, Bert Huijben wrote:
> > Hi!
> > 
> > Bert told me that I needed to open an adm_access baton before calling
> > svn_wc_delete4() or svn_wc_add4() and so I've done. I added a comment
> > saying that those batons can be removed at a later stage. Perhaps I
> > should use the ## notation that I've found in other part of the wc
> > code?
> >
> > I wasn't sure if they should only be used to discuss design decisions
> > so I did't use them.
> 
> The primary recursive open of an access baton in svn_client_patch
> should be enough to make things work correctly. You don't need the
> other open operations at every delete/add. The access batons are then
> stored in the working copy context.
> 
> @@ -1109,17 +1130,7 @@
>                   svn_client_ctx_t *ctx,
>                   apr_pool_t *pool)
>  {
> -  svn_wc_adm_access_t *adm_access;
> -  const char *abs_target;
> +  SVN_ERR(apply_textdiffs(patch_path, target, dry_run, ctx, pool));
>  
> -  SVN_ERR(svn_dirent_get_absolute(&abs_target, target, pool));
> -  SVN_ERR(svn_wc__adm_open_in_context(&adm_access, ctx->wc_ctx, abs_target,
> -                                      TRUE, -1, ctx->cancel_func,
> -                                      ctx->cancel_baton, pool));
> -
> -  SVN_ERR(apply_textdiffs(patch_path, target, adm_access, dry_run, ctx, pool));
> -
> -  SVN_ERR(svn_wc_adm_close2(adm_access, pool));
> -
>    return SVN_NO_ERROR;
>  }
> 
> If you revert this change (without the apply_textdiffs change) you can
> forget all the other svn_wc__adm_open_in_context calls.
> 
> 
> 	Bert

Ok. I got the impression that the baton would get closed after each call
to svn_wc_add() or svn_wc_delete(). Obviously that was wrong cause it
works alright with your proposed changes.

I've run the patch_tests.py on this patch but not the entire test suite.
I suppose that is alright since svn patch is a new feature. 

New log message:

[[[
As part of WC-NG work, replace adm_access batons.

* subversion/libsvn_client/patch.c
  (init_patch_target): Replace adm_access parameter with path parameter.
    Call resolve_target_path() with path instead of accessing the path
    through the baton.
  (apply_one_patch): Remove adm_access parameter. Call
    init_patch_target() without adm_access. Replace call to
    svn_wc_add3() with svn_wc_add4(). Replace call to svn_wc_delete3()
    with svn_wc_delete4(). 
  (apply_textdiffs): Remove adm_access parameter. Call apply_one_patch()
    without adm_access.
  (svn_client_patch):  Call apply_textdiffs() without adm_access.
]]]

Daniel Näslund

RE: [PATCH] replace adm_access batons in libsvn_client/patch.c

Posted by Bert Huijben <rh...@sharpsvn.net>.
> -----Original Message-----
> From: Daniel Näslund [mailto:daniel@longitudo.com]
> Sent: vrijdag 11 september 2009 10:01
> To: dev@subversion.tigris.org
> Cc: stsp@stsp.name
> Subject: [PATCH] replace adm_access batons in libsvn_client/patch.c
> 
> Hi!
> 
> Bert told me that I needed to open an adm_access baton before calling
> svn_wc_delete4() or svn_wc_add4() and so I've done. I added a comment
> saying that those batons can be removed at a later stage. Perhaps I
> should use the ## notation that I've found in other part of the wc
> code?
>
> I wasn't sure if they should only be used to discuss design decisions
> so I did't use them.

The primary recursive open of an access baton in svn_client_patch should be enough to make things work correctly. You don't need the other open operations at every delete/add. The access batons are then stored in the working copy context.

@@ -1109,17 +1130,7 @@
                  svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
 {
-  svn_wc_adm_access_t *adm_access;
-  const char *abs_target;
+  SVN_ERR(apply_textdiffs(patch_path, target, dry_run, ctx, pool));
 
-  SVN_ERR(svn_dirent_get_absolute(&abs_target, target, pool));
-  SVN_ERR(svn_wc__adm_open_in_context(&adm_access, ctx->wc_ctx, abs_target,
-                                      TRUE, -1, ctx->cancel_func,
-                                      ctx->cancel_baton, pool));
-
-  SVN_ERR(apply_textdiffs(patch_path, target, adm_access, dry_run, ctx, pool));
-
-  SVN_ERR(svn_wc_adm_close2(adm_access, pool));
-
   return SVN_NO_ERROR;
 }

If you revert this change (without the apply_textdiffs change) you can forget all the other svn_wc__adm_open_in_context calls.


	Bert

> 
> The absolute paths is set in resolve_target_path(), hence I've removed
> the call to svn_dirent_get_absolute() in svn_client_patch(). Perhaps a
> follow-up patch can set the abspath only in svn_client_patch().
> 
> [[[
> As part of WC-NG work, replace adm_access batons.
> 
> * subversion/libsvn_client/patch.c
>   (init_patch_target): Replace adm_access parameter with path
> parameter.
>     Call resolve_target_path() with path instead of accessing the path
>     through the baton.
>   (apply_one_patch): Remove adm_access parameter. Call
>     init_patch_target() without adm_access. Replace call to
>     svn_wc_add3() with svn_wc_add4(). Replace call to svn_wc_delete3()
>     with svn_wc_delete4(). Open a write access baton before each call
> to
>     the wc-functions. Currently this baton is retrieved internally by
>     them.
>   (apply_textdiffs): Remove adm_access parameter. Call
> apply_one_patch()
>     without adm_access.
>   (svn_client_patch): Do not open a adm_access baton. Call
>     apply_textdiffs() without adm_access.
> ]]]
> 
> /Daniel Näslund
> 
> Sorry about the mime-type. Still problems with mutt and tigris.
> 
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageI
> d=2393555

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2393579