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

[PATCH] remove redundant code

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2007-04-05 16:04:38 CEST

Hi All,
In merge-cmd.c for rev_range_syntax style of merges we populate
peg_revision with default values.

This causes merge of the kind,
svn merge -r5:6 file:///path/to/repo/path1/path2 to always call
svn_client_merge_peg3 with a peg_revision which is either
'svn_opt_revision_head' or 'svn_opt_revision_working'.

This causes subversion/libsvn_client/merge.c:do_merge to make a
redundant call to resolve the same via 'svn_client__repos_locations'.

<snip from do_merge>
  if (peg_revision->kind != svn_opt_revision_unspecified)
    {
      SVN_ERR(svn_client__repos_locations(&URL1, &revision1,
                                          &URL2, &revision2,
                                          NULL,
                                          initial_path2 ? initial_path2
                                          : initial_URL2,
                                          peg_revision,
                                          initial_revision1,
                                          initial_revision2,
                                          ctx, pool));

      merge_b->url = URL2;
      path1 = NULL;
      path2 = NULL;
      merge_b->path = NULL;
    }
</snip>

We can avoid this redundant call with this patch.

I ran testsuite with and without this patch over ra_local/ra_svn/ra_dav
it works fine.

With regards
Kamesh Jayachandran

[[[
Remove redundant code.

* subversion/svn/merge-cmd.c
   (svn_cl__merge):
    No need to set default peg_revision.
    
Patch by: kameshj
]]]

Index: subversion/svn/merge-cmd.c
===================================================================
--- subversion/svn/merge-cmd.c (revision 24447)
+++ subversion/svn/merge-cmd.c (working copy)
@@ -77,11 +77,6 @@
                                  pool));
       sourcepath2 = sourcepath1;
 
- /* Set the default peg revision if one was not specified. */
- if (peg_revision.kind == svn_opt_revision_unspecified)
- peg_revision.kind = svn_path_is_url(sourcepath1)
- ? svn_opt_revision_head : svn_opt_revision_working;
-
       /* decide where to apply the diffs, defaulting to '.' */
       if (targets->nelts == 2)
         targetpath = APR_ARRAY_IDX(targets, 1, const char *);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 5 16:04:54 2007

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.