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

[PATCH] new vsn-rsc-url format, issue #652

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-05-24 08:31:48 CEST

I think this patch covers the majority of the "pain" in converting
mod_dav_svn to produce/consume a new vsn-rsc-url format based on
"created_rev/path", instead of node-ids. This is an issue required
for pre-alpha, which is coming up this coming Tuesday.

WARNING -- this patch compiles, but I have no idea if it works at all.
It's late, I'm tired, and it may have bugs. I'm hoping gstein (and
others on this list) can review it, test it, and commit it over the
weekend. I'll be going out of town tomorrow morning, back on Monday
night. I pass the ball to the list. :-)

gstein has already "enhanced" ra_dav to regenerate bogus vsn-rsc-urls
stashed in the working copy if the server rejects them. So if you
apply this patch to your mod_dav_svn, existing wc's should just "fix"
their caches automatically over time.

On a related side note: I think we'd like to do a Grand Recheckout
when we hit pre-alpha. Gstein needs to change the /$svn/ string in
all server urls (which is illegal url syntax) into /!svn/. This will
invalidate *all* existing working copies. So if everyone needs to
re-checkout, might as well use the opportunity to distribute the
improved vsn-rsc-urls in the process!

---------------------------------------------------------------------

Issue #652: change vsn-rsc-urls to use "CR/path" instead of fs_id_t.

* dav_svn.h
  (dav_svn_build_uri): grow new rev_root argument.

  (dav_svn_uri_info): remove node_id and node_id_str fields; plain old
  rev field suffices.

  (struct dav_resource_private): same.

  (DAV_SVN_REPOS_PATH): remove this macro, don't need it anymore.
  *** all callers changed to just 'resource->info->repos_path'.

* util.c
  (dav_svn_build_uri): grow new rev_root argument; construct 'version'
  urls as "CR/path", instead of taking already-constructed unparsed
  id_t's. *** change all callers to this func, usually passing NULL
  for the new rev_root arg.

  (dav_svn_simple_parse_uri): parse created_rev instead of id_t.

* liveprops.c (dav_svn_insert_prop): simplify -- don't generate an
  fs_id_t, just pass rev_root and path to build_uri.

* update.c (send_vsn_url): same.

* merge.c (send_response): same.

* repos.c
  (dav_svn_parse_version_uri): parsed created_rev instead of id_t.

  (dav_svn_getetag): generate unique tag based on CR/path instead of id.

  (dav_svn_prep_version): do existence (type) check based on rev and
  rev-root; no need for potential lookup by id-root anymore.

  (is_our_resource): no need to regenerate an id-root anymore.

  (dav_svn_deliver): open a rev-root instead of id-root.

* deadprops.c
  (get_repos_path): just return repos_path field.

* version.c
  (dav_svn_checkout): check info->root.rev instead of node_id field.
  Turn info's rev/path pair into a temporary id_t, so we can check
  out-of-dateness. ### gstein, let's change this logic to be more
  straightforward: see if we get created_rev in head, if so, we're ok.

Index: ./subversion/mod_dav_svn/merge.c
===================================================================
--- ./subversion/mod_dav_svn/merge.c
+++ ./subversion/mod_dav_svn/merge.c Fri May 24 00:55:27 2002
@@ -110,26 +110,20 @@
   merge_response_ctx *mrc = baton->mrc;
   const char *href;
   const char *rt;
- svn_fs_id_t *id;
- svn_stringbuf_t *stable_id;
   const char *vsn_url;
   apr_status_t status;
 
   href = dav_svn_build_uri(mrc->repos, DAV_SVN_BUILD_URI_PUBLIC,
- SVN_IGNORED_REVNUM, baton->path,
+ SVN_IGNORED_REVNUM, NULL, baton->path,
                            0 /* add_href */, baton->pool);
 
   rt = is_dir
     ? "<D:resourcetype><D:collection/></D:resourcetype>" DEBUG_CR
     : "<D:resourcetype/>" DEBUG_CR;
 
