subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1627352 - in /subversion/branches/move-tracking-2/subversion: include/private/svn_editor3.h libsvn_delta/compat3.c libsvn_ra/ra_loader.c libsvn_ra_local/ra_plugin.c libsvn_repos/commit.c libsvn_wc/util.c libsvn_wc/wc.h
Date Wed, 24 Sep 2014 16:08:19 GMT
Author: julianfoad
Date: Wed Sep 24 16:08:18 2014
New Revision: 1627352

URL: http://svn.apache.org/r1627352
Log:
On the 'move-tracking-2' branch: Extend the editor shim 'fetch' callbacks to
support fetching a directory's children.

The facility is not yet used, but my in-progress move-tracking demo code
might want to use it.

* subversion/include/private/svn_editor3.h
  (svn_editor3__shim_fetch_func_t): Add a 'children_names' output.

* subversion/libsvn_delta/compat3.c
  (...everywhere...): Pass NULL for the new parameter.

* subversion/libsvn_ra_local/ra_plugin.c
  (fetch_func): Implement fetching children's names.

* subversion/libsvn_ra/ra_loader.c
  (fetch): Same.

* subversion/libsvn_repos/commit.c
  (fetch_func): Same.

* subversion/libsvn_wc/wc.h,
  subversion/libsvn_wc/util.c
  (svn_wc__fetch_func): Add the new parameter, but not implemented.

Modified:
    subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
    subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
    subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c
    subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h

