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

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

From: Robert Pluim <rpluim_at_bigfoot.com>
Date: 2003-04-02 17:07:35 CEST

Robert Pluim writes:

XEmacs is still resisting, but anyway. Python criticism gratefully
accepted, it's not something I've written a lot of.

Log:

* subversion/libsvn_client/diff.c (do_diff): Check that the filesystem
  actually has the item specified as URL1@N (URL2 was already being
  checked).

* subversion/tests/clients/cmdline/diff_tests.py : Test that 'svn diff
  URL1 URL2' fails if either of the URLs does not exist in the
  repository.

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.
 
Index: subversion/tests/clients/cmdline/diff_tests.py
===================================================================
--- subversion/tests/clients/cmdline/diff_tests.py (revision 5507)
+++ subversion/tests/clients/cmdline/diff_tests.py (working copy)
@@ -809,7 +809,20 @@
 
   return 0
 
+def diff_nonextant_urls(sbox):
+ "svn diff errors against a non-existant URL"
 
+ non_extant_url = sbox.repo_url + '/A/does_not_exist'
+ extant_url = sbox.repo_url + '/A/mu'
+
+ diff_output, err_output = svntest.main.run_svn(None, 'diff', non_extant_url, extant_url)
+ if not re.match('svn: Filesystem has no item$',err_output[0]) :
+ raise svntest.Failure
+
+ diff_output, err_output = svntest.main.run_svn(None, 'diff', extant_url, non_extant_url)
+ if not re.match('svn: Filesystem has no item$',err_output[0]) :
+ raise svntest.Failure
+
 ########################################################################
 # Run the tests
 
@@ -827,6 +840,7 @@
               diff_pure_repository_update_a_file,
               diff_only_property_change,
               dont_diff_binary_file,
+ diff_nonextant_urls,
               ]
 
 if __name__ == '__main__':

-- 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 2 17:07:49 2003

This is an archived mail posted to the Subversion Dev mailing list.