- SVN_ERR( svn_fs_node_id(&id, mrc->root, baton->path, baton->pool) );
-
- stable_id = svn_fs_unparse_id(id, baton->pool);
- svn_stringbuf_appendcstr(stable_id, baton->path);
-
   vsn_url = dav_svn_build_uri(mrc->repos, DAV_SVN_BUILD_URI_VERSION,
- SVN_INVALID_REVNUM, stable_id->data,
+ SVN_INVALID_REVNUM,
+ mrc->root, baton->path,
                               0 /* add_href */, baton->pool);
 
   status = ap_fputstrs(mrc->output, mrc->bb,
@@ -343,7 +337,7 @@
   
   /* the HREF for the baseline is actually the VCC */
   vcc = dav_svn_build_uri(repos, DAV_SVN_BUILD_URI_VCC, SVN_IGNORED_REVNUM,
- NULL, 0 /* add_href */, pool);
+ NULL, NULL, 0 /* add_href */, pool);
 
   /* the version-name of the baseline is the revision number */
   sprintf(revbuf, "%" SVN_REVNUM_T_FMT, new_rev);
Index: ./subversion/mod_dav_svn/deadprops.c
===================================================================
--- ./subversion/mod_dav_svn/deadprops.c
+++ ./subversion/mod_dav_svn/deadprops.c Fri May 24 00:50:41 2002
@@ -48,7 +48,7 @@
 /* retrieve the "right" string to use as a repos path */
 static const char *get_repos_path (struct dav_resource_private *info)
 {
- return info->node_id_str ? info->node_id_str : info->repos_path;
+ return info->repos_path;
 }
 
 
Index: ./subversion/mod_dav_svn/update.c
===================================================================
--- ./subversion/mod_dav_svn/update.c
+++ ./subversion/mod_dav_svn/update.c Fri May 24 01:02:40 2002
@@ -192,9 +192,6 @@
 
 static void send_vsn_url(item_baton_t *baton)
 {
- svn_error_t *serr;
- svn_fs_id_t *id;
- svn_stringbuf_t *stable_id;
   const char *href;
   const char *path;
 
@@ -205,18 +202,10 @@
   path = get_from_path_map(baton->uc->pathmap, baton->path, baton->pool);
   path = strcmp(path, baton->path) ? path : baton->path2;
     
- if ((serr = svn_fs_node_id(&id, baton->uc->rev_root, path, baton->pool)))
- {
- /* ### what to do? */
- return;
- }
-
- stable_id = svn_fs_unparse_id(id, baton->pool);
- svn_stringbuf_appendcstr(stable_id, path);
-
   href = dav_svn_build_uri(baton->uc->resource->info->repos,
                            DAV_SVN_BUILD_URI_VERSION,
- SVN_INVALID_REVNUM, stable_id->data,
+ SVN_INVALID_REVNUM,
+ baton->uc->rev_root, path,
                            0 /* add_href */, baton->pool);
 
   send_xml(baton->uc,
Index: ./subversion/mod_dav_svn/liveprops.c
===================================================================
--- ./subversion/mod_dav_svn/liveprops.c
+++ ./subversion/mod_dav_svn/liveprops.c Fri May 24 00:54:53 2002
@@ -133,7 +133,7 @@
            root object might be an ID root -or- a revision root. */
         serr = svn_fs_node_created_rev(&committed_rev,
                                        resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource), p);
+ resource->info->repos_path, p);
         if (serr != NULL)
           {
             /* ### what to do? */
@@ -169,7 +169,7 @@
            root object might be an ID root -or- a revision root. */
         serr = svn_fs_node_created_rev(&committed_rev,
                                        resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource), p);
+ resource->info->repos_path, p);
         if (serr != NULL)
           {
             /* ### what to do? */
@@ -231,7 +231,7 @@
       if (resource->type != DAV_RESOURCE_TYPE_VERSION || !resource->baselined)
         return DAV_PROP_INSERT_NOTSUPP;
       value = dav_svn_build_uri(resource->info->repos, DAV_SVN_BUILD_URI_BC,
- resource->info->root.rev, NULL,
+ resource->info->root.rev, NULL, NULL,
                                 1 /* add_href */, p);
       break;
 
@@ -252,7 +252,7 @@
             }
           s = dav_svn_build_uri(resource->info->repos,
                                 DAV_SVN_BUILD_URI_BASELINE,
- revnum, NULL,
+ revnum, NULL, NULL,
                                 0 /* add_href */, p);
           value = apr_psprintf(p, "<D:href>%s</D:href>",
                                apr_xml_quote_string(p, s, 1));
