You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/04/28 18:15:57 UTC

svn commit: r939000 - /subversion/trunk/subversion/mod_dav_svn/reports/update.c

Author: rhuijben
Date: Wed Apr 28 16:15:57 2010
New Revision: 939000

URL: http://svn.apache.org/viewvc?rev=939000&view=rev
Log:
Provide an error message instead of just 'connection truncated' when updating
to a revision higher than the current head revision of the repository over
HTTPs.

The original patch from Kamesh was specifically targetted to a master-slave
setup. I tweaked the error message to remove these specifics, to at least
show an error that helps resolving the problem.

See
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2405550

Patch by: kameshj
(Tweaked by me)

* subversion/mod_dav_svn/reports/update.c
  (dav_svn__update_report): Give a user readable error when a reported
    revision is younger then the HEAD revision of the current repository.

Modified:
    subversion/trunk/subversion/mod_dav_svn/reports/update.c

Modified: subversion/trunk/subversion/mod_dav_svn/reports/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/reports/update.c?rev=939000&r1=938999&r2=939000&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/reports/update.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/reports/update.c Wed Apr 28 16:15:57 2010
@@ -924,6 +924,7 @@ dav_svn__update_report(const dav_resourc
   void *rbaton = NULL;
   update_ctx_t uc = { 0 };
   svn_revnum_t revnum = SVN_INVALID_REVNUM;
+  svn_boolean_t revnum_is_head = FALSE;
   svn_revnum_t from_revnum = SVN_INVALID_REVNUM;
   int ns;
   /* entry_counter and entry_is_empty are for operational logging. */
@@ -1131,6 +1132,7 @@ dav_svn__update_report(const dav_resourc
                                     "Could not determine the youngest "
                                     "revision for the update process.",
                                     resource->pool);
+      revnum_is_head = TRUE;
     }
 
   uc.svndiff_version = resource->info->svndiff_version;
@@ -1246,6 +1248,23 @@ dav_svn__update_report(const dav_resourc
                   {
                     rev = SVN_STR_TO_REV(this_attr->value);
                     saw_rev = TRUE;
+                    if (revnum_is_head && rev > revnum)
+                      {
+                        /* ### This error could be improved with more details
+                           ### if we know  that this repository is a slave
+                           ### repository in a master-slave setup. */
+                        const char *errstr = apr_pstrdup(resource->pool,
+                                                         "A reported revision"
+                                                         " is higher than the"
+                                                         " current HEAD"
+                                                         " revision of the"
+                                                         " repository.");
+                        return dav_svn__new_error_tag(resource->pool,
+                                                      HTTP_INTERNAL_SERVER_ERROR,
+                                                      0, errstr,
+                                                      SVN_DAV_ERROR_NAMESPACE,
+                                                      SVN_DAV_ERROR_TAG);
+                      }
                   }
                 else if (strcmp(this_attr->name, "depth") == 0)
                   depth = svn_depth_from_word(this_attr->value);