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

Re: .svnignore functionality

From: Mark Benedetto King <bking_at_answerfriend.com>
Date: 2001-10-18 21:16:42 CEST

On Wed, Oct 17, 2001 at 04:29:42PM -0500, Ben Collins-Sussman wrote:
> Mark Benedetto King <bking@answerfriend.com> writes:
>
> > .svnignore functionality, mentioned in www/project_tasks.html
> > (which references issue #482) seems to have been implemented.
> >
> > can this task be removed and the issue closed?
>
> Actually, we need to move the .svnignore patterns into directory
> properties, and then remove the .svnignore files.
>

I'm hoping you meant ".svn/dir-props". That's where this patch
puts them.

> Before this, someone needs to make a trivial change to the beginning
> of libsvn_wc/adm_crawler.c, so that it loads the patterns out of a
> property ("svn:ignore") instead of from a file.

Okay. You were right, it was trivial.

This patch does not attempt to preserve any sort of backwards
compatibility; it does not look for .svnignore files.

I'm concerned about how well this will work on operating systems
that use '\r' as part of their line separator, but I have the
same concerns about the original code.

Index: ./subversion/libsvn_wc/wc.h
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/wc.h Wed Oct 17 11:34:35 2001
+++ ./subversion/libsvn_wc/wc.h Thu Oct 18 14:57:29 2001
@@ -53,9 +53,6 @@
 #define SVN_WC_TIMESTAMP_WC "working"
 
 
-/* The name of the '.svnignore' file */
-#define SVN_WC_SVNIGNORE ".svnignore"
-
 
 
 /*** Locking. ***/
Index: ./subversion/libsvn_wc/adm_crawler.c
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/adm_crawler.c Wed Oct 17 11:34:39 2001
+++ ./subversion/libsvn_wc/adm_crawler.c Thu Oct 18 15:01:44 2001
@@ -54,47 +54,36 @@
 
 }
 
-/* Helper routine: try to read the contents of DIRPATH/.svnignore. If
- no such file exists, then set *PATTERNS to NULL. Otherwise, set
- *PATTERNS to a list of patterns to match; *PATTERNS will contain
- an array of (const char *) objects. */
+/* Helper routine: read the newline separated records
+ in the dir-props hash-entry for "svn:ignore" into *PATTERNS
+ as (const char *) objects. */
 static svn_error_t *
-load_ignore_file (const char *dirpath,
+load_ignore_property (const char *dirpath,
                   apr_array_header_t *patterns,
                   apr_pool_t *pool)
 {
- apr_file_t *fp;
- apr_status_t status;
- char buf[100];
- apr_size_t sz = 100;
-
- /* Try to load the .svnignore file. */
+ apr_hash_t *props = apr_hash_make (pool);
   svn_stringbuf_t *path = svn_stringbuf_create (dirpath, pool);
- svn_path_add_component_nts (path, SVN_WC_SVNIGNORE, svn_path_local_style);
- if (apr_file_open (&fp, path->data, APR_READ | APR_BUFFERED,
- APR_OS_DEFAULT, pool))
- {
- return SVN_NO_ERROR;
- }
+ svn_stringbuf_t *file = svn_wc__adm_path( path, 0, pool, SVN_WC__ADM_DIR_PROPS, NULL );
+ svn_stringbuf_t *list;
 
- /* Now that it's open, read one line at a time into the array. */
- while (1)
- {
- status = svn_io_read_length_line (fp, buf, &sz);
- if (status == APR_EOF)
- break;
- else if (status)
- return svn_error_createf(status, 0, NULL, pool,
- "error reading %s", path->data);
-
- (*((const char **) apr_array_push (patterns))) =
- apr_pstrndup (pool, buf, sz);
-
- sz = 100;
- }
+ SVN_ERR(svn_wc__load_prop_file (file, props, pool));
 
+ list = (svn_stringbuf_t *) apr_hash_get (props, "svn:ignore", APR_HASH_KEY_STRING);
+ if (list != NULL)
+ {
+ char *walk = list->data;
+ do {
+ char *p = strchr (walk, '\n');
+ const char **ent = apr_array_push (patterns);
+ if (p != NULL)
+ *p++ = 0;
+ *ent = apr_pstrdup(pool, walk);
+ walk = p;
+ } while( walk );
+ }
   return SVN_NO_ERROR;
-}
+}
 
 
 
@@ -1508,9 +1497,9 @@
   SVN_ERR (svn_wc_entries_read (&entries, full_path, subpool));
   SVN_ERR (svn_io_get_dirents (&dirents, full_path, subpool));
 
- /* Try to load any '.svnignore' file that may be present. */
+ /* Try to load any 'svn:ignore' property that may be present. */
   patterns = apr_array_make (pool, 1, sizeof(const char *));
- SVN_ERR (load_ignore_file (full_path->data, patterns, subpool));
+ SVN_ERR (load_ignore_property (full_path->data, patterns, subpool));
   add_default_ignores (patterns);
 
   /* Phase 1: Print out every unrecognized (unversioned) object. */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:45 2006

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.