@@ -264,24 +264,11 @@
         }
       else
         {
- svn_fs_id_t *id;
- svn_stringbuf_t *stable_id;
-
- serr = svn_fs_node_id(&id, resource->info->root.root,
- resource->info->repos_path, p);
- if (serr != NULL)
- {
- /* ### what to do? */
- value = "###error###";
- break;
- }
-
- stable_id = svn_fs_unparse_id(id, p);
- svn_stringbuf_appendcstr(stable_id, resource->info->repos_path);
-
           s = dav_svn_build_uri(resource->info->repos,
                                 DAV_SVN_BUILD_URI_VERSION,
- SVN_INVALID_REVNUM, stable_id->data,
+ SVN_INVALID_REVNUM,
+ resource->info->root.root,
+ resource->info->repos_path,
                                 0 /* add_href */, p);
           value = apr_psprintf(p, "<D:href>%s</D:href>",
                                apr_xml_quote_string(p, s, 1));
@@ -295,7 +282,7 @@
       if (resource->type != DAV_RESOURCE_TYPE_REGULAR)
         return DAV_PROP_INSERT_NOTSUPP;
       value = dav_svn_build_uri(resource->info->repos, DAV_SVN_BUILD_URI_VCC,
- SVN_IGNORED_REVNUM, NULL,
+ SVN_IGNORED_REVNUM, NULL, NULL,
                                 1 /* add_href */, p);
       break;
 
@@ -320,7 +307,7 @@
              root object might be an ID root -or- a revision root. */
           serr = svn_fs_node_created_rev(&committed_rev,
                                          resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource), p);
