Passes the stat_test.py test suite just fine. Please comment and I'll
commit after review.
-Fitz
--------------------8-<-------cut-here---------8-<-----------------------
Log message:
* subversion/include/svn_wc.h
(svn_wc_statuses): Added 'svn_boolean_t strict' parameter
* subversion/libsvn_wc/status.c
(assemble_status): Added 'svn_boolean_t strict' parameter. When
strict is non-zero, return an error if we encounter a path that is not
in the working copy.
(add_status_structure): Added 'svn_boolean_t strict'
parameter. Added 'strict' argument to all calls to assemble_status
within.
(add_unversioned_items): Added FALSE argument to call to assemble_status.
(svn_wc_status): Added FALSE argument to call to assemble_status.
(svn_wc_statuses): Added 'svn_boolean_t strict' parameter. Added
'strict' argument to all calls to assemble_status within. Also did
some reformatting to keep within 80 cols.
* subversion/libsvn_client/status.c
(svn_client_status): Add strict var which is set to TRUE if we're
not updating, and FALSE if we are updating. This allows us to properly
error out if someone tries to stat a file that doesn't exist in the
working copy. Added 'strict' argument to assemble_status invocation.
--------------------8-<-------cut-here---------8-<-----------------------
Index: ./include/svn_wc.h
===================================================================
--- ./include/svn_wc.h
+++ ./include/svn_wc.h Thu Feb 7 08:55:50 2002
@@ -358,6 +358,12 @@
* a directory; its status will simply be stored in STATUSHASH like
* any other.
*
+ * If STRICT is non-zero, then if we encounter a path that is not in
+ * the wc, we'll return an error. STRICT should be zero if we're
+ * updating as the update will catch any non wc path errors (and
+ * properly deal with files that are in the repository but missing
+ * from the wc for whatever reason).
+ *
* Assuming PATH is a directory, then:
*
* If GET_ALL is zero, then only locally-modified entries will be
@@ -374,6 +380,7 @@
svn_stringbuf_t *path,
svn_boolean_t descend,
svn_boolean_t get_all,
+ svn_boolean_t strict,
apr_pool_t *pool);
Index: ./libsvn_wc/status.c
===================================================================
--- ./libsvn_wc/status.c
+++ ./libsvn_wc/status.c Thu Feb 7 09:02:52 2002
@@ -108,6 +108,7 @@
svn_stringbuf_t *path,
svn_wc_entry_t *entry,
svn_boolean_t get_all,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
svn_wc_status_t *stat;
@@ -140,6 +141,16 @@
if (path_kind != svn_node_none)
stat->text_status = svn_wc_status_unversioned;
+ /* If we're in strict mode and we encounter a path that doesn't
+ exist in the wc, then we return an error*/
+ if (strict && (path_kind == svn_node_none))
+ return svn_error_createf (APR_ENOENT, 0, NULL, pool,
+ "assemble_status: "
+ "%s: No such file or directory",
+ path->data);
+
*status = stat;
return SVN_NO_ERROR;
}
@@ -271,11 +282,13 @@
svn_stringbuf_t *path,
svn_wc_entry_t *entry,
svn_boolean_t get_all,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
svn_wc_status_t *statstruct;
- SVN_ERR (assemble_status (&statstruct, path, entry, get_all, pool));
+ SVN_ERR (assemble_status (&statstruct, path, entry,
+ get_all, strict, pool));
if (statstruct)
apr_hash_set (statushash, path->data, path->len, statstruct);
@@ -357,6 +370,7 @@
printable_path,
NULL, /* no entry */
FALSE,
+ FALSE,
pool));
}
}
@@ -384,7 +398,7 @@
'absent' status filled in. */
svn_wc_entry (&entry, path, pool);
- SVN_ERR (assemble_status (&s, path, entry, TRUE, pool));
+ SVN_ERR (assemble_status (&s, path, entry, TRUE, FALSE, pool));
*status = s;
return SVN_NO_ERROR;
}
@@ -396,6 +410,7 @@
svn_stringbuf_t *path,
svn_boolean_t descend,
svn_boolean_t get_all,
+ svn_boolean_t strict,
apr_pool_t *pool)
{
enum svn_node_kind kind;
@@ -427,7 +442,8 @@
### Notice that because we're getting one specific file,
we're ignoring the GET_ALL flag and unconditionally fetching
the status structure. */
- SVN_ERR (add_status_structure (statushash, path, entry, TRUE, pool));
+ SVN_ERR (add_status_structure (statushash, path, entry,
+ TRUE, strict, pool));
}
@@ -486,7 +502,8 @@
fullpath->len);
if (! s)
SVN_ERR (add_status_structure (statushash, fullpath,
- entry, get_all, pool));
+ entry, get_all,
+ strict, pool));
}
else
{
@@ -499,15 +516,17 @@
SVN_ERR (svn_wc_entry (&subdir, fullpath, pool));
SVN_ERR (add_status_structure (statushash, fullpath,
- subdir, get_all, pool));
+ subdir, get_all,
+ strict, pool));
SVN_ERR (svn_wc_statuses (statushash, fullpath,
- descend, get_all, pool));
+ descend, get_all, strict, 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, pool));
+ entry, get_all,
+ strict, pool));
}
}
}
Index: ./libsvn_client/status.c
===================================================================
--- ./libsvn_client/status.c
+++ ./libsvn_client/status.c Thu Feb 7 09:05:28 2002
@@ -139,6 +139,14 @@
apr_pool_t *pool)
{
apr_hash_t *hash = apr_hash_make (pool);
+ svn_boolean_t strict = TRUE;
+
+ /* 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
+ doesn't exist in the wc, we should throw an error */
+ if (update)
+ strict = FALSE;
/* Ask the wc to give us a list of svn_wc_status_t structures.
These structures contain nothing but information found in the
@@ -147,7 +155,7 @@
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, pool));
+ SVN_ERR (svn_wc_statuses (hash, path, descend, get_all, strict, pool));
/* If the caller wants us to contact the repository also... */
---------------------------------------------------------------------
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:37:05 2006