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

[PATCH] svn_wc_ventry(_ex) to eliminate heavily repeated code

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2007-03-17 00:14:21 CET

In libsvn_wc, we have a number of patterns which are extremely common,
yet verbosely repeated every time. One of them is addressed in the
patch attached.

The pattern is:

- get an entry using svn_wc_entry()
- check for a non-NULL entry and,
   return a not-versioned error if the entry *is* NULL

The only thing I could figure out why this would be is that we want to
have file and line numbers in the error message, so, I introduced a
macro and a new function.

The function svn_wc_ventry_ex (ventry as for 'valid entry') which
takes a file name and a line number. The macro svn_wc_ventry()
forwards to the function, adding the filename and lineno.

I know it isn't our usual pattern, but it's one of the ways I see to
make libsvn_wc a bit more readable.

BTW: This patch has 2 failing tests, because of changed error output.
No real problems, as far as I can tell.

Comments?

bye,

Erik.

Statistics: 110 adds, 223 deletions.

Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h (revision 23885)
+++ subversion/include/svn_wc.h (working copy)
@@ -1457,7 +1457,38 @@
                           svn_boolean_t show_hidden,
                           apr_pool_t *pool);

+/** Same as svn_wc_entry() except that the entry returned
+ * is a non @c NULL entry.
+ *
+ * Returns an error when svn_wc_entry() would have returned a @c NULL entry.
+ *
+ * @since New in 1.5.
+ */

+#ifdef SVN_DEBUG
+#define svn_wc_ventry(entry, path, adm_access, show_hidden, pool) \
+ svn_wc_ventry_ex((entry), (path), (adm_access), (show_hidden), \
+ __FILE__, __LINE__, (pool))
+#else
+#define svn_wc_ventry(entry, path, adm_access, show_hidden, pool) \
+ svn_wc_ventry_ex((entry), (path), (adm_access), (show_hidden), \
+ NULL, 0, (pool))
+#endif
+
+
+/** Internal function used by the svn_wc_ventry() macro.
+ *
+ * @since New in 1.5.
+ */
+svn_error_t *
+svn_wc_ventry_ex(const svn_wc_entry_t **entry,
+ const char *path,
+ svn_wc_adm_access_t *adm_access,
+ svn_boolean_t show_hidden,
+ const char *caller_filename,
+ int caller_lineno,
+ apr_pool_t *pool);
+
 /** Parse the `entries' file for @a adm_access and return a hash @a entries,
  * whose keys are (<tt>const char *</tt>) entry names and values are
  * (<tt>svn_wc_entry_t *</tt>). The hash @a entries, and its keys and
Index: subversion/libsvn_wc/entries.c
===================================================================
--- subversion/libsvn_wc/entries.c (revision 23885)
+++ subversion/libsvn_wc/entries.c (working copy)
@@ -1235,6 +1235,33 @@
 }

+svn_error_t *
+svn_wc_ventry_ex(const svn_wc_entry_t **entry,
+ const char *path,
+ svn_wc_adm_access_t *adm_access,
+ svn_boolean_t show_hidden,
+ const char *caller_filename,
+ int caller_lineno,
+ apr_pool_t *pool)
+{
+ SVN_ERR(svn_wc_entry(entry, path, adm_access, show_hidden, pool));
+
+ if (! *entry)
+ {
+ svn_error_t *err
+ = svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,
+ _("'%s' is not under version control"),
+ svn_path_local_style(path, pool));
+
+ err->file = caller_filename;
+ err->line = caller_lineno;
+ return err;
+ }
+
+ return SVN_NO_ERROR;
+}
+
+
 #if 0
 /* This is #if 0'd out until I decide where to use it. --cmpilato */

Index: subversion/libsvn_wc/copy.c
===================================================================
--- subversion/libsvn_wc/copy.c (revision 23885)
+++ subversion/libsvn_wc/copy.c (working copy)
@@ -2,7 +2,7 @@
  * copy.c: wc 'copy' functionality.
  *
  * ====================================================================