+ resource->info->repos_path, p);
           if (serr != NULL)
             {
               /* ### what to do? */
Index: ./subversion/mod_dav_svn/version.c
===================================================================
--- ./subversion/mod_dav_svn/version.c
+++ ./subversion/mod_dav_svn/version.c Fri May 24 01:18:16 2002
@@ -92,7 +92,7 @@
           ap_text_append(resource->pool, option,
                          dav_svn_build_uri(resource->info->repos,
                                            DAV_SVN_BUILD_URI_ACT_COLLECTION,
- SVN_INVALID_REVNUM, NULL,
+ SVN_INVALID_REVNUM, NULL, NULL,
                                            1 /* add_href */, resource->pool));
           ap_text_append(resource->pool, option,
                          "</D:activity-collection-set>");
@@ -211,7 +211,7 @@
 
   /* verify the specified version resource is the "latest", thus allowing
      changes to be made. */
- if (resource->baselined || resource->info->node_id == NULL)
+ if (resource->baselined || resource->info->root.rev == SVN_INVALID_REVNUM)
     {
       /* a Baseline, or a standard Version Resource which was accessed
          via a Label against a VCR within a Baseline Collection. */
@@ -254,7 +254,8 @@
       /* standard Version Resource */
 
       svn_fs_txn_t *txn;
- svn_fs_root_t *txn_root;
+ svn_fs_root_t *txn_root, *id_root;
+ svn_fs_id_t *tmp_id;
       dav_error *err;
       int matches;
 
@@ -274,9 +275,13 @@
 
       /* assert: repos_path != NULL (for this type of resource) */
 
+ serr = svn_fs_id_root(&id_root, resource->info->repos->fs,
+ resource->pool);
+ serr = svn_fs_node_id(&tmp_id, id_root, resource->info->repos_path,
+ resource->pool);
       serr = svn_fs_txn_path_is_id(&matches, txn_root,
                                    resource->info->repos_path,
- resource->info->node_id,
+ tmp_id,
                                    resource->pool);
       if (serr != NULL)
         {
Index: ./subversion/mod_dav_svn/dav_svn.h
===================================================================
--- ./subversion/mod_dav_svn/dav_svn.h
+++ ./subversion/mod_dav_svn/dav_svn.h Fri May 24 00:52:11 2002
@@ -177,13 +177,6 @@
   /* what FS root this resource occurs within */
   dav_svn_root root;
 
- /* for VERSION resources: the node ID. may be NULL if the resource was
- fetched via a Baseline Collection (so use root.rev and repos_path). if
- the VERSION refers to a Baseline (.baselined==1), then node_id and
- repos_path will be NULL. */
- const svn_fs_id_t *node_id;
- const char *node_id_str;
-
   /* for PRIVATE resources: the private resource type */
   enum dav_svn_private_restype restype;
 
@@ -196,16 +189,6 @@
 
 
 /*
- For a given resource, return the path that should be used when talking
- to the FS. If a NODE_ID is present, then we must have opened an ID root,
- and that NODE_ID should be used. Otherwise, we opened a revision or txn
- root and should use a normal REPOS_PATH.
-*/
-#define DAV_SVN_REPOS_PATH(res) ((res)->info->node_id_str != NULL \
- ? (res)->info->node_id_str \
- : (res)->info->repos_path)
-
-/*
   LIVE PROPERTY HOOKS
 
   These are standard hooks defined by mod_dav. We implement them to expose
@@ -327,12 +310,13 @@
   BASELINE: REVISION should be specified
   BC: REVISION should be specified
   PUBLIC: PATH should be specified with a leading slash
- VERSION: PATH should be specified as a STABLE_ID ("/ID/PATH")
+ VERSION: REV_ROOT and PATH should be specified
   VCC: no additional params required
 */
 const char *dav_svn_build_uri(const dav_svn_repos *repos,
                               enum dav_svn_build_what what,
                               svn_revnum_t revision,
+ svn_fs_root_t *rev_root,
                               const char *path,
                               int add_href,
                               apr_pool_t *pool);
@@ -352,7 +336,6 @@
   svn_revnum_t rev;
   const char *repos_path;
   const char *activity_id;
- svn_fs_id_t *node_id;
 } dav_svn_uri_info;
 
 svn_error_t *dav_svn_simple_parse_uri(dav_svn_uri_info *info,
Index: ./subversion/mod_dav_svn/repos.c
===================================================================
--- ./subversion/mod_dav_svn/repos.c
+++ ./subversion/mod_dav_svn/repos.c Fri May 24 01:01:58 2002
@@ -84,8 +84,9 @@
                                      int use_checked_in)
 {
   const char *slash;
+ const char *created_rev_str;
 
- /* format: NODE_ID/REPOS_PATH */
+ /* format: CREATED_REV/REPOS_PATH */
 
   /* ### what to do with LABEL and USE_CHECKED_IN ?? */
 
@@ -95,17 +96,17 @@
   slash = ap_strchr_c(path, '/');
   if (slash == NULL)
     {
- /* http://host.name/repos/$svn/ver/1.2.3.4
+ /* http://host.name/repos/$svn/ver/0
 
          This URL form refers to the root path of the repository.
       */
- comb->priv.node_id = svn_fs_parse_id(path, strlen(path), comb->res.pool);
- comb->priv.node_id_str = path;
+ created_rev_str = apr_pstrndup(comb->res.pool, path, strlen(path));
+ comb->priv.root.rev = SVN_STR_TO_REV(created_rev_str);
       comb->priv.repos_path = "/";
     }
   else if (slash == path)
     {
- /* the NODE_ID was missing(?)
+ /* the CREATED_REV was missing(?)
 
          ### not sure this can happen, though, because it would imply two
          ### slashes, yet those are cleaned out within get_resource
@@ -116,13 +117,13 @@
     {
       apr_size_t len = slash - path;
 
- comb->priv.node_id = svn_fs_parse_id(path, len, comb->res.pool);
- comb->priv.node_id_str = apr_pstrndup(comb->res.pool, path, len);
+ created_rev_str = apr_pstrndup(comb->res.pool, path, len);
+ comb->priv.root.rev = SVN_STR_TO_REV(created_rev_str);
       comb->priv.repos_path = slash;
     }
 
- /* if the NODE_ID parsing blew, then propagate it. */
- if (comb->priv.node_id == NULL)
+ /* if the CREATED_REV parsing blew, then propagate it. */
+ if (comb->priv.root.rev == SVN_INVALID_REVNUM)
     return TRUE;
 
   return FALSE;
@@ -258,7 +259,7 @@
       comb->priv.root.rev = revnum;
 
       /* NOTE: comb->priv.repos_path == NULL */
- /* NOTE: comb->priv.node_id == NULL */
+ /* NOTE: comb->priv.created_rev == SVN_INVALID_REVNUM */
     }
 
   return FALSE;
@@ -328,7 +329,7 @@
   comb->priv.root.rev = revnum;
 
   /* NOTE: comb->priv.repos_path == NULL */
- /* NOTE: comb->priv.node_id == NULL */
+ /* NOTE: comb->priv.created_rev == SVN_INVALID_REVNUM */
 
   return FALSE;
 }
@@ -559,79 +560,42 @@
 {
   svn_error_t *serr;
 
- if (comb->priv.node_id != NULL)
- {
- /* we are accessing the Version Resource by ID */
-
- serr = svn_fs_id_root(&comb->priv.root.root, comb->priv.repos->fs,
- comb->res.pool);
+ /* we are accessing the Version Resource by REV/PATH */
+
+ /* ### assert: .baselined = TRUE */
+
+ /* if we don't have a revision, then assume the youngest */
+ if (!SVN_IS_VALID_REVNUM(comb->priv.root.rev))
+ {
+ serr = svn_fs_youngest_rev(&comb->priv.root.rev,
+ comb->priv.repos->fs,
+ comb->res.pool);
       if (serr != NULL)
         {
+ /* ### might not be a baseline */
+
           return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
- "Could not open the Subversion FS.");
- }
-
- serr = svn_fs_is_dir(&comb->res.collection,
- comb->priv.root.root,
- comb->priv.node_id_str,
- comb->res.pool);
- if (serr != NULL)
- {
- if (serr->apr_err != SVN_ERR_FS_NOT_FOUND)
- {
- return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
- "Could not determine whether the "
- "resource is a file or dir.");
- }
-
- /* exists == FALSE */
+ "Could not fetch 'youngest' revision "
+ "to enable accessing the latest "
+ "baseline resource.");
         }
- else
- {
- comb->res.exists = TRUE;
- }
-
- /* ### revise the URI to the "canonical" URI? necessary? */
- }
- else
- {
- /* we are accessing the Version Resource by REV/PATH */
-
- /* ### assert: .baselined = TRUE */
-
- /* if we don't have a revision, then assume the youngest */
- if (!SVN_IS_VALID_REVNUM(comb->priv.root.rev))
- {
- serr = svn_fs_youngest_rev(&comb->priv.root.rev,
- comb->priv.repos->fs,
- comb->res.pool);
- if (serr != NULL)
- {
- /* ### might not be a baseline */
-
- return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
- "Could not fetch 'youngest' revision "
- "to enable accessing the latest "
- "baseline resource.");
- }
- }
-
- /* ### baselines have no repos_path, and we don't need to open
- ### a root (yet). we just needed to ensure that we have the proper
- ### revision number. */
-
- /* ### we should probably check that the revision is valid */
- comb->res.exists = TRUE;
-
- /* Set up the proper URI. Most likely, we arrived here via a VCC,
- so the URI will be incorrect. Set the canonical form. */
- /* ### assuming a baseline */
- comb->res.uri = dav_svn_build_uri(comb->priv.repos,
- DAV_SVN_BUILD_URI_BASELINE,
- comb->priv.root.rev, NULL,
- 0 /* add_href */,
- comb->res.pool);
     }