Modified: subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/private/svn_editor3.h Wed Sep 24
16:08:18 2014
@@ -1446,6 +1446,7 @@ typedef svn_error_t *(*svn_editor3__shim
   svn_node_kind_t *kind,
   apr_hash_t **props,
   svn_stringbuf_t **file_text,
+  apr_hash_t **children_names,
   void *baton,
   const char *repos_relpath,
   svn_revnum_t revision,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat3.c Wed Sep 24 16:08:18
2014
@@ -977,7 +977,7 @@ apply_propedit(struct ev3_edit_baton *eb
          Otherwise, we get the properties from BASE.  */
       if (copyfrom_path)
         {
-          SVN_ERR(eb->fetch_func(NULL, &change->props, NULL,
+          SVN_ERR(eb->fetch_func(NULL, &change->props, NULL, NULL,
                                  eb->fetch_baton,
                                  copyfrom_path, copyfrom_rev,
                                  eb->edit_pool, scratch_pool));
@@ -994,7 +994,7 @@ apply_propedit(struct ev3_edit_baton *eb
           if (! SVN_IS_VALID_REVNUM(base_revision))
             SVN_DBG(("apply_propedit('%s@%ld')  ### need to resolve to HEAD?",
                      relpath, base_revision));
-          SVN_ERR(eb->fetch_func(NULL, &change->props, NULL,
+          SVN_ERR(eb->fetch_func(NULL, &change->props, NULL, NULL,
                                  eb->fetch_baton,
                                  relpath, base_revision,
                                  eb->edit_pool, scratch_pool));
@@ -1194,7 +1194,7 @@ ev3_add_file(const char *path,
                                                    fb->eb->edit_pool);
       change->copyfrom_rev = copyfrom_revision;
 
-      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_text,
+      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_text, NULL,
                                  fb->eb->fetch_baton,
                                  change->copyfrom_path,
                                  change->copyfrom_rev,
@@ -1250,14 +1250,14 @@ ev3_open_file(const char *path,
 
       fb->copyfrom_relpath = copyfrom_relpath;
       fb->copyfrom_rev = pb->copyfrom_rev;
-      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_text,
+      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_text, NULL,
                                  fb->eb->fetch_baton,
                                  copyfrom_relpath, pb->copyfrom_rev,
                                  result_pool, scratch_pool));
     }
   else
     {
-      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_text,
+      SVN_ERR(fb->eb->fetch_func(NULL, NULL, &fb->delta_base_text, NULL,
                                  fb->eb->fetch_baton,
                                  relpath, base_revision,
                                  result_pool, scratch_pool));
@@ -1864,7 +1864,7 @@ fetch_base_props(apr_hash_t **base_props
 
   if (source_path)
     {
-      SVN_ERR(fetch_func(NULL, base_props, NULL,
+      SVN_ERR(fetch_func(NULL, base_props, NULL, NULL,
                          fetch_baton, source_path, source_rev,
                          result_pool, scratch_pool));
     }
@@ -2257,7 +2257,7 @@ editor3_cp(void *baton,
   change->copyfrom_rev = from_peg_loc.rev;
   /* We need the source's kind to know whether to call add_directory()
      or add_file() later on.  */
-  SVN_ERR(eb->fetch_func(&change->kind, NULL, NULL,
+  SVN_ERR(eb->fetch_func(&change->kind, NULL, NULL, NULL,
                          eb->fetch_baton,
                          from_peg_loc.relpath, from_peg_loc.rev,
                          scratch_pool, scratch_pool));
@@ -2296,7 +2296,7 @@ editor3_mv(void *baton,
      already recorded a change -- an earlier move, I suppose -- then the
      'kind' has already been recorded there and we could potentially
      re-use it here. But we have no need yet to optimise that case.) */
-  SVN_ERR(eb->fetch_func(&change->kind, NULL, NULL, eb->fetch_baton,
+  SVN_ERR(eb->fetch_func(&change->kind, NULL, NULL, NULL, eb->fetch_baton,
                          from_loc.relpath, from_loc.rev,
                          scratch_pool, scratch_pool));
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra/ra_loader.c Wed Sep 24 16:08:18
2014
@@ -768,6 +768,7 @@ static svn_error_t *
 fetch(svn_node_kind_t *kind_p,
       apr_hash_t **props_p,
       svn_stringbuf_t **file_text,
+      apr_hash_t **children_names,
       void *baton,
       const char *repos_relpath,
       svn_revnum_t revision,
@@ -778,6 +779,13 @@ fetch(svn_node_kind_t *kind_p,
   svn_node_kind_t kind;
   apr_hash_index_t *hi;
 
+  if (props_p)
+    *props_p = NULL;
+  if (file_text)
+    *file_text = NULL;
+  if (children_names)
+    *children_names = NULL;
+
   SVN_ERR(svn_ra_check_path(fbb->session, repos_relpath, revision,
                             &kind, scratch_pool));
   if (kind_p)
@@ -798,13 +806,17 @@ fetch(svn_node_kind_t *kind_p,
           SVN_ERR(svn_stream_close(file_stream));
         }
     }
-  else if (props_p)
+  else if (kind == svn_node_dir && (props_p || children_names))
     {
-      SVN_ERR(svn_ra_get_dir(fbb->session, repos_relpath, revision,
-                             NULL /*dirents*/, NULL, props_p, result_pool));
+      SVN_ERR(svn_ra_get_dir2(fbb->session,
+                              children_names, NULL, props_p,
+                              repos_relpath, revision,
+                              0 /*minimal child info*/,
+                              result_pool));
     }
+
   /* Remove non-regular props */
-  if (props_p)
+  if (props_p && *props_p)
     {
       for (hi = apr_hash_first(scratch_pool, *props_p); hi; hi = apr_hash_next(hi))
         {

Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_local/ra_plugin.c Wed Sep 24
16:08:18 2014
@@ -918,6 +918,7 @@ static svn_error_t *
 fetch_func(svn_node_kind_t *kind_p,
            apr_hash_t **props_p,
            svn_stringbuf_t **file_text,
+           apr_hash_t **children_names,
            void *baton,
            const char *repos_relpath,
            svn_revnum_t revision,
@@ -968,7 +969,7 @@ fetch_func(svn_node_kind_t *kind_p,
       else if (kind == svn_node_dir && props_p)
         {
           SVN_ERR(svn_ra_local__get_dir(fb->session,
-                                        NULL /*dirents*/, NULL /*fetched_rev*/,
+                                        children_names, NULL /*fetched_rev*/,
                                         props_p, session_relpath, revision,
                                         0 /*dirent_fields*/, result_pool));
         }

Modified: subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_repos/commit.c Wed Sep 24 16:08:18
2014
@@ -841,6 +841,7 @@ static svn_error_t *
 fetch_func(svn_node_kind_t *kind,
            apr_hash_t **props,
            svn_stringbuf_t **file_text,
+           apr_hash_t **children_names,
            void *baton,
            const char *repos_relpath,
            svn_revnum_t revision,
@@ -854,6 +855,13 @@ fetch_func(svn_node_kind_t *kind,
   if (!SVN_IS_VALID_REVNUM(revision))
     revision = svn_fs_txn_base_revision(eb->txn);
 
+  if (props)
+    *props = NULL;
+  if (file_text)
+    *file_text = NULL;
+  if (children_names)
+    *children_names = NULL;
+
   SVN_ERR(svn_fs_revision_root(&fs_root, eb->fs, revision, scratch_pool));
 
   if (kind)
@@ -891,6 +899,18 @@ fetch_func(svn_node_kind_t *kind,
       SVN_ERR(svn_stringbuf_from_stream(file_text, contents, 0, result_pool));
     }
 
+  if (children_names)
+    {
+      err = svn_fs_dir_entries(children_names, fs_root, repos_relpath,
+                               scratch_pool);
+      if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
+        {
+          svn_error_clear(err);
+          return SVN_NO_ERROR;
+        }
+      else if (err)
+        return svn_error_trace(err);
+    }
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/util.c Wed Sep 24 16:08:18 2014
@@ -421,6 +421,7 @@ svn_error_t *
 svn_wc__fetch_func(svn_node_kind_t *kind,
                    apr_hash_t **props,
                    svn_stringbuf_t **file_text,
+                   apr_hash_t **children_names,  /* ### unimplemented */
                    void *baton,
                    const char *repos_relpath,
                    svn_revnum_t revision,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h?rev=1627352&r1=1627351&r2=1627352&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/wc.h Wed Sep 24 16:08:18 2014
@@ -749,6 +749,7 @@ svn_error_t *
 svn_wc__fetch_func(svn_node_kind_t *kind,
                    apr_hash_t **props,
                    svn_stringbuf_t **file_text,
+                   apr_hash_t **children_names,
                    void *baton,
                    const char *repos_relpath,
                    svn_revnum_t revision,



Mime
View raw message