You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/12/11 18:46:48 UTC

svn commit: r1550200 - /subversion/trunk/subversion/libsvn_client/status.c

Author: rhuijben
Date: Wed Dec 11 17:46:48 2013
New Revision: 1550200

URL: http://svn.apache.org/r1550200
Log:
When running 'svn status' report externals in a deterministic way instead
of relying on the apr_hash_t ordering. Filter status in externals on the
provided changelists.

* subversion/libsvn_client/status.c
  (includes): Add svn_sorts.h.
  (do_external_status): Add changelists argument. Sort items before
    iterating over them. Pass changelist.
  (svn_client_status5): Update caller. Remove stale comment.

Modified:
    subversion/trunk/subversion/libsvn_client/status.c

Modified: subversion/trunk/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/status.c?rev=1550200&r1=1550199&r2=1550200&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/status.c (original)
+++ subversion/trunk/subversion/libsvn_client/status.c Wed Dec 11 17:46:48 2013
@@ -31,6 +31,7 @@
 
 #include "svn_private_config.h"
 #include "svn_pools.h"
+#include "svn_sorts.h"
 #include "client.h"
 
 #include "svn_path.h"
@@ -247,25 +248,29 @@ do_external_status(svn_client_ctx_t *ctx
                    svn_boolean_t get_all,
                    svn_boolean_t update,
                    svn_boolean_t no_ignore,
+                   const apr_array_header_t *changelists,
                    const char *anchor_abspath,
                    const char *anchor_relpath,
                    svn_client_status_func_t status_func,
                    void *status_baton,
                    apr_pool_t *scratch_pool)
 {
-  apr_hash_index_t *hi;
   apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+  apr_array_header_t *externals;
+  int i;
+
+  externals = svn_sort__hash(external_map, svn_sort_compare_items_lexically,
+                             scratch_pool);
 
   /* Loop over the hash of new values (we don't care about the old
      ones).  This is a mapping of versioned directories to property
      values. */
-  for (hi = apr_hash_first(scratch_pool, external_map);
-       hi;
-       hi = apr_hash_next(hi))
+  for (i = 0; i < externals->nelts; i++)
     {
       svn_node_kind_t external_kind;
-      const char *local_abspath = svn__apr_hash_index_key(hi);
-      const char *defining_abspath = svn__apr_hash_index_val(hi);
+      svn_sort__item_t item = APR_ARRAY_IDX(externals, i, svn_sort__item_t);
+      const char *local_abspath = item.key;
+      const char *defining_abspath = item.value;
       svn_node_kind_t kind;
       svn_opt_revision_t opt_rev;
       const char *status_path;
@@ -310,8 +315,10 @@ do_external_status(svn_client_ctx_t *ctx
 
       /* And then do the status. */
       SVN_ERR(svn_client_status5(NULL, ctx, status_path, &opt_rev, depth,
-                                 get_all, update, no_ignore, FALSE, FALSE,
-                                 NULL, status_func, status_baton,
+                                 get_all, update, no_ignore,
+                                 FALSE /* ignore_exernals */,
+                                 FALSE /* depth_as_sticky */,
+                                 changelists, status_func, status_baton,
                                  iterpool));
     }
 
@@ -590,14 +597,7 @@ svn_client_status5(svn_revnum_t *result_
       SVN_ERR(err);
     }
 
-  /* If there are svn:externals set, we don't want those to show up as
-     unversioned or unrecognized, so patch up the hash.  If caller wants
-     all the statuses, we will change unversioned status items that
-     are interesting to an svn:externals property to
-     svn_wc_status_unversioned, otherwise we'll just remove the status
-     item altogether.
-
-     We only descend into an external if depth is svn_depth_infinity or
+  /* We only descend into an external if depth is svn_depth_infinity or
      svn_depth_unknown.  However, there are conceivable behaviors that
      would involve descending under other circumstances; thus, we pass
      depth anyway, so the code will DTRT if we change the conditional
@@ -613,7 +613,7 @@ svn_client_status5(svn_revnum_t *result_
 
       SVN_ERR(do_external_status(ctx, external_map,
                                  depth, get_all,
-                                 update, no_ignore,
+                                 update, no_ignore, changelists,
                                  sb.anchor_abspath, sb.anchor_relpath,
                                  status_func, status_baton, pool));
     }