+
+ /* ### baselines have no repos_path, and we don't need to open
+ ### a root (yet). we just needed to ensure that we have the proper
+ ### revision number. */
+
+ /* ### we should probably check that the revision is valid */
+ comb->res.exists = TRUE;
+
+ /* Set up the proper URI. Most likely, we arrived here via a VCC,
+ so the URI will be incorrect. Set the canonical form. */
+ /* ### assuming a baseline */
+ comb->res.uri = dav_svn_build_uri(comb->priv.repos,
+ DAV_SVN_BUILD_URI_BASELINE,
+ comb->priv.root.rev, NULL, NULL,
+ 0 /* add_href */,
+ comb->res.pool);
 
   return NULL;
 }
@@ -1113,16 +1077,9 @@
                                  res2->info->root.txn,
                                  res2->info->repos->pool);
         }
- else if (res2->info->node_id)
- {
- /* regenerate the id "root" object */
- (void) svn_fs_id_root(&(res2->info->root.root),
- res2->info->repos->fs,
- res2->info->repos->pool);
- }
       else if (res2->info->root.rev)
         {
- /* default: regenerate a revision "root" object */
+ /* default: regenerate the revision "root" object */
           (void) svn_fs_revision_root(&(res2->info->root.root),
                                       res2->info->repos->fs,
                                       res2->info->root.rev,
@@ -1317,8 +1274,7 @@
 const char * dav_svn_getetag(const dav_resource *resource)
 {
   svn_error_t *serr;
- svn_fs_id_t *id; /* ### want const here */
- svn_stringbuf_t *idstr;
+ svn_revnum_t created_rev;
 
   /* if the resource doesn't exist, isn't a simple REGULAR or VERSION
      resource, or it is a Baseline, then it has no etag. */
@@ -1331,15 +1287,16 @@
 
   /* ### what kind of etag to return for collections, activities, etc? */
 
- serr = svn_fs_node_id(&id, resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource), resource->pool);
- if (serr != NULL) {
- /* ### what to do? */
- return "";
- }
-
- idstr = svn_fs_unparse_id(id, resource->pool);
- return apr_psprintf(resource->pool, "\"%s\"", idstr->data);
+ if ((serr = svn_fs_node_created_rev(&created_rev, resource->info->root.root,
+ resource->info->repos_path,
+ resource->pool)))
+ {
+ /* ### what to do? */
+ return "";
+ }
+
+ return apr_psprintf(resource->pool, "\"%" SVN_REVNUM_T_FMT "/%s\"",
+ created_rev, resource->info->repos_path);
 }
 
 static dav_error * dav_svn_set_headers(request_rec *r,
@@ -1388,7 +1345,7 @@
 
       serr = svn_fs_node_prop(&value,
                               resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource),
+ resource->info->repos_path,
                               SVN_PROP_MIME_TYPE,
                               resource->pool);
       if (serr != NULL)
@@ -1401,7 +1358,7 @@
          so set up the Content-Length header */
       serr = svn_fs_file_length(&length,
                                 resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource),
+ resource->info->repos_path,
                                 resource->pool);
       if (serr != NULL)
         {
@@ -1482,7 +1439,7 @@
     int i;
 
     serr = svn_fs_dir_entries(&entries, resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource), resource->pool);
