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

[PATCH] Re: .svnignore functionality

From: Mark Benedetto King <bking_at_answerfriend.com>
Date: 2001-10-18 22:18:29 CEST

Okay, here's a second try.

Index: ./subversion/include/svn_types.h
===================================================================
--- ./subversion/include/.svn/text-base/svn_types.h Wed Oct 17 11:34:49 2001
+++ ./subversion/include/svn_types.h Thu Oct 18 16:03:41 2001
@@ -86,6 +86,8 @@
 /* All Subversion property names start with this. */
 #define SVN_PROP_PREFIX "svn:"
 
+/* This directory property stores a list of filename patterns to ignore */
+#define SVN_PROP_IGNORE SVN_PROP_PREFIX "ignore"
 
 /* The fs revision property that stores a commit's author. */
 #define SVN_PROP_REVISION_AUTHOR SVN_PROP_PREFIX "author"
Index: ./subversion/libsvn_wc/wc.h
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/wc.h Thu Oct 18 16:09:02 2001
+++ ./subversion/libsvn_wc/wc.h Thu Oct 18 16:09:02 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 Thu Oct 18 16:09:02 2001
+++ ./subversion/libsvn_wc/adm_crawler.c Thu Oct 18 16:09:02 2001
@@ -54,47 +54,32 @@
 
 }
 
-/* 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. */
+ svn_stringbuf_t *prop = svn_stringbuf_create (SVN_PROP_IGNORE, 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;
- }
-
- /* 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_stringbuf_t *list;
+ SVN_ERR(svn_wc_prop_get (&list, prop, path, pool));
+ 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;
-}
+}
 
 
 
@@ -1509,9 +1494,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.