subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1674607 - in /subversion/trunk/subversion: libsvn_wc/diff_editor.c tests/cmdline/diff_tests.py
Date Sun, 19 Apr 2015 11:48:39 GMT
Author: rhuijben
Date: Sun Apr 19 11:48:39 2015
New Revision: 1674607

URL: http://svn.apache.org/r1674607
Log:
Make svn diff -r HEAD path use the right set of properties when the local
directory is marked incomplete.

* subversion/libsvn_wc/diff_editor.c
  (dir_baton): Add is_incomplete.
  (open_directory): Initialize is_incomplete.
  (close_directory): Only use provided properties if is_incomplete.

* subversion/tests/cmdline/diff_tests.py
  (diff_incomplete_props): New test.
  (test_list): Add diff_incomplete_props.

Modified:
    subversion/trunk/subversion/libsvn_wc/diff_editor.c
    subversion/trunk/subversion/tests/cmdline/diff_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/diff_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/diff_editor.c?rev=1674607&r1=1674606&r2=1674607&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/diff_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/diff_editor.c Sun Apr 19 11:48:39 2015
@@ -145,6 +145,9 @@ struct dir_baton_t
   /* TRUE if the node is to be compared with an unrelated node*/
   svn_boolean_t ignoring_ancestry;
 
+  /* TRUE if the directory was reported incomplete to the repository */
+  svn_boolean_t is_incomplete;
+
   /* Processor state */
   void *pdb;
   svn_boolean_t skip;