- * Copyright (c) 2000-2006 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -288,7 +288,7 @@
         {
           SVN_ERR(svn_wc_adm_retrieve(&parent_access, src_access,
                                       parent_path, pool));
- SVN_ERR(svn_wc_entry(&entry, parent_path, parent_access,
+ SVN_ERR(svn_wc_ventry(&entry, parent_path, parent_access,
                                FALSE, pool));
         }
       else /* ...get access for parent_path instead. */
@@ -296,17 +296,11 @@
           SVN_ERR(svn_wc_adm_probe_open3(&parent_access, NULL,
                                          parent_path, FALSE, -1,
                                          NULL, NULL, pool));
- SVN_ERR(svn_wc_entry(&entry, parent_path, parent_access,
+ SVN_ERR(svn_wc_ventry(&entry, parent_path, parent_access,
                                FALSE, pool));
           SVN_ERR(svn_wc_adm_close(parent_access));
         }

- if (! entry)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(parent_path, pool));
-
       if (entry->copyfrom_url)
         {
           *copyfrom_url = svn_path_join(entry->copyfrom_url, rest,
@@ -377,12 +371,7 @@

   /* Sanity check 1: You cannot make a copy of something that's not
      under version control. */
- SVN_ERR(svn_wc_entry(&src_entry, src_path, src_access, FALSE, pool));
- if (! src_entry)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("Cannot copy or move '%s': it's not under version control"),
- svn_path_local_style(src_path, pool));
+ SVN_ERR(svn_wc_ventry(&src_entry, src_path, src_access, FALSE, pool));

   /* Sanity check 2: You cannot make a copy of something that's not
      in the repository unless it's a copy of an uncommitted copy. */
@@ -656,12 +645,7 @@

   /* Sanity check 1: You cannot make a copy of something that's not
      under version control. */
- SVN_ERR(svn_wc_entry(&src_entry, src_path, src_access, FALSE, pool));
- if (! src_entry)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(src_path, pool));
+ SVN_ERR(svn_wc_ventry(&src_entry, src_path, src_access, FALSE, pool));

   /* Sanity check 2: You cannot make a copy of something that's not
      in the repository unless it's a copy of an uncommitted copy. */
@@ -778,20 +762,9 @@
                                  cancel_func, cancel_baton, pool));

   dst_path = svn_wc_adm_access_path(dst_parent);
- SVN_ERR(svn_wc_entry(&dst_entry, dst_path, dst_parent, FALSE, pool));
- if (! dst_entry)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(dst_path, pool));
+ SVN_ERR(svn_wc_ventry(&dst_entry, dst_path, dst_parent, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&src_entry, src_path, adm_access, FALSE, pool));

- SVN_ERR(svn_wc_entry(&src_entry, src_path, adm_access, FALSE, pool));
- if (! src_entry)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(src_path, pool));
-
   if ((src_entry->repos != NULL && dst_entry->repos != NULL) &&
       strcmp(src_entry->repos, dst_entry->repos) != 0)
     return svn_error_createf
Index: subversion/libsvn_wc/adm_ops.c
===================================================================
--- subversion/libsvn_wc/adm_ops.c (revision 23885)
+++ subversion/libsvn_wc/adm_ops.c (working copy)
@@ -1357,11 +1357,7 @@
 {
   const svn_wc_entry_t *ent;

- SVN_ERR(svn_wc_entry(&ent, path, adm_access, FALSE, pool));
- if (! ent)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(path, pool));
+ SVN_ERR(svn_wc_ventry(&ent, path, adm_access, FALSE, pool));

   if (url)
     *url = apr_pstrdup(pool, ent->url);
@@ -1948,12 +1944,8 @@
   SVN_ERR(svn_wc_adm_probe_retrieve(&dir_access, parent_access, path, pool));

   /* Safeguard 1: is this a versioned resource? */
- SVN_ERR(svn_wc_entry(&entry, path, dir_access, FALSE, pool));
- if (! entry)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("Cannot revert: '%s' is not under version control"),
- svn_path_local_style(path, pool));
+ SVN_ERR_W(svn_wc_ventry(&entry, path, dir_access, FALSE, pool),
+ "Cannot revert.");

   /* Safeguard 1.5: is this a missing versioned directory? */
   if (entry->kind == svn_node_dir)
@@ -2652,11 +2644,7 @@
   if (! recurse)
     {
       const svn_wc_entry_t *entry;
- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
- if (! entry)
- return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(path, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));

       SVN_ERR(resolve_found_entry_callback(path, entry, baton, pool));
     }
@@ -2677,11 +2665,8 @@
   const svn_wc_entry_t *entry;
   svn_wc_entry_t newentry;

- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));

- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"), path);

   newentry.lock_token = lock->token;
   newentry.lock_owner = lock->owner;
@@ -2713,12 +2698,8 @@
   const svn_wc_entry_t *entry;
   svn_wc_entry_t newentry;

- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));

- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"), path);
-
   newentry.lock_token = newentry.lock_owner = newentry.lock_comment = NULL;
   newentry.lock_creation_date = 0;
   SVN_ERR(svn_wc__entry_modify(adm_access, entry->name, &newentry,
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 23885)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -2,7 +2,7 @@
  * status.c: construct a status structure from an entry structure
  *
  * ====================================================================
- * Copyright (c) 2000-2006 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -722,13 +722,7 @@
       const svn_wc_entry_t *full_entry = entry;

       if (entry->kind == kind)
- {
- SVN_ERR(svn_wc_entry(&full_entry, path, adm_access, FALSE, pool));
- if (! full_entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(path, pool));
- }
+ SVN_ERR(svn_wc_ventry(&full_entry, path, adm_access, FALSE, pool));

       /* Descend only if the subdirectory is a working copy directory
          (and DESCEND is non-zero ofcourse) */
Index: subversion/libsvn_wc/adm_files.c
===================================================================
--- subversion/libsvn_wc/adm_files.c (revision 23885)
+++ subversion/libsvn_wc/adm_files.c (working copy)
@@ -6,7 +6,7 @@
  * information is kept.
  *
  * ====================================================================
- * Copyright (c) 2000-2006 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -1028,12 +1028,8 @@

       SVN_ERR(svn_wc_adm_open3(&adm_access, NULL, path, FALSE, 0,
                                NULL, NULL, pool));
- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));
       SVN_ERR(svn_wc_adm_close(adm_access));
- if (!entry)
- return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("No entry for '%s'"),
- svn_path_local_style(path, pool));

       /* When the directory exists and is scheduled for deletion do not
        * check the revision or the URL. The revision can be any
Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c (revision 23885)
+++ subversion/libsvn_wc/update_editor.c (working copy)
@@ -3125,11 +3125,7 @@
   /* Fabricate the anticipated new URL of the target and check the
      copyfrom URL to be in the same repository. */
   {
- SVN_ERR(svn_wc_entry(&ent, dir_name, adm_access, FALSE, pool));
- if (! ent)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(dir_name, pool));
+ SVN_ERR(svn_wc_ventry(&ent, dir_name, adm_access, FALSE, pool));

     new_URL = svn_path_url_add_component(ent->url, base_name, pool);

Index: subversion/libsvn_wc/questions.c
===================================================================
--- subversion/libsvn_wc/questions.c (revision 23885)
+++ subversion/libsvn_wc/questions.c (working copy)
@@ -179,15 +179,8 @@
   const svn_wc_entry_t *entry;

   /* Get the timestamp from the entries file */
- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));

- /* Can't compare timestamps for an unversioned file. */
- if (entry == NULL)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(path, pool));
-
   /* Get the timestamp from the working file and the entry */
   if (timestamp_kind == svn_wc__text_time)
     {
@@ -294,13 +287,8 @@
         {
           /* Need checksum verification, so read checksum from entries file
            * and setup checksummed stream for base file. */
- SVN_ERR(svn_wc_entry(&entry, versioned_file, adm_access, TRUE,
+ SVN_ERR(svn_wc_ventry(&entry, versioned_file, adm_access, TRUE,
                                pool));
- if (! entry)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(versioned_file, pool));

           if (entry->checksum)
             b_stream = svn_stream_checksummed(b_stream, &digest, NULL, TRUE,
Index: subversion/libsvn_wc/translate.c
===================================================================
--- subversion/libsvn_wc/translate.c (revision 23885)
+++ subversion/libsvn_wc/translate.c (working copy)
@@ -2,7 +2,7 @@
  * translate.c : wc-specific eol/keyword substitution
  *
  * ====================================================================
- * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -263,11 +263,7 @@
       return SVN_NO_ERROR;
     }

- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(path, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));

   SVN_ERR(svn_subst_build_keywords2(keywords,
                                     list,
Index: subversion/libsvn_client/switch.c
===================================================================
--- subversion/libsvn_client/switch.c (revision 23885)
+++ subversion/libsvn_client/switch.c (working copy)
@@ -2,7 +2,7 @@
  * switch.c: implement 'switch' feature via WC & RA interfaces.
  *
  * ====================================================================
- * Copyright (c) 2000-2006 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -101,11 +101,7 @@
                                  ctx->cancel_baton, pool));
   anchor = svn_wc_adm_access_path(adm_access);

- SVN_ERR(svn_wc_entry(&entry, anchor, adm_access, FALSE, pool));
- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(anchor, pool));
+ SVN_ERR(svn_wc_ventry(&entry, anchor, adm_access, FALSE, pool));
   if (! entry->url)
     return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
                              _("Directory '%s' has no URL"),
Index: subversion/libsvn_client/export.c
===================================================================
--- subversion/libsvn_client/export.c (revision 23885)
+++ subversion/libsvn_client/export.c (working copy)
@@ -2,7 +2,7 @@
  * export.c: export a tree.
  *
  * ====================================================================
- * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -230,19 +230,8 @@
                                  0, ctx->cancel_func, ctx->cancel_baton,
                                  pool));