+ resource->info->repos_path, resource->pool);
     if (serr != NULL)
       return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                  "could not fetch directory entries");
@@ -1575,7 +1532,7 @@
 
       serr = svn_fs_file_contents(&stream,
                                   resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource),
+ resource->info->repos_path,
                                   resource->pool);
       if (serr != NULL)
         {
@@ -1628,7 +1585,6 @@
   {
     dav_svn_uri_info info;
     svn_fs_root_t *root;
- svn_stringbuf_t *id_str;
     int is_file;
     svn_txdelta_stream_t *txd_stream;
     svn_stream_t *o_stream;
@@ -1643,23 +1599,21 @@
     if (serr != NULL)
       return dav_svn_convert_err(serr, HTTP_BAD_REQUEST,
                                  "could not parse the delta base");
- if (info.node_id == NULL)
+ if (info.rev == SVN_INVALID_REVNUM)
       return dav_new_error(resource->pool, HTTP_BAD_REQUEST, 0,
                            "the delta base was not a version "
                            "resource URL");
 
     /* We are always accessing the base resource by ID, so open
        an ID root. */
- serr = svn_fs_id_root(&root, resource->info->repos->fs,
- resource->pool);
+ serr = svn_fs_revision_root(&root, resource->info->repos->fs,
+ info.rev, resource->pool);
     if (serr != NULL)
       return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                  "could not open a root for the base");
 
- id_str = svn_fs_unparse_id(info.node_id, resource->pool);
-
     /* verify that it is a file */
- serr = svn_fs_is_file(&is_file, root, id_str->data, resource->pool);
+ serr = svn_fs_is_file(&is_file, root, info.repos_path, resource->pool);
     if (serr != NULL)
       return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                  "could not determine if the base "
@@ -1670,9 +1624,9 @@
 
     /* Okay. Let's open up a delta stream for the client to read. */
     serr = svn_fs_get_file_delta_stream(&txd_stream,
- root, id_str->data,
+ root, info.repos_path,
                                         resource->info->root.root,
- DAV_SVN_REPOS_PATH(resource),
+ resource->info->repos_path,
                                         resource->pool);
     if (serr != NULL)
       return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
Index: ./subversion/mod_dav_svn/util.c
===================================================================
--- ./subversion/mod_dav_svn/util.c
+++ ./subversion/mod_dav_svn/util.c Fri May 24 00:38:00 2002
@@ -65,6 +65,7 @@
 const char *dav_svn_build_uri(const dav_svn_repos *repos,
                               enum dav_svn_build_what what,
                               svn_revnum_t revision,
+ svn_fs_root_t *rev_root,
                               const char *path,
                               int add_href,
                               apr_pool_t *pool)
@@ -93,9 +94,21 @@
                           href1, root_path, path, href2);
 
     case DAV_SVN_BUILD_URI_VERSION:
