You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/09/16 23:19:16 UTC

svn commit: r1703464 - /subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c

Author: julianfoad
Date: Wed Sep 16 21:19:16 2015
New Revision: 1703464

URL: http://svn.apache.org/r1703464
Log:
On the 'move-tracking-2' branch: Add an 'svnmover cat' subcommand.

* subversion/svnmover/svnmover.c
  (action_code_t,
   action_defn): Define the new 'cat' subcommand.
  (do_cat): New.
  (execute): Call it.

Modified:
    subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c

Modified: subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c?rev=1703464&r1=1703463&r2=1703464&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c (original)
+++ subversion/branches/move-tracking-2/subversion/svnmover/svnmover.c Wed Sep 16 21:19:16 2015
@@ -569,6 +569,7 @@ typedef enum action_code_t {
   ACTION_MV,
   ACTION_MKDIR,
   ACTION_PUT_FILE,
+  ACTION_CAT,
   ACTION_CP,
   ACTION_RM,
   ACTION_CP_RM,
@@ -636,6 +637,8 @@ static const action_defn_t action_defn[]
   {ACTION_PUT_FILE,         "put", 2, "LOCAL_FILE PATH",
     "add or modify file PATH with text copied from" NL
     "LOCAL_FILE (use \"-\" to read from standard input)"},
+  {ACTION_CAT,              "cat", 1, "PATH",
+    "display text (for a file) and props (if any) of PATH"},
   {ACTION_COMMIT,           "commit", 0, "",
     "commit the changes"},
   {ACTION_UPDATE,           "update", 1, ".@REV",
@@ -2094,7 +2097,7 @@ do_put_file(svn_editor3_t *editor,
             const char *file_name,
             apr_pool_t *scratch_pool)
 {
-  apr_hash_t *props = apr_hash_make(scratch_pool);
+  apr_hash_t *props;
   svn_stringbuf_t *text;
   int parent_eid;
   const char *name;
@@ -2170,6 +2173,38 @@ do_put_file(svn_editor3_t *editor,
 
 /*  */
 static svn_error_t *
+do_cat(svn_editor3_t *editor,
+       svn_branch_el_rev_id_t *file_el_rev,
+       apr_pool_t *scratch_pool)
+{
+  apr_hash_t *props;
+  svn_stringbuf_t *text;
+  apr_hash_index_t *hi;
+
+  /* get existing props */
+  svn_branch_el_rev_content_t *existing_element
+    = svn_branch_get_element(file_el_rev->branch, file_el_rev->eid);
+
+  SVN_ERR(svn_editor3_payload_resolve(editor, existing_element));
+  props = existing_element->payload->props;
+  text = existing_element->payload->text;
+
+  for (hi = apr_hash_first(scratch_pool, props); hi; hi = apr_hash_next(hi))
+    {
+      const char *pname = apr_hash_this_key(hi);
+      svn_string_t *pval = apr_hash_this_val(hi);
+
+      notify("property '%s': '%s'", pname, pval->data);
+    }
+  if (text)
+    {
+      notify("%s", text->data);
+    }
+  return SVN_NO_ERROR;
+}
+
+/*  */
+static svn_error_t *
 svn_branch_find_predecessor_el_rev(svn_branch_el_rev_id_t **new_el_rev_p,
                                    svn_branch_el_rev_id_t *old_el_rev,
                                    apr_pool_t *result_pool)
@@ -3276,6 +3311,13 @@ execute(svnmover_wc_t *wc,
                               iterpool));
           break;
 
+        case ACTION_CAT:
+          VERIFY_EID_EXISTS("rm", 0);
+          SVN_ERR(do_cat(editor,
+                         arg[0]->el_rev,
+                         iterpool));
+          break;
+
         case ACTION_COMMIT:
           {
             svn_revnum_t new_rev;