- SVN_ERR(svn_wc_entry(&entry, from, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&entry, from, adm_access, FALSE, pool));

- /* Bail if we're trying to export something that doesn't exist,
- or isn't under version control. */
- if (! entry)
- {
- SVN_ERR(svn_wc_adm_close(adm_access));
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control "
- "or doesn't exist"),
- svn_path_local_style(from, pool));
- }
-
   /* Only export 'added' files when the revision is WORKING.
      Otherwise, skip the 'added' files, since they didn't exist
      in the BASE revision and don't have an associated text-base.
Index: subversion/libsvn_client/revisions.c
===================================================================
--- subversion/libsvn_client/revisions.c (revision 23885)
+++ subversion/libsvn_client/revisions.c (working copy)
@@ -80,15 +80,9 @@

       SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, path, FALSE,
                                      0, NULL, NULL, pool));
- SVN_ERR(svn_wc_entry(&ent, path, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&ent, path, adm_access, FALSE, pool));
       SVN_ERR(svn_wc_adm_close(adm_access));

- if (! ent)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(path, pool));
-
       if ((revision->kind == svn_opt_revision_base)
           || (revision->kind == svn_opt_revision_working))
         *revnum = ent->revision;
Index: subversion/libsvn_client/status.c
===================================================================
--- subversion/libsvn_client/status.c (revision 23885)
+++ subversion/libsvn_client/status.c (working copy)
@@ -2,7 +2,7 @@
  * status.c: return the status of a working copy dirent
  *
  * ====================================================================
- * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -249,12 +249,7 @@
       svn_node_kind_t kind;

       /* Get full URL from the ANCHOR. */
- SVN_ERR(svn_wc_entry(&entry, anchor, anchor_access, FALSE, pool));
- if (! entry)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(anchor, pool));
+ SVN_ERR(svn_wc_ventry(&entry, anchor, anchor_access, FALSE, pool));
       if (! entry->url)
         return svn_error_createf
           (SVN_ERR_ENTRY_MISSING_URL, NULL,
Index: subversion/libsvn_client/info.c
===================================================================
--- subversion/libsvn_client/info.c (revision 23885)
+++ subversion/libsvn_client/info.c (working copy)
@@ -2,7 +2,7 @@
  * info.c: return system-generated metadata about paths or URLs.
  *
  * ====================================================================
- * Copyright (c) 2000-2006 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -237,12 +237,7 @@
                                  recurse ? -1 : 0,
                                  ctx->cancel_func, ctx->cancel_baton,
                                  pool));
- SVN_ERR(svn_wc_entry(&entry, wcpath, adm_access, FALSE, pool));
- if (! entry)
- {
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("Cannot read entry for '%s'"), wcpath);
- }
+ SVN_ERR(svn_wc_ventry(&entry, wcpath, adm_access, FALSE, pool));

   SVN_ERR(build_info_from_entry(&info, entry, pool));
   fe_baton.receiver = receiver;
Index: subversion/libsvn_client/prop_commands.c
===================================================================
--- subversion/libsvn_client/prop_commands.c (revision 23885)
+++ subversion/libsvn_client/prop_commands.c (working copy)
@@ -351,11 +351,7 @@
   SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, target, TRUE,
                                  recurse ? -1 : 0, ctx->cancel_func,
                                  ctx->cancel_baton, pool));
