Author: pburba
Date: Thu Dec  3 18:51:07 2009
New Revision: 886880

URL: http://svn.apache.org/viewvc?rev=886880&view=rev
Log:
Fix a peg rev bug in a libsvn_client private function.

* subversion/libsvn_client/url.c
  (svn_client__entry_location): Return an error if asked about a peg rev
   which requires communication with the repository.  Actually return the
   COMMITED or PREV revision if asked for those.  Previously we returned
   the base rev (i.e. entry->rev) in all cases.

* subversion/libsvn_client/client.h
  (svn_client__entry_location): Get specific about what this function does
   and does not do.

Modified:
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/url.c

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=886880&r1=886879&r2=886880&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Thu Dec  3 18:51:07 2009
@@ -77,9 +77,21 @@
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool);
 
-/* Get the repository URL and revision number for LOCAL_ABSPATH,
-   which is sometimes the path's copyfrom info rather than its actual
-   URL and revision. */
+/* Get the repository URL and revision number for LOCAL_ABSPATH and put them
+   in *URL and *REVNUM.  REVNUM may be null, in which case it is ignored.
+
+   If PEG_REV_KIND is svn_opt_revision_working, then use the LOCAL_ABSPATH's
+   copyfrom info to populate *URL and *REVNUM.
+
+   If PEG_REV_KIND is svn_opt_revision_date or svn_opt_revision_head then
+   return SVN_ERR_CLIENT_BAD_REVISION.
+
+   If PEG_REV_KIND is svn_opt_revision_committed or svn_opt_revision_previous
+   then set *REVNUM to the last committed or previous revision respectively.
+
+   If PEG_REV_NUM is svn_opt_revision_unspecified, svn_opt_revision_number,
+   svn_opt_revision_base, or svn_opt_revision_working then set *REVNUM
+   to the base revision. */
 svn_error_t *
 svn_client__entry_location(const char **url,
                            svn_revnum_t *revnum,

Modified: subversion/trunk/subversion/libsvn_client/url.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/url.c?rev=886880&r1=886879&r2=886880&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/url.c (original)
+++ subversion/trunk/subversion/libsvn_client/url.c Thu Dec  3 18:51:07 2009
@@ -131,6 +131,12 @@
 {
   const svn_wc_entry_t *entry;
 
+  /* This function doesn't contact the repository, so error out if
+     asked to do so. */
+  if (peg_rev_kind == svn_opt_revision_date
+      || peg_rev_kind == svn_opt_revision_head)
+    return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
+
   SVN_ERR(svn_wc__get_entry_versioned(&entry, wc_ctx, local_abspath,
                                       svn_node_unknown, FALSE, FALSE,
                                       scratch_pool, scratch_pool));
@@ -145,7 +151,18 @@
     {
       *url = apr_pstrdup(result_pool, entry->url);
       if (revnum)
-        *revnum = entry->revision;
+        {
+          if (peg_rev_kind == svn_opt_revision_committed)
+            *revnum = entry->cmt_rev;
+          else if (peg_rev_kind == svn_opt_revision_previous)
+            *revnum = entry->cmt_rev - 1;
+          else
+            /* Local modifications are not relevant here, so consider
+               svn_opt_revision_unspecified, svn_opt_revision_number,
+               svn_opt_revision_base, and svn_opt_revision_working
+               as the same. */
+            *revnum = entry->revision;
+        }
     }
   else
     {


Reply via email to