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

[PATCH] svn diff doesn't check path existence all the time

From: Robert Pluim <rpluim_at_bigfoot.com>
Date: 2003-04-01 16:41:07 CEST

[I ran across this whilst looking at issue 1061]

Transcript:

 rpluim: ~/wc-test/local-wc1/foo
 $ svn diff file:///home/rpluim/testrepo/trunk/foo/7000 file:///home/rpluim/testrepo/trunk/foo/1097
 rpluim: ~/wc-test/local-wc1/foo
 $

foo/7000 has never existed in this repository at any time. However:

 rpluim: ~/wc-test/local-wc1/foo
 $ svn diff file:///home/rpluim/testrepo/trunk/foo/1097 file:///home/rpluim/testrepo/trunk/foo/7000
 subversion/libsvn_client/diff.c:1361: (apr_err=160013)
 svn: Filesystem has no item
 svn: 'file:///home/rpluim/testrepo/trunk/foo/7000' at rev 28 wasn't found in repository.

I'm attaching a patch, but I don't know the code well enough to see if
there are cases where you _don't_ want to check for the existence of
the first URL.

Log:

* svn/subversion/libsvn_client/diff.c (do_diff): Check that the
  filesystem actually has the item specified as URL1@N

Patch:

Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 5507)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -1293,6 +1293,7 @@
       const char *URL1, *URL2;
       const char *anchor1, *target1, *anchor2, *target2;
       svn_boolean_t path1_is_url, path2_is_url;
+ svn_node_kind_t path1_kind;
       svn_node_kind_t path2_kind;
       void *session2;
 
@@ -1328,6 +1329,25 @@
                 pool));
       callback_baton->revnum2 = end_revnum;
 
+ if (path1_is_url)
+ {
+ SVN_ERR (ra_lib->check_path (&path1_kind, session, "", start_revnum,
+ pool));
+
+ switch (path1_kind)
+ {
+ case svn_node_file:
+ case svn_node_dir:
+ break;
+
+ default:
+ return svn_error_createf (SVN_ERR_FS_NOT_FOUND, NULL,
+ "'%s' at rev %" SVN_REVNUM_T_FMT
+ " wasn't found in repository.",
+ path1, start_revnum);
+ }
+ }
+
       /* Now down to the -real- business. We gotta figure out anchors
          and targets, whether things are urls or wcpaths.
 

-- 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 1 16:41:14 2003

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.