subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1634609 [8/11] - in /subversion/branches/move-tracking-2: ./ build/ notes/ subversion/ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_delta/ subversion/libsvn_fs/ subversion/libsvn_fs_base/ subv...
Date Mon, 27 Oct 2014 17:28:16 GMT
Modified: subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c?rev=1634609&r1=1634608&r2=1634609&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnadmin/svnadmin.c Mon Oct 27 17:28:13
2014
@@ -358,14 +358,16 @@ static const svn_opt_subcommand_desc2_t 
     } },
 
   {"delrevprop", subcommand_delrevprop, {0}, N_
-   ("usage: svnadmin delrevprop REPOS_PATH -r REVISION NAME\n\n"
-    "Delete the property NAME on revision REVISION. Use\n"
-    "--use-pre-revprop-change-hook/--use-post-revprop-change-hook to trigger\n"
-    "the revision property-related hooks (for example, if you want an email\n"
-    "notification sent from your post-revprop-change hook).\n\n"
+   ("usage: 1. svnadmin delrevprop -r REVISION REPOS_PATH NAME\n"
+    "                   2. svnadmin delrevprop -t TXN REPOS_PATH NAME\n\n"
+    "1. Delete the property NAME on revision REVISION.\n\n"
+    "Use --use-pre-revprop-change-hook/--use-post-revprop-change-hook to\n"
+    "trigger the revision property-related hooks (for example, if you want\n"
+    "an email notification sent from your post-revprop-change hook).\n\n"
     "NOTE: Revision properties are not versioned, so this command will\n"
-    "irreversibly destroy the previous value of the property.\n"),
-   {'r', svnadmin__use_pre_revprop_change_hook,
+    "irreversibly destroy the previous value of the property.\n\n"
+    "2. Delete the property NAME on transaction TXN.\n"),
+   {'r', 't', svnadmin__use_pre_revprop_change_hook,
     svnadmin__use_post_revprop_change_hook} },
 
   {"deltify", subcommand_deltify, {0}, N_
@@ -497,14 +499,16 @@ static const svn_opt_subcommand_desc2_t 
    {'r', svnadmin__bypass_hooks} },
 
   {"setrevprop", subcommand_setrevprop, {0}, N_
-   ("usage: svnadmin setrevprop REPOS_PATH -r REVISION NAME FILE\n\n"
-    "Set the property NAME on revision REVISION to the contents of FILE. Use\n"
-    "--use-pre-revprop-change-hook/--use-post-revprop-change-hook to trigger\n"
-    "the revision property-related hooks (for example, if you want an email\n"
-    "notification sent from your post-revprop-change hook).\n\n"
+   ("usage: 1. svnadmin setrevprop -r REVISION REPOS_PATH FILE\n"
+    "                   2. svnadmin setrevprop -t TXN REPOS_PATH FILE\n\n"
+    "1. Set the property NAME on revision REVISION to the contents of FILE.\n\n"
+    "Use --use-pre-revprop-change-hook/--use-post-revprop-change-hook to\n"
+    "trigger the revision property-related hooks (for example, if you want\n"
+    "an email notification sent from your post-revprop-change hook).\n\n"
     "NOTE: Revision properties are not versioned, so this command will\n"
-    "overwrite the previous value of the property.\n"),
-   {'r', svnadmin__use_pre_revprop_change_hook,
+    "overwrite the previous value of the property.\n\n"
+    "2. Set the property NAME on transaction TXN to the contents of FILE.\n"),
+   {'r', 't', svnadmin__use_pre_revprop_change_hook,
     svnadmin__use_post_revprop_change_hook} },
 
   {"setuuid", subcommand_setuuid, {0}, N_
@@ -1609,7 +1613,7 @@ subcommand_rmtxns(apr_getopt_t *os, void
 
 
 /* A helper for the 'setrevprop' and 'setlog' commands.  Expects
-   OPT_STATE->use_pre_revprop_change_hook and
+   OPT_STATE->txn_id, OPT_STATE->use_pre_revprop_change_hook and
    OPT_STATE->use_post_revprop_change_hook to be set appropriately.
    If FILENAME is NULL, delete property PROP_NAME.  */
 static svn_error_t *
@@ -1640,9 +1644,16 @@ set_revprop(const char *prop_name, const
   /* Open the filesystem  */
   SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
 
-  /* If we are bypassing the hooks system, we just hit the filesystem
-     directly. */
-  SVN_ERR(svn_repos_fs_change_rev_prop4(
+  if (opt_state->txn_id)
+    {
+      svn_fs_t *fs = svn_repos_fs(repos);
+      svn_fs_txn_t *txn;
+
+      SVN_ERR(svn_fs_open_txn(&txn, fs, opt_state->txn_id, pool));
+      SVN_ERR(svn_fs_change_txn_prop(txn, prop_name, prop_value, pool));
+    }
+  else
+    SVN_ERR(svn_repos_fs_change_rev_prop4(
               repos, opt_state->start_revision.value.number,
               NULL, prop_name, NULL, prop_value,
               opt_state->use_pre_revprop_change_hook,
@@ -1667,7 +1678,21 @@ subcommand_setrevprop(apr_getopt_t *os, 
   filename = APR_ARRAY_IDX(args, 1, const char *);
   SVN_ERR(target_arg_to_dirent(&filename, filename, pool));
 
-  if (opt_state->start_revision.kind != svn_opt_revision_number)
+  if (opt_state->txn_id)
+    {
+      if (opt_state->start_revision.kind != svn_opt_revision_unspecified
+          || opt_state->end_revision.kind != svn_opt_revision_unspecified)
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("--revision (-r) and --transaction (-t) "
+                                   "are mutually exclusive"));
+
+      if (opt_state->use_pre_revprop_change_hook
+          || opt_state->use_post_revprop_change_hook)
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("Calling hooks is incompatible with "
+                                   "--transaction (-t)"));
+    }
+  else if (opt_state->start_revision.kind != svn_opt_revision_number)
     return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                              _("Missing revision"));
   else if (opt_state->end_revision.kind != svn_opt_revision_unspecified)
@@ -2348,7 +2373,21 @@ subcommand_delrevprop(apr_getopt_t *os, 
   SVN_ERR(parse_args(&args, os, 1, 1, pool));
   prop_name = APR_ARRAY_IDX(args, 0, const char *);
 
-  if (opt_state->start_revision.kind != svn_opt_revision_number)
+  if (opt_state->txn_id)
+    {
+      if (opt_state->start_revision.kind != svn_opt_revision_unspecified
+          || opt_state->end_revision.kind != svn_opt_revision_unspecified)
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("--revision (-r) and --transaction (-t) "
+                                   "are mutually exclusive"));
+
+      if (opt_state->use_pre_revprop_change_hook
+          || opt_state->use_post_revprop_change_hook)
+        return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                 _("Calling hooks is incompatible with "
+                                   "--transaction (-t)"));
+    }
+  else if (opt_state->start_revision.kind != svn_opt_revision_number)
     return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                              _("Missing revision"));
   else if (opt_state->end_revision.kind != svn_opt_revision_unspecified)

Modified: subversion/branches/move-tracking-2/subversion/svnfsfs/dump-index-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnfsfs/dump-index-cmd.c?rev=1634609&r1=1634608&r2=1634609&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnfsfs/dump-index-cmd.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnfsfs/dump-index-cmd.c Mon Oct 27 17:28:13
2014
@@ -20,14 +20,11 @@
  * ====================================================================
  */
 
+#define APR_WANT_BYTEFUNC
+
 #include "svn_dirent_uri.h"
 #include "svn_pools.h"
-
-#include "../libsvn_fs_fs/fs.h"
-#include "../libsvn_fs_fs/index.h"
-#include "../libsvn_fs_fs/rev_file.h"
-#include "../libsvn_fs_fs/util.h"
-#include "../libsvn_fs/fs-loader.h"
+#include "private/svn_fs_fs_private.h"
 
 #include "svnfsfs.h"
 
@@ -50,6 +47,28 @@ fnv1_to_string(apr_uint32_t fnv1,
 static const char *item_type_str[]
   = {"none ", "frep ", "drep ", "fprop", "dprop", "node ", "chgs ", "rep  "};
 
+/* Implements svn_fs_fs__dump_index_func_t as printing one table row
+ * containing the fields of ENTRY to the console.
+ */
+static svn_error_t *
+dump_index_entry(const svn_fs_fs__p2l_entry_t *entry,
+                 void *baton,
+                 apr_pool_t *scratch_pool)
+{
+  const char *type_str
+    = entry->type < (sizeof(item_type_str) / sizeof(item_type_str[0]))
+    ? item_type_str[entry->type]
+    : "???";
+
+  printf("%12" APR_UINT64_T_HEX_FMT " %12" APR_UINT64_T_HEX_FMT
+         " %s %9ld %8" APR_UINT64_T_FMT " %s\n",
+         (apr_uint64_t)entry->offset, (apr_uint64_t)entry->size,
+         type_str, entry->item.revision, entry->item.number,
+         fnv1_to_string(entry->fnv1_checksum, scratch_pool));
+
+  return SVN_NO_ERROR;
+}
+
 /* Read the repository at PATH beginning with revision START_REVISION and
  * return the result in *FS.  Allocate caches with MEMSIZE bytes total
  * capacity.  Use POOL for non-cache allocations.
@@ -59,63 +78,17 @@ dump_index(const char *path,
            svn_revnum_t revision,
            apr_pool_t *pool)
 {
-  svn_fs_fs__revision_file_t *rev_file;
   svn_fs_t *fs;
-  int i;
-  apr_off_t offset, max_offset;
-  apr_pool_t *iterpool = svn_pool_create(pool);
 
   /* Check repository type and open it. */
   SVN_ERR(open_fs(&fs, path, pool));
 
-  /* Check the FS format. */
-  if (! svn_fs_fs__use_log_addressing(fs, revision))
-    return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, NULL);
-
-  /* Revision & index file access object. */
-  SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, revision, pool,
-                                           iterpool));
-
-  /* Offset range to cover. */
-  SVN_ERR(svn_fs_fs__p2l_get_max_offset(&max_offset, fs, rev_file, revision,
-                                        pool));
-
   /* Write header line. */
   printf("       Start       Length Type   Revision     Item Checksum\n");
 
-  /* Walk through all P2L index entries in offset order. */
-  for (offset = 0; offset < max_offset; )
-    {
-      apr_array_header_t *entries;
-
-      /* Read entries for the next block.  There will be no overlaps since
-       * we start at the first offset not covered. */
-      svn_pool_clear(iterpool);
-      SVN_ERR(svn_fs_fs__p2l_index_lookup(&entries, fs, rev_file, revision,
-                                          offset, INDEX_BLOCK_SIZE,
-                                          iterpool));
-
-      /* Print entries for this block, one line per entry. */
-      for (i = 0; i < entries->nelts && offset < max_offset; ++i)
-        {
-          const svn_fs_fs__p2l_entry_t *entry
-            = &APR_ARRAY_IDX(entries, i, const svn_fs_fs__p2l_entry_t);
-          const char *type_str
-            = entry->type < (sizeof(item_type_str) / sizeof(item_type_str[0]))
-            ? item_type_str[entry->type]
-            : "???";
-
-          offset = entry->offset + entry->size;
-
-          printf("%12" APR_UINT64_T_HEX_FMT " %12" APR_UINT64_T_HEX_FMT
-                 " %s %9ld %8" APR_UINT64_T_FMT " %s\n",
-                 (apr_uint64_t)entry->offset, (apr_uint64_t)entry->size,
-                 type_str, entry->item.revision, entry->item.number,
-                 fnv1_to_string(entry->fnv1_checksum, iterpool));
-        }
-    }
-
-  svn_pool_destroy(iterpool);
+  /* Dump the whole index contents */
+  SVN_ERR(svn_fs_fs__dump_index(fs, revision, dump_index_entry, NULL,
+                                check_cancel, NULL, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c?rev=1634609&r1=1634608&r2=1634609&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnfsfs/load-index-cmd.c Mon Oct 27 17:28:13
2014
@@ -25,12 +25,9 @@
 #include "svn_io.h"
 #include "svn_pools.h"
 
+#include "private/svn_fs_fs_private.h"
 #include "private/svn_sorts_private.h"
 
-#include "../libsvn_fs_fs/index.h"
-#include "../libsvn_fs_fs/transaction.h"
-#include "../libsvn_fs_fs/util.h"
-
 #include "svn_private_config.h"
 
 #include "svnfsfs.h"
@@ -168,45 +165,11 @@ load_index(const char *path,
        * Get a revision from (probably inside) the respective shard. */
       if (   revision == SVN_INVALID_REVNUM
           && entry->item.revision != SVN_INVALID_REVNUM)
-        {
-          revision = entry->item.revision;
-
-          /* Check the FS format number. */
-          if (! svn_fs_fs__use_log_addressing(fs, revision))
-            return svn_error_create(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, NULL);
-        }
-
-    }
-
-  /* Treat an empty array as a no-op instead error. */
-  if (entries->nelts != 0)
-    {
-      const char *l2p_proto_index;
-      const char *p2l_proto_index;
-      svn_fs_fs__revision_file_t *rev_file;
-
-      /* Open rev / pack file & trim indexes + footer off it. */
-      SVN_ERR(svn_fs_fs__open_pack_or_rev_file_writable(&rev_file, fs,
-                                                        revision, iterpool,
-                                                        iterpool));
-      SVN_ERR(svn_fs_fs__auto_read_footer(rev_file));
-      SVN_ERR(svn_io_file_trunc(rev_file->file, rev_file->l2p_offset,
-                                iterpool));
-
-      /* Create proto index files for the new index data
-       * (will be cleaned up automatically with iterpool). */
-      SVN_ERR(svn_fs_fs__p2l_index_from_p2l_entries(&p2l_proto_index, fs,
-                                                    rev_file, entries,
-                                                    iterpool, iterpool));
-      SVN_ERR(svn_fs_fs__l2p_index_from_p2l_entries(&l2p_proto_index, fs,
-                                                    entries, iterpool,
-                                                    iterpool));
-
-      /* Combine rev data with new index data. */
-      SVN_ERR(svn_fs_fs__add_index_data(fs, rev_file->file, l2p_proto_index,
-                                        p2l_proto_index, revision, iterpool));
+        revision = entry->item.revision;
     }
 
+  /* Rewrite the indexes. */
+  SVN_ERR(svn_fs_fs__load_index(fs, revision, entries, iterpool));
   svn_pool_destroy(iterpool);
 
   return SVN_NO_ERROR;



Mime
View raw message