subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1831888 - in /subversion/trunk/subversion: libsvn_client/shelf.c tests/cmdline/shelf_tests.py
Date Sat, 19 May 2018 13:12:24 GMT
Author: julianfoad
Date: Sat May 19 13:12:24 2018
New Revision: 1831888

URL: http://svn.apache.org/viewvc?rev=1831888&view=rev
Log:
Shelving: support the modification kind 'Replaced'.

* subversion/libsvn_client/shelf.c
  (apply_file_visitor): Support replacement.

* subversion/tests/cmdline/shelf_tests.py
  (shelve_replace,
   shelve_binary_file_replace): New tests.
  (test_list): Run them.

Modified:
    subversion/trunk/subversion/libsvn_client/shelf.c
    subversion/trunk/subversion/tests/cmdline/shelf_tests.py

Modified: subversion/trunk/subversion/libsvn_client/shelf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/shelf.c?rev=1831888&r1=1831887&r2=1831888&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/shelf.c (original)
+++ subversion/trunk/subversion/libsvn_client/shelf.c Sat May 19 13:12:24 2018
@@ -1357,12 +1357,15 @@ apply_file_visitor(void *baton,
       || s->node_status == svn_wc_status_replaced)
     {
       SVN_ERR(wc_node_delete(to_wc_abspath, b->ctx, scratch_pool));
-      SVN_ERR(send_notification(to_wc_abspath, svn_wc_notify_update_delete,
-                                s->kind,
-                                svn_wc_notify_state_inapplicable,
-                                svn_wc_notify_state_inapplicable,
-                                b->ctx->notify_func2, b->ctx->notify_baton2,
-                                scratch_pool));
+      if (s->node_status != svn_wc_status_replaced)
+        {
+          SVN_ERR(send_notification(to_wc_abspath, svn_wc_notify_update_delete,
+                                    s->kind,
+                                    svn_wc_notify_state_inapplicable,
+                                    svn_wc_notify_state_inapplicable,
+                                    b->ctx->notify_func2, b->ctx->notify_baton2,
+                                    scratch_pool));
+        }
     }
 
   /* If we can merge a file, do so. */
@@ -1394,7 +1397,8 @@ apply_file_visitor(void *baton,
     }
 
   /* For an added file, copy it into the WC and ensure it's versioned. */
-  if (s->node_status == svn_wc_status_added)
+  if (s->node_status == svn_wc_status_added
+      || s->node_status == svn_wc_status_replaced)
     {
       if (s->kind == svn_node_dir)
         {
@@ -1407,7 +1411,10 @@ apply_file_visitor(void *baton,
                                    TRUE /*copy_perms*/, scratch_pool));
         }
       SVN_ERR(wc_node_add(to_wc_abspath, work_props, b->ctx, scratch_pool));
-      SVN_ERR(send_notification(to_wc_abspath, svn_wc_notify_update_add,
+      SVN_ERR(send_notification(to_wc_abspath,
+                                (s->node_status == svn_wc_status_replaced)
+                                  ? svn_wc_notify_update_replace
+                                  : svn_wc_notify_update_add,
                                 s->kind,
                                 svn_wc_notify_state_inapplicable,
                                 svn_wc_notify_state_inapplicable,

Modified: subversion/trunk/subversion/tests/cmdline/shelf_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/shelf_tests.py?rev=1831888&r1=1831887&r2=1831888&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/shelf_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/shelf_tests.py Sat May 19 13:12:24 2018
@@ -139,6 +139,18 @@ def shelve_deletes(sbox):
 
 #----------------------------------------------------------------------
 
+def shelve_replace(sbox):
+  "shelve replace"
+
+  def modifier(sbox):
+    sbox.simple_rm('A/mu')
+    sbox.simple_add_text('Replacement\n', 'A/mu')
+    sbox.simple_propset('p', 'v', 'A/mu')
+
+  shelve_unshelve(sbox, modifier)
+
+#----------------------------------------------------------------------
+
 def shelve_empty_adds(sbox):
   "shelve empty adds"
   sbox.build(empty=True)
@@ -359,6 +371,28 @@ def shelve_binary_file_del(sbox):
 
 #----------------------------------------------------------------------
 
+def shelve_binary_file_replace(sbox):
+  "shelve binary file replace"
+
+  sbox.build(empty=True)
+
+  existing_files = ['A/B/existing']
+  mod_files = ['bin', 'A/B/bin']
+
+  sbox.simple_mkdir('A', 'A/B')
+  for f in existing_files + mod_files:
+    sbox.simple_add_text('\0\1\2\3\4\5', f)
+  sbox.simple_commit()
+
+  def modifier(sbox):
+    for f in mod_files:
+      sbox.simple_rm(f)
+      sbox.simple_add_text('\5\4\3\2\1\0', f)
+
+  shelve_unshelve(sbox, modifier)
+
+#----------------------------------------------------------------------
+
 def shelve_with_log_message(sbox):
   "shelve with log message"
 
@@ -390,6 +424,7 @@ test_list = [ None,
               shelve_prop_changes,
               shelve_adds,
               shelve_deletes,
+              shelve_replace,
               shelve_empty_adds,
               shelve_empty_deletes,
               shelve_from_inner_path,
@@ -399,6 +434,7 @@ test_list = [ None,
               shelve_binary_file_mod,
               shelve_binary_file_add,
               shelve_binary_file_del,
+              shelve_binary_file_replace,
               shelve_with_log_message,
              ]
 



Mime
View raw message