[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn status ignore svn:ignore [PATCH]

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-07-27 01:49:30 CEST

Blair Zajac <blair@orcaware.com> writes:
> Could somebody review this? I'll submit it myself to raise my
> score in the Karl Fogel commit race!

Oh dear me! We don't want a commit race here...

I don't have time to review this right now, but I also promise to
refrain from further commits today, to give Blair a chance :-).

-K

> Add --no-ignore command line option to svn status to disregard svn's
> default ignore list and any svn:ignore properties.
>
> * subversion/include/svn_wc.h (svn_wc_statuses):
> New argument svn_boolean_t no_ignore.
>
> * subversion/include/svn_client.h (svn_client_status):
> New argument svn_boolean_t no_ignore.
>
> * subversion/libsvn_wc/status.c
> (add_unversioned_items):
> New argument svn_boolean_t no_ignore and test it whether to use
> default ignore regular expressions and svn:ignore properties.
> (svn_wc_statuses):
> New argument svn_boolean_t no_ignore and pass it to itself on
> recursion and to add_unversioned_items.
>
> * subversion/libsvn_client/delete.c
> (svn_client__can_delete):
> Pass FALSE for svn_wc_statuses new no_ignore argument.
>
> * subversion/libsvn_client/status.c
> (svn_client_status):
> New argument svn_boolean_t no_ignore and pass down to
> svn_wc_statuses.
>
> * subversion/clients/cmdline/cl.h:
> Add svn_cl__no_ignore_opt to svn_cl__longopt_t.
>
> * subversion/clients/cmdline/status-cmd.c (svn_cl__status):
> Pass no_ignore command line option setting down to
> svn_client_status.
>
> * subversion/clients/cmdline/main.c:
> Add "no-ignore" to svn_cl__options and to valid 'status' command
> line options.
> (main): Set opt_state.no_ignore appropriately.
>
> * subversion/clients/cmdline/status-cmd.c
> (svn_cl__status):
> Take command line option no_ignore flag and pass down to
> svn_client_status.
>
> * subversion/libsvn_client/status.c
> (svn_client_status):
> Take no_ignore flag and pass it down to svn_wc_statuses.
>
> * doc/handbook/client.texi (Examine your changes):
> List svn's default list of ignore regular expressions.
> Document svn status' --no-ignore command line option.Index: ./subversion/include/svn_wc.h
> ===================================================================
> --- ./subversion/include/svn_wc.h
> +++ ./subversion/include/svn_wc.h Fri Jul 26 15:31:23 2002
> @@ -505,17 +505,18 @@
> /* Fill *STATUS for PATH, allocating in POOL, with the exception of
> the repos_rev field, which is normally filled in by the caller.
>
> Here are some things to note about the returned structure. A quick
> examination of the STATUS->text_status after a successful return of
> this function can reveal the following things:
>
> svn_wc_status_none : PATH is not versioned, and is either not
> - present on disk, or is ignored by the
> + present on disk, or is ignored by svn's
> + default ignore regular expressions or the
> svn:ignore property setting for PATH's
> parent directory.
>
> svn_wc_status_absent : PATH is versioned, but is missing from
> the working copy.
>
> svn_wc_status_unversioned : PATH is not versioned, but is
> present on disk and not being
> @@ -556,16 +557,17 @@
> * If DESCEND is non-zero, statushash will contain statuses for PATH
> * and everything below it, including subdirectories. In other
> * words, a full recursion. */
> svn_error_t *svn_wc_statuses (apr_hash_t *statushash,
> const char *path,
> svn_boolean_t descend,
> svn_boolean_t get_all,
> svn_boolean_t strict,
> + svn_boolean_t no_ignore,
> apr_pool_t *pool);
>
>
> /* Set *EDITOR and *EDIT_BATON to an editor that tweaks or adds
> svn_wc_status_t structures to STATUSHASH to reflect repository
> modifications that would be received on update, and that sets
> *YOUNGEST to the youngest revision in the repository (the editor
> also sets the repos_rev field in each svn_wc_status_t structure
> Index: ./subversion/include/svn_client.h
> ===================================================================
> --- ./subversion/include/svn_client.h
> +++ ./subversion/include/svn_client.h Fri Jul 26 15:10:38 2002
> @@ -527,16 +527,17 @@
> svn_error_t *
> svn_client_status (apr_hash_t **statushash,
> svn_revnum_t *youngest, /* only touched if `update' set */
> const char *path,
> svn_client_auth_baton_t *auth_baton,
> svn_boolean_t descend,
> svn_boolean_t get_all,
> svn_boolean_t update,
> + svn_boolean_t no_ignore,
> apr_pool_t *pool);
>
>
> /* Invoke RECEIVER with RECEIVER_BATON on each log message from START
> to END in turn, inclusive (but never invoke RECEIVER on a given log
> message more than once).
>
> TARGETS contains all the working copy paths (as const char *'s)
> Index: ./subversion/libsvn_wc/status.c
> ===================================================================
> --- ./subversion/libsvn_wc/status.c
> +++ ./subversion/libsvn_wc/status.c Fri Jul 26 15:51:59 2002
> @@ -284,30 +284,34 @@
>
> /* Add all items that are NOT in ENTRIES (which is a list of PATH's
> versioned things) to the STATUSHASH as unversioned items,
> allocating everything in POOL. */
> static svn_error_t *
> add_unversioned_items (const char *path,
> apr_hash_t *entries,
> apr_hash_t *statushash,
> + svn_boolean_t no_ignore,
> apr_pool_t *pool)
> {
> apr_pool_t *subpool = svn_pool_create (pool);
> apr_hash_t *dirents;
> apr_hash_index_t *hi;
> apr_array_header_t *patterns;
>
> /* Read PATH's dirents. */
> SVN_ERR (svn_io_get_dirents (&dirents, path, subpool));
>
> - /* Try to load any '.svnignore' file that may be present. */
> + /* Try to add any svn:ignore properties on the parent directory. */
> patterns = apr_array_make (subpool, 1, sizeof(const char *));
> - add_default_ignores (patterns);
> - SVN_ERR (add_ignore_patterns (path, patterns, subpool));
> + if (! no_ignore)
> + {
> + add_default_ignores (patterns);
> + SVN_ERR (add_ignore_patterns (path, patterns, subpool));
> + }
>
> /* Add empty status structures for each of the unversioned things. */
> for (hi = apr_hash_first (subpool, dirents); hi; hi = apr_hash_next (hi))
> {
> const void *key;
> apr_ssize_t klen;
> void *val;
> const char *keystring;
> @@ -389,16 +393,17 @@
>
>
> svn_error_t *
> svn_wc_statuses (apr_hash_t *statushash,
> const char *path,
> svn_boolean_t descend,
> svn_boolean_t get_all,
> svn_boolean_t strict,
> + svn_boolean_t no_ignore,
> apr_pool_t *pool)
> {
> enum svn_node_kind kind;
> svn_wc_entry_t *entry;
>
> /* Is PATH a directory or file? */
> SVN_ERR (svn_io_check_path (path, &kind, pool));
>
> @@ -445,17 +450,18 @@
> return svn_error_createf
> (SVN_ERR_WC_NOT_DIRECTORY, 0, NULL, pool,
> "svn_wc_statuses: %s is not a working copy directory", path);
>
> /* Load entries file for the directory into the requested pool. */
> SVN_ERR (svn_wc_entries_read (&entries, path, FALSE, pool));
>
> /* Add the unversioned items to the status output. */
> - SVN_ERR (add_unversioned_items (path, entries, statushash, pool));
> + SVN_ERR (add_unversioned_items (path, entries, statushash,
> + no_ignore, pool));
>
> /* Loop over entries hash */
> for (hi = apr_hash_first (pool, entries); hi; hi = apr_hash_next (hi))
> {
> const void *key;
> void *val;
> const char *base_name;
>
> @@ -503,18 +509,19 @@
> their full entry from their own THIS_DIR entry.
> svn_wc_entry does this for us if it can. */
> svn_wc_entry_t *subdir;
>
> SVN_ERR (svn_wc_entry (&subdir, fullpath, FALSE, pool));
> SVN_ERR (add_status_structure (statushash, fullpath,
> subdir, get_all,
> strict, pool));
> - SVN_ERR (svn_wc_statuses (statushash, fullpath,
> - descend, get_all, strict, pool));
> + SVN_ERR (svn_wc_statuses (statushash, fullpath, descend,
> + get_all, strict, no_ignore,
> + pool));
> }
> else if ((kind == svn_node_file) || (kind == svn_node_none))
> {
> /* File entries are ... just fine! */
> SVN_ERR (add_status_structure (statushash, fullpath,
> entry, get_all,
> strict, pool));
> }
> Index: ./subversion/libsvn_client/delete.c
> ===================================================================
> --- ./subversion/libsvn_client/delete.c
> +++ ./subversion/libsvn_client/delete.c Fri Jul 26 14:57:23 2002
> @@ -37,17 +37,17 @@
>
> svn_error_t *
> svn_client__can_delete (const char *path,
> apr_pool_t *pool)
> {
> apr_hash_t *hash = apr_hash_make (pool);
> apr_hash_index_t *hi;
>
> - SVN_ERR (svn_wc_statuses (hash, path, TRUE, FALSE, TRUE, pool));
> + SVN_ERR (svn_wc_statuses (hash, path, TRUE, FALSE, TRUE, FALSE, pool));
> for (hi = apr_hash_first (pool, hash); hi; hi = apr_hash_next (hi))
> {
> const void *key;
> void *val;
> const char *name;
> const svn_wc_status_t *statstruct;
>
> apr_hash_this (hi, &key, NULL, &val);
> Index: ./subversion/libsvn_client/status.c
> ===================================================================
> --- ./subversion/libsvn_client/status.c
> +++ ./subversion/libsvn_client/status.c Fri Jul 26 15:59:43 2002
> @@ -141,16 +141,17 @@
> svn_error_t *
> svn_client_status (apr_hash_t **statushash,
> svn_revnum_t *youngest,
> const char *path,
> svn_client_auth_baton_t *auth_baton,
> svn_boolean_t descend,
> svn_boolean_t get_all,
> svn_boolean_t update,
> + svn_boolean_t no_ignore,
> apr_pool_t *pool)
> {
> apr_hash_t *hash = apr_hash_make (pool);
> svn_boolean_t strict;
>
> /* If we're not updating, we might be getting new paths from the
> repository, and we don't want svn_wc_statuses to error on these
> paths. However, if we're not updating and we see a path that
> @@ -159,20 +160,21 @@
> strict = FALSE;
> else
> strict = TRUE;
>
> /* Ask the wc to give us a list of svn_wc_status_t structures.
> These structures contain nothing but information found in the
> working copy.
>
> - Pass the GET_ALL and DESCEND flags; this working copy function
> - understands these flags too, and will return the correct set of
> - structures. */
> - SVN_ERR (svn_wc_statuses (hash, path, descend, get_all, strict, pool));
> + Pass the GET_ALL, DESCEND and NO_IGNORE flags; this working copy
> + function understands these flags too, and will return the correct
> + set of structures. */
> + SVN_ERR (svn_wc_statuses (hash, path, descend, get_all,
> + strict, no_ignore, pool));
>
>
> /* If the caller wants us to contact the repository also... */
> if (update)
> /* Add "dry-run" update information to our existing structures.
> (Pass the DESCEND flag here, since we may want to ignore update
> info that is below PATH.) */
> SVN_ERR (add_update_info_to_status_hash (hash, youngest, path,
> Index: ./subversion/clients/cmdline/cl.h
> ===================================================================
> --- ./subversion/clients/cmdline/cl.h
> +++ ./subversion/clients/cmdline/cl.h Fri Jul 26 15:36:46 2002
> @@ -46,17 +46,18 @@
> svn_cl__ancestor_path_opt,
> svn_cl__force_opt,
> svn_cl__msg_encoding_opt,
> svn_cl__version_opt,
> svn_cl__auth_username_opt,
> svn_cl__auth_password_opt,
> svn_cl__targets_opt,
> svn_cl__xml_opt,
> - svn_cl__strict_opt
> + svn_cl__strict_opt,
> + svn_cl__no_ignore_opt,
> } svn_cl__longopt_t;
>
>
>
> /*** Command dispatch. ***/
>
> /* Hold results of option processing that are shared by multiple
> commands. */
> @@ -85,16 +86,17 @@
> svn_stringbuf_t *filedata; /* contents of file used as option data */
> const char *filedata_encoding; /* the locale/encoding of the filedata*/
> svn_boolean_t help; /* print usage message */
> const char *auth_username; /* auth username */ /* UTF-8! */
> const char *auth_password; /* auth password */ /* UTF-8! */
> const char *extensions; /* subprocess extension args */ /* UTF-8! */
> apr_array_header_t *targets; /* target list from file */ /* UTF-8! */
> svn_boolean_t xml; /* output in xml, e.g., "svn log --xml" */
> + svn_boolean_t no_ignore; /* do not ignore any files */
>
> } svn_cl__opt_state_t;
>
>
> /* All client command procedures conform to this prototype. OPT_STATE
> * likewise should hold the result of processing the options. OS is a
> * list of filenames and directories, a-la CVS (which really only
> * becomes useful if you pass it into svn_cl__args_to_target_array()
> Index: ./subversion/clients/cmdline/status-cmd.c
> ===================================================================
> --- ./subversion/clients/cmdline/status-cmd.c
> +++ ./subversion/clients/cmdline/status-cmd.c Fri Jul 26 15:09:49 2002
> @@ -59,25 +59,26 @@
>
> /* Retrieve a hash of status structures with the information
> requested by the user.
>
> svn_client_status directly understands the three commandline
> switches (-n, -u, -[vV]) : */
>
> SVN_ERR (svn_client_status (&statushash, &youngest, target, auth_baton,
> - opt_state->nonrecursive ? 0 : 1,
> + opt_state->nonrecursive ? FALSE : TRUE,
> opt_state->verbose,
> opt_state->update,
> + opt_state->no_ignore,
> pool));
>
> /* Now print the structures to the screen.
> The flag we pass indicates whether to use the 'detailed'
> output format or not. */
> - svn_cl__print_status_list (statushash,
> + svn_cl__print_status_list (statushash,
> youngest,
> (opt_state->verbose || opt_state->update),
> opt_state->verbose,
> opt_state->quiet,
> pool);
> }
>
> return SVN_NO_ERROR;
> Index: ./subversion/clients/cmdline/main.c
> ===================================================================
> --- ./subversion/clients/cmdline/main.c
> +++ ./subversion/clients/cmdline/main.c Fri Jul 26 15:37:48 2002
> @@ -70,16 +70,18 @@
> {"show-updates", 'u', 0, "display update information"},
> {"username", svn_cl__auth_username_opt, 1, "specify a username ARG"},
> {"password", svn_cl__auth_password_opt, 1, "specify a password ARG"},
> {"extensions", 'x', 1, "pass \"ARG\" as bundled options to GNU diff"},
> {"targets", svn_cl__targets_opt, 1,
> "pass contents of file \"ARG\" as additional args"},
> {"xml", svn_cl__xml_opt, 0, "output in xml"},
> {"strict", svn_cl__strict_opt, 0, "use strict semantics"},
> + {"no-ignore", svn_cl__no_ignore_opt, 0,
> + "disregard default and svn:ignore property ignores"},
> {0, 0, 0}
> };
>
>
> /* The maximum number of options that can be accepted by a subcommand;
> this is simply the number of unique switches that exist in the
> table above. */
> #define SVN_CL__MAX_OPTS sizeof(svn_cl__options)/sizeof(svn_cl__options[0])
> @@ -371,17 +373,18 @@
> " '+' history scheduled with commit\n"
> "\n"
> "Decoding --verbose output:\n"
> "Status| Out-of-date? | Local Rev | Last changed info | Path\n"
> " _ 965 938 kfogel ./autogen.sh\n"
> " _ * 965 970 sussman ./build.conf\n"
> " M 965 687 joe ./buildcheck.sh\n",
> { 'u', 'v', 'N', 'q',
> - svn_cl__auth_username_opt, svn_cl__auth_password_opt } },
> + svn_cl__auth_username_opt, svn_cl__auth_password_opt,
> + svn_cl__no_ignore_opt } },
>
> { "switch", svn_cl__switch, {"sw"},
> "Update working copy to mirror a new URL\n"
> "usage: switch REPOS_URL [TARGET]\n\n"
> " Note: this is the way to move a working copy to a new branch.\n",
> {'r', 'D', 'N', svn_cl__auth_username_opt, svn_cl__auth_password_opt} },
>
> { "update", svn_cl__update, {"up"},
> @@ -1084,16 +1087,19 @@
> opt_state.filedata_encoding = apr_pstrdup (pool, opt_arg);
> break;
> case svn_cl__xml_opt:
> opt_state.xml = TRUE;
> break;
> case svn_cl__strict_opt:
> opt_state.strict = TRUE;
> break;
> + case svn_cl__no_ignore_opt:
> + opt_state.no_ignore = TRUE;
> + break;
> case 'x':
> err = svn_utf_cstring_to_utf8 (&opt_state.extensions, opt_arg,
> NULL, pool);
> if (err) {
> svn_handle_error (err, stderr, FALSE);
> svn_pool_destroy (pool);
> return EXIT_FAILURE;
> }
> Index: ./doc/handbook/client.texi
> ===================================================================
> --- ./doc/handbook/client.texi
> +++ ./doc/handbook/.svn/tmp/client.texi.60812.00001.tmp Fri Jul 26 16:02:34 2002
> @@ -317,16 +317,24 @@
> item is part of a subtree scheduled for addition-with-history, i.e. some
> parent got copied, and it's just coming along for the ride. @samp{M @ @
> +} means the item is part of a subtree scheduled for
> addition-with-history, @emph{and} it has local mods. When you commit,
> first some parent will be added-with-history (copied), which means this
> file will automatically exist in the copy. Then the local mods will be
> further uploaded into the copy.
>
> +By default, @samp{svn status} ignores files matching the regular
> +expressions @samp{*.o}, @samp{*.lo}, @samp{*.la}, @samp{#*#},
> +@samp{*.rej}, @samp{*~}, and @samp{.#*}. If you want additional files
> +ignored, set the @samp{svn:ignore} property on the parent directory. If
> +you want to see the status of all the files in the repository
> +irrespective of @samp{svn status} and @samp{svn:ignore}'s regular
> +expressions, then use the @option{--no-ignore} command line option.
> +
> If a single path is passed to the command, it will tell you about it:
>
> @example
> $ svn status stuff/fish.c
> D stuff/fish.c
> @end example
>
> This command also has a @option{--verbose} (@option{-v}) mode, which will
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 27 02:03:21 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.