Mathias.Weinert@gfa-net.de writes:
> While doing some work with subversion (thank you very much for developing
> and sharing this software!) I wanted to examine the directory tree of a
> repository and compare all paths with a given string. I thought it would
> be best to use 'svnlook tree' for this. Unfortunately this command uses
> indentation of the bottom level names instead of always displaying the
> complete path name. So I decided to create a new parameter option
> '--full-paths' which exactly does what I needed. If you find this an
> interesting new option feel free to add it to subversion.
Wouldn't 'svn ls --recursive --verbose' or something like that do what
you needed?
-Karl
> Log message:
> new parameter option '--full-paths' for 'svnlook tree'
> * svnlook/main.c
> new parameter option added to the 'svnlook tree' command which allows
> users to get the full path of each tree entry instead of getting the
> bottom level names indented.
>
>
> Diff:
> --- subversion/svnlook/main.c.orig 2004-10-13 10:35:57.000000000
> +0200
> +++ subversion/svnlook/main.c 2005-03-30 11:51:54.396306800 +0200
> @@ -74,7 +74,8 @@
> {
> svnlook__version = SVN_OPT_FIRST_LONGOPT_ID,
> svnlook__show_ids,
> - svnlook__no_diff_deleted
> + svnlook__no_diff_deleted,
> + svnlook__full_paths
> };
>
> /*
> @@ -109,6 +110,9 @@
> {"no-diff-deleted", svnlook__no_diff_deleted, 0,
> N_("do not print differences for deleted files")},
>
> + {"full-paths", svnlook__full_paths, 0,
> + N_("show full paths instead of indenting them")},
> +
> {0, 0, 0, 0}
> };
>
> @@ -186,7 +190,7 @@
> N_("usage: svnlook tree REPOS_PATH [PATH_IN_REPOS]\n\n"
> "Print the tree, starting at PATH_IN_REPOS (if supplied, at the
> root\n"
> "of the tree otherwise), optionally showing node revision
> ids.\n"),
> - {'r', 't', svnlook__show_ids} },
> + {'r', 't', svnlook__show_ids, svnlook__full_paths} },
>
> {"uuid", subcommand_uuid, {0},
> N_("usage: svnlook uuid REPOS_PATH\n\n"
> @@ -215,6 +219,7 @@
> svn_boolean_t help; /* --help */
> svn_boolean_t no_diff_deleted; /* --no-diff-deleted */
> svn_boolean_t verbose; /* --verbose */
> + svn_boolean_t full_paths; /* --full-paths */
> };
>
>
> @@ -225,6 +230,7 @@
> svn_boolean_t is_revision;
> svn_boolean_t show_ids;
> svn_boolean_t no_diff_deleted;
> + svn_boolean_t full_paths;
> svn_revnum_t rev_id;
> svn_fs_txn_t *txn;
> const char *txn_name /* UTF-8! */;
> @@ -1002,6 +1008,7 @@
> svn_boolean_t is_dir,
> int indentation,
> svn_boolean_t show_ids,
> + svn_boolean_t full_paths,
> apr_pool_t *pool)
> {
> apr_pool_t *subpool;
> @@ -1009,21 +1016,27 @@
> const char *name_native;
> apr_hash_t *entries;
> apr_hash_index_t *hi;
> + const char *print_path;
>
> SVN_ERR (check_cancel (NULL));
>
> /* Print the indentation. */
> - for (i = 0; i < indentation; i++)
> - {
> - SVN_ERR (svn_cmdline_fputs (" ", stdout, pool));
> - }
> + if(!full_paths)
> + for (i = 0; i < indentation; i++)
> + {
> + SVN_ERR (svn_cmdline_fputs (" ", stdout, pool));
> + }
>
> /* Print the node. */
> SVN_ERR (svn_utf_cstring_from_utf8 (&name_native,
> svn_path_basename (path, pool),
> pool));
> + if(!full_paths)
> + print_path = svn_path_basename (path, pool);
> + else
> + print_path = path;
> SVN_ERR (svn_cmdline_printf (pool, "%s%s",
> - svn_path_basename (path, pool),
> + print_path,
> is_dir ? "/" : ""));
>
> if (show_ids)
> @@ -1056,7 +1069,7 @@
> entry = val;
> SVN_ERR (print_tree (root, svn_path_join (path, entry->name, pool),
> entry->id, (entry->kind == svn_node_dir),
> - indentation + 1, show_ids, subpool));
> + indentation + 1, show_ids, full_paths,
> subpool));
> svn_pool_clear (subpool);
> }
> svn_pool_destroy (subpool);
> @@ -1516,6 +1529,7 @@
> do_tree (svnlook_ctxt_t *c,
> const char *path,
> svn_boolean_t show_ids,
> + svn_boolean_t full_paths,
> apr_pool_t *pool)
> {
> svn_fs_root_t *root;
> @@ -1525,7 +1539,7 @@
> SVN_ERR (get_root (&root, c, pool));
> SVN_ERR (svn_fs_node_id (&id, root, path, pool));
> SVN_ERR (svn_fs_is_dir (&is_dir, root, path, pool));
> - SVN_ERR (print_tree (root, path, id, is_dir, 0, show_ids, pool));
> + SVN_ERR (print_tree (root, path, id, is_dir, 0, show_ids, full_paths,
> pool));
> return SVN_NO_ERROR;
> }
>
> @@ -1554,6 +1568,7 @@
> svn_fs_set_warning_func (baton->fs, warning_func, NULL);
> baton->show_ids = opt_state->show_ids;
> baton->no_diff_deleted = opt_state->no_diff_deleted;
> + baton->full_paths = opt_state->full_paths;
> baton->is_revision = opt_state->txn ? FALSE : TRUE;
> baton->rev_id = opt_state->rev;
> baton->txn_name = apr_pstrdup (pool, opt_state->txn);
> @@ -1764,7 +1779,7 @@
>
> SVN_ERR (get_ctxt_baton (&c, opt_state, pool));
> SVN_ERR (do_tree (c, opt_state->arg1 ? opt_state->arg1 : "",
> - opt_state->show_ids, pool));
> + opt_state->show_ids, opt_state->full_paths, pool));
> return SVN_NO_ERROR;
> }
>
> @@ -1912,6 +1927,10 @@
> opt_state.no_diff_deleted = TRUE;
> break;
>
> + case svnlook__full_paths:
> + opt_state.full_paths = TRUE;
> + break;
> +
> default:
> subcommand_help (NULL, NULL, pool);
> svn_pool_destroy (pool);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 4 19:17:04 2005