- SVN_ERR(svn_wc_entry(&node, target, adm_access, FALSE, pool));
- if (!node)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target, pool));
+ SVN_ERR(svn_wc_ventry(&node, target, adm_access, FALSE, pool));

   if (recurse && node->kind == svn_node_dir)
     {
@@ -605,11 +601,8 @@

       SVN_ERR(svn_wc_adm_open3(&adm_access, NULL, pdir, FALSE,
                                0, NULL, NULL, pool));
- SVN_ERR(svn_wc_entry(&entry, target, adm_access, FALSE, pool));
- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target, pool));
+ SVN_ERR(svn_wc_ventry(&entry, target, adm_access, FALSE, pool));
+
       *new_target = entry->url;
     }
   else
@@ -768,13 +761,8 @@
                                      FALSE, recurse ? -1 : 0,
                                      ctx->cancel_func, ctx->cancel_baton,
                                      pool));
- SVN_ERR(svn_wc_entry(&node, target, adm_access, FALSE, pool));
- if (! node)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target, pool));
-
+ SVN_ERR(svn_wc_ventry(&node, target, adm_access, FALSE, pool));
+
       SVN_ERR(svn_client__get_revision_number
               (&revnum, NULL, revision, target, pool));

@@ -1104,13 +1092,8 @@
                                      FALSE, recurse ? -1 : 0,
                                      ctx->cancel_func, ctx->cancel_baton,
                                      pool));
- SVN_ERR(svn_wc_entry(&node, target, adm_access, FALSE, pool));
- if (! node)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target, pool));
-
+ SVN_ERR(svn_wc_ventry(&node, target, adm_access, FALSE, pool));
+
       SVN_ERR(svn_client__get_revision_number
               (&revnum, NULL, revision, target, pool));

Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c (revision 23885)
+++ subversion/libsvn_client/ra.c (working copy)
@@ -175,11 +175,7 @@
   const svn_wc_entry_t *entry;
   const char *full_path = svn_path_join(cb->base_dir, path, pool);

- SVN_ERR(svn_wc_entry(&entry, full_path, cb->base_access, FALSE, pool));
- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(full_path, pool));
+ SVN_ERR(svn_wc_ventry(&entry, full_path, cb->base_access, FALSE, pool));

   SVN_ERR(svn_wc_adm_retrieve(&adm_access, cb->base_access,
                               (entry->kind == svn_node_dir
@@ -351,14 +347,9 @@
 {
   const svn_wc_entry_t *entry;

- SVN_ERR(svn_wc_entry(&entry, path, adm_access,
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access,
                        TRUE, /* show deleted */ pool));

- if (! entry)
- return svn_error_createf(SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("Can't find entry for '%s'"),
- svn_path_local_style(path, pool));
-
   if (entry->uuid)
     {
       *uuid = entry->uuid;
Index: subversion/libsvn_client/cat.c
===================================================================
--- subversion/libsvn_client/cat.c (revision 23885)
+++ subversion/libsvn_client/cat.c (working copy)
@@ -2,7 +2,7 @@
  * cat.c: implementation of the 'cat' command
  *
  * ====================================================================
- * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ * Copyright (c) 2000-2007 CollabNet. All rights reserved.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -66,14 +66,8 @@
          revision->kind == svn_opt_revision_committed ||
          revision->kind == svn_opt_revision_unspecified);

- SVN_ERR(svn_wc_entry(&entry, path, adm_access, FALSE, pool));
+ SVN_ERR(svn_wc_ventry(&entry, path, adm_access, FALSE, pool));

- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control "
- "or doesn't exist"),
- svn_path_local_style(path, pool));
-
   if (entry->kind != svn_node_file)
     return svn_error_createf(SVN_ERR_CLIENT_IS_DIRECTORY, NULL,
                              _("'%s' refers to a directory"),
Index: subversion/libsvn_client/locking_commands.c
===================================================================
--- subversion/libsvn_client/locking_commands.c (revision 23885)
+++ subversion/libsvn_client/locking_commands.c (working copy)
@@ -251,13 +251,9 @@
           abs_path = svn_path_join
             (svn_wc_adm_access_path(*parent_adm_access_p), target, subpool);

- SVN_ERR(svn_wc_entry(&entry, abs_path, *parent_adm_access_p, FALSE,
+ SVN_ERR(svn_wc_ventry(&entry, abs_path, *parent_adm_access_p, FALSE,
                                subpool));

- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target, pool));
           if (! entry->url)
             return svn_error_createf(SVN_ERR_ENTRY_MISSING_URL, NULL,
                                      _("'%s' has no URL"),
Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 23885)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -2787,11 +2787,7 @@
                                  ctx->cancel_func, ctx->cancel_baton,
                                  pool));

- SVN_ERR(svn_wc_entry(&entry, target_wcpath, adm_access, FALSE, pool));
- if (entry == NULL)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target_wcpath, pool));
+ SVN_ERR(svn_wc_ventry(&entry, target_wcpath, adm_access, FALSE, pool));

   merge_cmd_baton.force = force;
   merge_cmd_baton.dry_run = dry_run;
