You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2013/01/03 22:26:50 UTC

svn commit: r1428602 - in /subversion/branches/issue-3348-dev/subversion: libsvn_client/status.c libsvn_wc/adm_ops.c libsvn_wc/diff_local.c tests/cmdline/changelist_tests.py

Author: cmpilato
Date: Thu Jan  3 21:26:50 2013
New Revision: 1428602

URL: http://svn.apache.org/viewvc?rev=1428602&view=rev
Log:
On the 'issue-3348-dev' branch: Teach status, diff, and the
lower-level working copy APIs to ignore directories when filtering by
changelist, even which using the magical empty-string changelist name.

Among other niceties, this makes `svn up --cl ""` only update files
which aren't in a changelist, rather than effectively doing the likes
of this:

   svn up --depth infinity .
   svn up --depth infinity ./A
   svn up --depth infinity ./A/B
   svn up --depth infinity ./A/B/E
   ...

* subversion/libsvn_client/status.c
  (tweak_status): When filtering on changelists, drop all directories,
    period.

* subversion/libsvn_wc/diff_local.c
  (diff_status_callback): Same here.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc__internal_changelist_match): Tweak this filtering function
    to drop all directories, which have no business in
    changelist-related discussions.

* subversion/tests/cmdline/changelist_tests.py
  (empty_pseudo_changelist): Tweak test behavior and expectations.

Modified:
    subversion/branches/issue-3348-dev/subversion/libsvn_client/status.c
    subversion/branches/issue-3348-dev/subversion/libsvn_wc/adm_ops.c
    subversion/branches/issue-3348-dev/subversion/libsvn_wc/diff_local.c
    subversion/branches/issue-3348-dev/subversion/tests/cmdline/changelist_tests.py

Modified: subversion/branches/issue-3348-dev/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3348-dev/subversion/libsvn_client/status.c?rev=1428602&r1=1428601&r2=1428602&view=diff
==============================================================================
--- subversion/branches/issue-3348-dev/subversion/libsvn_client/status.c (original)
+++ subversion/branches/issue-3348-dev/subversion/libsvn_client/status.c Thu Jan  3 21:26:50 2013
@@ -82,12 +82,13 @@ tweak_status(void *baton,
                            svn_dirent_skip_ancestor(sb->anchor_abspath, path),
                            scratch_pool);
 