@@ -1606,26 +1609,47 @@ open_directory(const char *path,
         db->repos_only = TRUE;
 
       if (!db->repos_only)
-        switch (info->status)
-          {
-            case svn_wc__db_status_normal:
-            case svn_wc__db_status_incomplete:
-              break;
-            case svn_wc__db_status_deleted:
-              db->repos_only = TRUE;
-
-              if (!info->have_more_work)
-                svn_hash_sets(pb->compared,
-                              apr_pstrdup(pb->pool, db->name), "");
-              break;
-            case svn_wc__db_status_added:
-              if (eb->ignore_ancestry)
-                db->ignoring_ancestry = TRUE;
-              else
+        {
+          switch (info->status)
+            {
+              case svn_wc__db_status_normal:
+              case svn_wc__db_status_incomplete:
+                db->is_incomplete = (info->status ==
+                                     svn_wc__db_status_incomplete);
+                break;
+              case svn_wc__db_status_deleted:
                 db->repos_only = TRUE;
-              break;
-            default:
-              SVN_ERR_MALFUNCTION();
+
+                if (!info->have_more_work)
+                  svn_hash_sets(pb->compared,
+                                apr_pstrdup(pb->pool, db->name), "");
+                break;
+              case svn_wc__db_status_added:
+                if (eb->ignore_ancestry)
+                  db->ignoring_ancestry = TRUE;
+                else
+                  db->repos_only = TRUE;
+                break;
+              default:
+                SVN_ERR_MALFUNCTION();
+          }
+
+          if (info->status == svn_wc__db_status_added
+              || info->status == svn_wc__db_status_deleted)
+            {
+              svn_wc__db_status_t base_status;
+
+              /* Node is shadowed; check BASE */
+              SVN_ERR(svn_wc__db_base_get_info(&base_status, NULL, NULL,
+                                               NULL, NULL, NULL, NULL, NULL,
+                                               NULL, NULL, NULL, NULL, NULL,
+                                               NULL, NULL, NULL,
+                                               db, db->local_abspath,
+                                               dir_pool, dir_pool));
+
+              if (base_status == svn_wc__db_status_incomplete)
+                db->is_incomplete = TRUE;
+            }
         }
 
       if (!db->repos_only)
@@ -1713,7 +1737,7 @@ close_directory(void *dir_baton,
     {
       apr_hash_t *repos_props;
 
-      if (db->added)
+      if (db->added || db->is_incomplete)
         {
           repos_props = apr_hash_make(scratch_pool);
         }

Modified: subversion/trunk/subversion/tests/cmdline/diff_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/diff_tests.py?rev=1674607&r1=1674606&r2=1674607&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/diff_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/diff_tests.py Sun Apr 19 11:48:39 2015
@@ -4927,6 +4927,92 @@ def diff_incomplete(sbox):
                                     sbox.wc_dir,
                                     '--notice-ancestry')
 
+def diff_incomplete_props(sbox):
+  "incomplete set of properties"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+
+  sbox.simple_propset('r2-1', 'r2', 'iota', 'A')
+  sbox.simple_propset('r2-2', 'r2', 'iota', 'A')
+  sbox.simple_propset('r', 'r2', 'iota', 'A')
+  sbox.simple_commit() # r2
+
+  svntest.actions.run_and_verify_svnmucc(None, [],
+                                         '-U', sbox.repo_url,
+                                         'propset', 'r3-1', 'r3', 'iota',
+                                         'propset', 'r3-1', 'r3', 'A',
+                                         'propset', 'r3-2', 'r3', 'iota',
+                                         'propset', 'r3-2', 'r3', 'A',
+                                         'propset', 'r', 'r3', 'iota',
+                                         'propset', 'r', 'r3', 'A',
+                                         'propdel', 'r2-1', 'iota',
+                                         'propdel', 'r2-1', 'A',
+                                         'propdel', 'r2-2', 'iota',
+                                         'propdel', 'r2-2', 'A',
+                                         '-m', 'r3')
+
+  _, out1, _ = svntest.actions.run_and_verify_svn(None, [], 'diff',
+                                                  '-r', 'HEAD', wc_dir,
+                                                  '--notice-ancestry')
+
+  # Now simulate a broken update to r3
+  svntest.actions.set_incomplete(wc_dir, 3)
+  svntest.actions.set_incomplete(sbox.ospath('A'), 3)
+
+  # The properties are still at r2
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.tweak('iota', 'A', props={'r2-1':'r2', 'r2-2':'r2', 'r':'r2'})
+  svntest.actions.verify_disk(wc_dir, expected_disk, True)
+
+  # But the working copy is incomplete at r3
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.tweak('iota', wc_rev=2)
+  expected_status.tweak('', 'A', wc_rev=3, status='! ')
+  svntest.actions.run_and_verify_status(wc_dir, expected_status)
+
+  expected_output = svntest.wc.State(wc_dir, {
+    'A'    : Item(status=' U'),
+    'iota' : Item(status=' U'),
+  })
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+  expected_disk = svntest.main.greek_state.copy()
+
+  # Expect that iota and A have the expected sets of properties
+  # The r2 set is properly deleted where necessary
+  expected_disk.tweak('iota', 'A', props={'r3-2':'r3', 'r':'r3', 'r3-1':'r3'})
+
+  _, out2, _ = svntest.actions.run_and_verify_svn(None, [], 'diff',
+                                                  '-r', 'HEAD', wc_dir,
+                                                  '--notice-ancestry')
+
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output, expected_disk,
+                                        expected_status, [], True)
+
+  # Ok, we tested that the update worked properly, but we also do this
+  # in the update tests... Let's see, what the diffs said
+
+  _, out3, _ = svntest.actions.run_and_verify_svn(None, [], 'diff',
+                                                  '-r', 'BASE:2', wc_dir,
+                                                  '--notice-ancestry')
+
+  # Filter out all headers (which include revisions, etc.)
+  out1 = [i for i in out1 if i[0].isupper()]
+  out1.sort()
+
+  out2 = [i for i in out2 if i[0].isupper()]
+  out2.sort()
+
+  out3 = [i for i in out3 if i[0].isupper()]
+  out3.sort()
+
+  svntest.verify.compare_and_display_lines('base vs incomplete', 'local diff',
+                                           out1, out2)
+
+  svntest.verify.compare_and_display_lines('base vs after', 'local diff',
+                                           out1, out3)
+
 ########################################################################
 #Run the tests
 
@@ -5019,6 +5105,7 @@ test_list = [ None,
               diff_local_copied_dir,
               diff_summarize_ignore_properties,
               diff_incomplete,
+              diff_incomplete_props,
               ]
 
 if __name__ == '__main__':



Mime
View raw message