[[[
Add "--copy-info" option to "svnlook changed" subcommand.

With this option, output for new entries in the repository created
using "svn copy" are prefixed with "A + " (the '+' used to be just
a ' ') and an additional line appears after it with the details for
where it was copied from (path and revision).

  * subversion/svnlook/main.c
    (svnlook__copy_info): Add enum entry for new option.
    (options_table): Add 'copy-info' option.
    (cmd_table): Add svnlook__copy_info to 'changed'.
    (svnlook_opt_state): Add bool for copy_info option.
    (svnlook_ctxt_t): Add bool for copy_info option.
    (print_changed_tree): Add copy_info arg. Print copy
    info when option enabled. Pass new arg in recursive calls.
    (get_ctxt_baton): Handle new 'copy_info' option.
    (main): Handle new 'copy_info' option.
]]]

Index: subversion/svnlook/main.c
===================================================================
--- subversion/svnlook/main.c	(revision 16222)
+++ subversion/svnlook/main.c	(working copy)
@@ -77,7 +77,8 @@
     svnlook__no_diff_added,
     svnlook__diff_copy_from,
     svnlook__revprop_opt,
-    svnlook__full_paths
+    svnlook__full_paths,
+    svnlook__copy_info
   };
 
 /*
@@ -124,7 +125,10 @@
     {"full-paths", svnlook__full_paths, 0,
      N_("show full paths instead of indenting them")},
 
+    {"copy-info", svnlook__copy_info, 0,
+     N_("show details for copies")},
 
+
     {0,               0, 0, 0}
   };
 
@@ -148,7 +152,7 @@
     {"changed", subcommand_changed, {0},
      N_("usage: svnlook changed REPOS_PATH\n\n"
         "Print the paths that were changed.\n"),
-     {'r', 't'} },
+     {'r', 't', svnlook__copy_info} },
     
     {"date", subcommand_date, {0},
      N_("usage: svnlook date REPOS_PATH\n\n"
@@ -243,6 +247,7 @@
   svn_boolean_t verbose;          /* --verbose */
   svn_boolean_t revprop;          /* --revprop */
   svn_boolean_t full_paths;       /* --full-paths */
+  svn_boolean_t copy_info;        /* --copy-info */
 };
 
 
@@ -256,6 +261,7 @@
   svn_boolean_t no_diff_added;
   svn_boolean_t diff_copy_from;
   svn_boolean_t full_paths;
+  svn_boolean_t copy_info;
   svn_revnum_t rev_id;
   svn_fs_txn_t *txn;
   const char *txn_name /* UTF-8! */;
@@ -479,10 +485,11 @@
 static svn_error_t *
 print_changed_tree (svn_repos_node_t *node,
                     const char *path /* UTF-8! */,
+                    svn_boolean_t copy_info,
                     apr_pool_t *pool)
 {
   const char *full_path;
-  char status[3] = "_ ";
+  char status[4] = "_  ";
   int print_me = 1;
   apr_pool_t *subpool;
 
@@ -493,7 +500,11 @@
 
   /* Print the node. */
   if (node->action == 'A')
-    status[0] = 'A';
+    {
+      status[0] = 'A';
+      if (node->copyfrom_path)
+        status[2] = '+';
+    }
   else if (node->action == 'D')
     status[0] = 'D';
   else if (node->action == 'R')
@@ -511,10 +522,15 @@
   /* Print this node unless told to skip it. */
   if (print_me)
     {
-      SVN_ERR (svn_cmdline_printf (pool, "%s  %s%s\n",
+      SVN_ERR (svn_cmdline_printf (pool, "%s %s%s\n",
                                    status,
                                    path,
                                    node->kind == svn_node_dir ? "/" : ""));
+      if (node->copyfrom_path) 
+        SVN_ERR (svn_cmdline_printf (pool, "    (from %s%s:r%ld)\n",
+                                     node->copyfrom_path,
+                                     (node->kind == svn_node_dir ? "/" : ""),
+                                     node->copyfrom_rev));
     }
   
   /* Return here if the node has no children. */
@@ -525,13 +541,13 @@
   /* Recursively handle the node's children. */
   subpool = svn_pool_create (pool);  
   full_path = svn_path_join (path, node->name, subpool);
-  SVN_ERR (print_changed_tree (node, full_path, subpool));
+  SVN_ERR (print_changed_tree (node, full_path, copy_info, subpool));
   while (node->sibling)
     {
       svn_pool_clear (subpool);
       node = node->sibling;
       full_path = svn_path_join (path, node->name, subpool);
-      SVN_ERR (print_changed_tree (node, full_path, subpool));
+      SVN_ERR (print_changed_tree (node, full_path, copy_info, subpool));
     }
   svn_pool_destroy (subpool);
 
@@ -1326,7 +1342,7 @@
   SVN_ERR (generate_delta_tree (&tree, c->repos, root, base_rev_id, 
                                 TRUE, pool)); 
   if (tree)
-    SVN_ERR (print_changed_tree (tree, "", pool));
+    SVN_ERR (print_changed_tree (tree, "", c->copy_info, pool));
 
   return SVN_NO_ERROR;
 }
@@ -1653,6 +1669,7 @@
   baton->no_diff_added = opt_state->no_diff_added;
   baton->diff_copy_from = opt_state->diff_copy_from;
   baton->full_paths = opt_state->full_paths;
+  baton->copy_info = opt_state->copy_info;
   baton->is_revision = opt_state->txn ? FALSE : TRUE;
   baton->rev_id = opt_state->rev;
   baton->txn_name = apr_pstrdup (pool, opt_state->txn);
@@ -2088,6 +2105,10 @@
           opt_state.full_paths = TRUE;
           break;
 
+        case svnlook__copy_info:
+          opt_state.copy_info = TRUE;
+          break;
+
         default:
           subcommand_help (NULL, NULL, pool);
           svn_pool_destroy (pool);