-  /* If the status item has an entry, but doesn't belong to one of the
-     changelists our caller is interested in, we filter out this status
-     transmission.  */
   /* ### duplicated in ../libsvn_wc/diff_local.c */
   if (sb->changelist_hash)
     {
+      /* Directories fail all changelist filtering. */
+      if (status->kind == svn_node_dir)
+        return SVN_NO_ERROR;
+
       if (status->changelist)
         {
           /* Skip unless the caller requested this changelist. */

Modified: subversion/branches/issue-3348-dev/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3348-dev/subversion/libsvn_wc/adm_ops.c?rev=1428602&r1=1428601&r2=1428602&view=diff
==============================================================================
--- subversion/branches/issue-3348-dev/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/issue-3348-dev/subversion/libsvn_wc/adm_ops.c Thu Jan  3 21:26:50 2013
@@ -2661,11 +2661,12 @@ svn_wc__internal_changelist_match(svn_wc
 {
   svn_error_t *err;
   const char *changelist;
+  svn_kind_t kind;
 
   if (clhash == NULL)
     return TRUE;
 
-  err = svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+  err = svn_wc__db_read_info(NULL, &kind, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                              NULL, NULL, NULL, NULL, NULL, &changelist,
                              NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -2676,7 +2677,14 @@ svn_wc__internal_changelist_match(svn_wc
       return FALSE;
     }
 
-  /* The empty changelist name is special-cased. */
+  /* The empty-string changelist name is special-cased to mean "files
+     not assigned to a changelist".  Even though WC-DB won't let us
+     assign a changelist to a directory, we don't want to claim that a
+     directory matches the empty-string changelist name, either, so we
+     filter on KIND here.  */
+  if (kind == svn_kind_dir)
+    return FALSE;
+
   return (changelist
           ? apr_hash_get((apr_hash_t *)clhash, changelist, APR_HASH_KEY_STRING)
           : apr_hash_get((apr_hash_t *)clhash, "", APR_HASH_KEY_STRING)

Modified: subversion/branches/issue-3348-dev/subversion/libsvn_wc/diff_local.c
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3348-dev/subversion/libsvn_wc/diff_local.c?rev=1428602&r1=1428601&r2=1428602&view=diff
==============================================================================
--- subversion/branches/issue-3348-dev/subversion/libsvn_wc/diff_local.c (original)
+++ subversion/branches/issue-3348-dev/subversion/libsvn_wc/diff_local.c Thu Jan  3 21:26:50 2013
@@ -446,10 +446,13 @@ diff_status_callback(void *baton,
         break; /* Go check other conditions */
     }
 
-  /* Filter items by changelist. */
   /* ### duplicated in ../libsvn_client/status.c */
   if (eb->changelist_hash)
     {
+      /* Directories fail all changelist filtering. */
+      if (status->kind == svn_node_dir)
+        return SVN_NO_ERROR;
+
       if (status->changelist)
         {
           /* Skip unless the caller requested this changelist. */

Modified: subversion/branches/issue-3348-dev/subversion/tests/cmdline/changelist_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/issue-3348-dev/subversion/tests/cmdline/changelist_tests.py?rev=1428602&r1=1428601&r2=1428602&view=diff
==============================================================================
--- subversion/branches/issue-3348-dev/subversion/tests/cmdline/changelist_tests.py (original)
+++ subversion/branches/issue-3348-dev/subversion/tests/cmdline/changelist_tests.py Thu Jan  3 21:26:50 2013
@@ -1198,20 +1198,22 @@ def empty_pseudo_changelist(sbox):
 
   # Helper functions.
 
-  def found_nodes(*args):
-    # Extract the Greek-tree-relative paths.
-    return set(map(lambda info: info['Path'][len(wc_dir)+1:],
-                    svntest.actions.run_and_parse_info(*args)))
+  def found_nondir_nodes(*args):
+    # Extract the Greek-tree-relative non-directory paths.
+    all_nodes = svntest.actions.run_and_parse_info(*args)
+    all_nodes = filter(lambda x: x['Node Kind'] != 'directory', all_nodes)
+    return set(map(lambda info: info['Path'][len(wc_dir)+1:], all_nodes))
 
   def find_nodes(nodeset, *args):
     assert isinstance(nodeset, set)
-    foundset = found_nodes(*args)
+    foundset = found_nondir_nodes(*args)
     nodeset = set(map(lambda path: path.replace('/', os.path.sep), nodeset))
     if nodeset != foundset:
       raise svntest.Failure("Expected nodeset %s but found %s"
                             % (nodeset, foundset))
 
   # Convenience variables.
+  B_path = sbox.ospath('A/B')
   E_path = sbox.ospath('A/B/E')
   alpha_path = sbox.ospath('A/B/E/alpha')
   beta_path = sbox.ospath('A/B/E/beta')
@@ -1230,16 +1232,22 @@ def empty_pseudo_changelist(sbox):
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'changelist', 'testlist', beta_path)
 
-  # Convenience variables.
-  changelist = {
-    'testlist' : set(['A/B/E/beta']),
-    '' : set(['A/B/E', 'A/B/E/alpha']),
-  }
-
   # Some basic validations.
-  find_nodes(changelist['testlist'] | changelist[''], '-R', E_path)
-  find_nodes(changelist['testlist'], '--cl', 'testlist', '-R', E_path)
-  find_nodes(changelist[''], '--cl', '', '-R', E_path)
+  find_nodes(set(['A/B/E/beta',
+                  'A/B/E/alpha',
+                  ]),
+             '-R', E_path)
+  find_nodes(set(['A/B/E/beta']),
+             '--cl', 'testlist', '-R', E_path)
+  find_nodes(set(['A/B/E/alpha']),
+             '--cl', '', '-R', E_path)
+  find_nodes(set(['A/B/E/beta']),
+             '--cl', 'testlist', '-R', B_path)
+  find_nodes(set(['A/B/E/alpha',
+                  'A/B/lambda',
+                  ]),
+             '--cl', '', '-R', B_path)
+
 
 ########################################################################
 # Run the tests