subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r906134 - in /subversion/trunk/subversion: libsvn_client/patch.c tests/cmdline/patch_tests.py
Date Wed, 03 Feb 2010 17:26:12 GMT
Author: stsp
Date: Wed Feb  3 17:26:12 2010
New Revision: 906134

URL: http://svn.apache.org/viewvc?rev=906134&view=rev
Log:
* subversion/libsvn_client/patch.c
  (install_patched_target): Use a more efficient way of testing for
   unversioned directories. Rather than getting the wc_db status of
   the node (which could result in content comparison if the node
   is a large file and has a new timestamp), just inquire about the
   node's kind as stored in the WC_DB and as seen on disk. That gives
   us all the information we need.

Suggested by: rhuijben

* subversion/tests/cmdline/patch_tests.py
  (patch_add_new_dir): Make this test verify that unversioned
   directories are skipped properly.

Modified:
    subversion/trunk/subversion/libsvn_client/patch.c
    subversion/trunk/subversion/tests/cmdline/patch_tests.py

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=906134&r1=906133&r2=906134&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Wed Feb  3 17:26:12 2010
@@ -1233,6 +1233,20 @@
 
                   present_components++;
                 }
+              else
+                {
+                  /* The WC_DB doesn't know much about this node.
+                   * Check what's on disk. */
+                  svn_node_kind_t disk_kind;
+ 
+                  SVN_ERR(svn_io_check_path(abs_path, &disk_kind, iterpool));
+                  if (disk_kind != svn_node_none)
+                    {
+                      /* An unversioned item is in the way. */
+                      target->skipped = TRUE;
+                      break;
+                    }
+                }
             }
 
           if (! target->skipped)
@@ -1241,7 +1255,6 @@
               for (i = present_components; i < components->nelts - 1; i++)
                 {
                   const char *component;
-                  svn_wc_status2_t *status;
 
                   svn_pool_clear(iterpool);
 
@@ -1249,18 +1262,6 @@
                                             const char *);
                   abs_path = svn_dirent_join(abs_path, component,
                                              pool);
-
-                  /* Skip things we should not be messing with. */
-                  SVN_ERR(svn_wc_status3(&status, ctx->wc_ctx, abs_path,
-                                         iterpool, iterpool));
-                  if (status->text_status == svn_wc_status_unversioned ||
-                      status->text_status == svn_wc_status_ignored ||
-                      status->text_status == svn_wc_status_obstructed)
-                    {
-                      target->skipped = TRUE;
-                      break;
-                    }
-
                   if (dry_run)
                     {
                       if (ctx->notify_func2)

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=906134&r1=906133&r2=906134&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Wed Feb  3 17:26:12 2010
@@ -845,8 +845,9 @@
   patch_file_path = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir))[1]
 
   # The first diff is adding 'new' with two missing dirs. The second is 
-  # adding 'new' with one missing dir to a 'A' that is locally deleted. Should be
-  # skipped.
+  # adding 'new' with one missing dir to a 'A' that is locally deleted
+  # (should be skipped). The third is adding 'new' with a directory that
+  # is unversioned (should be skipped as well).
   unidiff_patch = [
     "Index: new\n",
     "===================================================================\n",
@@ -860,6 +861,12 @@
     "+++ A/C/Y/new\t(revision 0)\n",
     "@@ -0,0 +1 @@\n",
     "+new\n",
+    "Index: new\n",
+    "===================================================================\n",
+    "--- A/Z/new\t(revision 0)\n",
+    "+++ A/Z/new\t(revision 0)\n",
+    "@@ -0,0 +1 @@\n",
+    "+new\n",
   ]
 
   C_path = os.path.join(wc_dir, 'A', 'C')
@@ -868,17 +875,23 @@
   svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
 
   A_C_Y_new_path = os.path.join(wc_dir, 'A', 'C', 'Y', 'new')
+  A_Z_new_path = os.path.join(wc_dir, 'A', 'Z', 'new')
   expected_output = [
     'A         %s\n' % os.path.join(wc_dir, 'X'),
     'A         %s\n' % os.path.join(wc_dir, 'X', 'Y'),
     'A         %s\n' % os.path.join(wc_dir, 'X', 'Y', 'new'),
     'Skipped \'%s\'\n' % A_C_Y_new_path,
+    'Skipped \'%s\'\n' % A_Z_new_path,
     'Summary of conflicts:\n',
-    '  Skipped paths: 1\n',
+    '  Skipped paths: 2\n',
   ]
 
+  # Create the unversioned obstructing directory
+  os.mkdir(os.path.dirname(A_Z_new_path))
+
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.add({'X/Y/new': Item(contents='new\n')})
+  expected_disk.add({'A/Z': Item()})
 
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
   expected_status.add({'X' : Item(status='A ', wc_rev=0)})
@@ -886,7 +899,8 @@
   expected_status.add({'X/Y/new' : Item(status='A ', wc_rev=0)})
   expected_status.add({'A/C' : Item(status='D ', wc_rev=1)})
 
-  expected_skip = wc.State('', {A_C_Y_new_path : Item()})
+  expected_skip = wc.State('', {A_C_Y_new_path : Item(),
+                                A_Z_new_path : Item() })
 
   svntest.actions.run_and_verify_patch(wc_dir, 
                                        os.path.abspath(patch_file_path),



Mime
View raw message