[[[
Add "--show-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 "+" is new) and an
additional line appears after it with the details for where it was
copied from (path and revision).

  * subversion/svnlook/main.c
    (svnlook__show_copy_info): Add enum entry for new option.
    (options_table): Add 'show-copy-info' option.
    (cmd_table): Add svnlook__show_copy_info to 'changed'.
    (svnlook_opt_state): Add bool for show_copy_info option.
    (svnlook_ctxt_t): Add bool for show_copy_info option.
    (print_changed_tree): Add show_copy_info arg. Print copy
    info when option enabled. Pass new arg in recursive calls.
    (get_ctxt_baton): Handle new 'show_copy_info' option.
    (main): Handle new 'show_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__show_copy_info
   };
 
 /*
@@ -124,7 +125,10 @@
     {"full-paths", svnlook__full_paths, 0,
      N_("show full paths instead of indenting them")},
 
+    {"show-copy-info", svnlook__show_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__show_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 show_copy_info;   /* --show-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 show_copy_info;
   svn_revnum_t rev_id;
   svn_fs_txn_t *txn;
   const char *txn_name /* UTF-8! */;
@@ -479,6 +485,7 @@
 static svn_error_t *
 print_changed_tree (svn_repos_node_t *node,
                     const char *path /* UTF-8! */,
+                    svn_boolean_t show_copy_info,
                     apr_pool_t *pool)
 {
   const char *full_path;
@@ -511,10 +518,24 @@
   /* Print this node unless told to skip it. */
   if (print_me)
     {
-      SVN_ERR (svn_cmdline_printf (pool, "%s  %s%s\n",
-                                   status,
-                                   path,
-                                   node->kind == svn_node_dir ? "/" : ""));
+      if (show_copy_info && node->copyfrom_path) 
+        {
+          SVN_ERR (svn_cmdline_printf (pool, "%s+ %s%s\n",
+                                       status,
+                                       path,
+                                       node->kind == svn_node_dir ? "/" : ""));
+          SVN_ERR (svn_cmdline_printf (pool, "    (from %s%s:r%ld)\n",
+                                       node->copyfrom_path,
+                                       (node->kind == svn_node_dir ? "/" : ""),
+                                       node->copyfrom_rev));
+        }
+      else
+        {
+          SVN_ERR (svn_cmdline_printf (pool, "%s  %s%s\n",
+                                       status,
+                                       path,
+                                       node->kind == svn_node_dir ? "/" : ""));
+        }
     }
   
   /* Return here if the node has no children. */
@@ -525,13 +546,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, show_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, show_copy_info, subpool));
     }
   svn_pool_destroy (subpool);
 
@@ -1326,7 +1347,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->show_copy_info, pool));
 
   return SVN_NO_ERROR;
 }
@@ -1653,6 +1674,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->show_copy_info = opt_state->show_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 +2110,10 @@
           opt_state.full_paths = TRUE;
           break;
 
+        case svnlook__show_copy_info:
+          opt_state.show_copy_info = TRUE;
+          break;
+
         default:
           subcommand_help (NULL, NULL, pool);
           svn_pool_destroy (pool);