@@ -2915,11 +2911,7 @@
                                  ctx->cancel_func, ctx->cancel_baton,
                                  pool));

- SVN_ERR(svn_wc_entry(&entry, target_wcpath, adm_access, FALSE, pool));
- if (entry == NULL)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target_wcpath, pool));
+ SVN_ERR(svn_wc_ventry(&entry, target_wcpath, adm_access, FALSE, pool));

   merge_cmd_baton.force = force;
   merge_cmd_baton.dry_run = dry_run;
Index: subversion/libsvn_client/copy.c
===================================================================
--- subversion/libsvn_client/copy.c (revision 23885)
+++ subversion/libsvn_client/copy.c (working copy)
@@ -1484,17 +1484,10 @@
                                                  ctx->cancel_func,
                                                  ctx->cancel_baton,
                                                  iterpool));
- SVN_ERR(svn_wc_entry(&entry, pair->src, adm_access,
- FALSE,
- iterpool));
+ SVN_ERR(svn_wc_ventry(&entry, pair->src, adm_access,
+ FALSE, iterpool));
                   SVN_ERR(svn_wc_adm_close(adm_access));

- if (! entry)
- return svn_error_createf
- (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(pair->src, pool));
-
                   if (! entry->url)
                     return svn_error_createf
                       (SVN_ERR_ENTRY_MISSING_URL, NULL,
Index: subversion/libsvn_client/log.c
===================================================================
--- subversion/libsvn_client/log.c (revision 23885)
+++ subversion/libsvn_client/log.c (working copy)
@@ -127,12 +127,8 @@
           SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, target,
                                          FALSE, 0, ctx->cancel_func,
                                          ctx->cancel_baton, pool));
- SVN_ERR(svn_wc_entry(&entry, target, adm_access, FALSE, pool));
- if (! entry)
- return svn_error_createf(SVN_ERR_UNVERSIONED_RESOURCE, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(target, pool));
-
+ SVN_ERR(svn_wc_ventry(&entry, target, adm_access, FALSE, pool));
+
           if (! entry->url)
             return svn_error_createf
               (SVN_ERR_ENTRY_MISSING_URL, NULL,
Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c (revision 23885)
+++ subversion/libsvn_client/commit_util.c (working copy)
@@ -702,11 +702,7 @@
       /* No entry? This TARGET isn't even under version control! */
       SVN_ERR(svn_wc_adm_probe_retrieve(&adm_access, parent_dir,
                                         target, subpool));
- SVN_ERR(svn_wc_entry(&entry, target, adm_access, FALSE, subpool));
- if (! entry)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"), target);
+ SVN_ERR(svn_wc_ventry(&entry, target, adm_access, FALSE, subpool));
       if (! entry->url)
         return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
                                  _("Entry for '%s' has no URL"),
@@ -844,13 +840,8 @@
       svn_pool_clear(iterpool);

       /* Read the entry for this SRC. */
- SVN_ERR(svn_wc_entry(&entry, pair->src, adm_access, FALSE, iterpool));
- if (! entry)
- return svn_error_createf
- (SVN_ERR_ENTRY_NOT_FOUND, NULL,
- _("'%s' is not under version control"),
- svn_path_local_style(pair->src, iterpool));
-
+ SVN_ERR(svn_wc_ventry(&entry, pair->src, adm_access, FALSE, iterpool));
+
       /* Get the right access baton for this SRC. */
       if (entry->kind == svn_node_dir)
         SVN_ERR(svn_wc_adm_retrieve(&dir_access, adm_access, pair->src,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 17 00:14:42 2007

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