- /* path is the STABLE_ID */
- return apr_psprintf(pool, "%s%s/%s/ver/%s%s",
- href1, root_path, special_uri, path, href2);
+ {
+ svn_error_t *serr;
+ svn_revnum_t created_rev;
+
+ if ((serr = svn_fs_node_created_rev(&created_rev, rev_root,
+ path, pool)))
+ {
+ abort();
+ return NULL;
+ }
+
+ return apr_psprintf(pool, "%s%s/%s/ver/%" SVN_REVNUM_T_FMT "/%s%s",
+ href1, root_path, special_uri,
+ created_rev, path, href2);
+ }
 
     case DAV_SVN_BUILD_URI_VCC:
       return apr_psprintf(pool, "%s%s/%s/vcc/" DAV_SVN_DEFAULT_VCC_NAME "%s",
@@ -120,6 +133,7 @@
   apr_size_t len1;
   apr_size_t len2;
   const char *slash;
+ const char *created_rev_str;
 
   /* parse the input URI, in case it is more than just a path */
   if (apr_uri_parse(pool, uri, &comp) != APR_SUCCESS)
@@ -201,22 +215,24 @@
       info->activity_id = path + 5;
     }
   else if (len2 == 4 && memcmp(path, "/ver/", 5) == 0)
- {
+ {
       /* a version resource */
       path += 5;
       len1 -= 5;
       slash = ap_strchr_c(path, '/');
       if (slash == NULL)
         {
- info->node_id = svn_fs_parse_id(path, len1, pool);
+ created_rev_str = apr_pstrndup(pool, path, len1);
+ info->rev = SVN_STR_TO_REV(created_rev_str);
           info->repos_path = "/";
         }
       else
         {
- info->node_id = svn_fs_parse_id(path, slash - path, pool);
+ created_rev_str = apr_pstrndup(pool, path, slash - path);
+ info->rev = SVN_STR_TO_REV(created_rev_str);
           info->repos_path = slash;
         }
- if (info->node_id == NULL)
+ if (info->rev == SVN_INVALID_REVNUM)
         goto malformed_uri;
     }
   else

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 24 08:35:00 2002

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.