You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2018/01/02 12:19:58 UTC

svn commit: r1819810 - in /subversion/branches/shelve-checkpoint: ./ subversion/libsvn_client/shelve.c subversion/tests/cmdline/shelve_tests.py

Author: julianfoad
Date: Tue Jan  2 12:19:58 2018
New Revision: 1819810

URL: http://svn.apache.org/viewvc?rev=1819810&view=rev
Log:
On the 'shelve-checkpoint' branch: catch up with trunk@1819805.

Modified:
    subversion/branches/shelve-checkpoint/   (props changed)
    subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c
    subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py

Propchange: subversion/branches/shelve-checkpoint/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan  2 12:19:58 2018
@@ -98,4 +98,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1801593-1819797
+/subversion/trunk:1801593-1819805

Modified: subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c?rev=1819810&r1=1819809&r2=1819810&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c (original)
+++ subversion/branches/shelve-checkpoint/subversion/libsvn_client/shelve.c Tue Jan  2 12:19:58 2018
@@ -225,6 +225,9 @@ shelf_write_current(svn_client_shelf_t *
  *
  * @a paths, @a depth, @a changelists: The selection of local paths to diff.
  *
+ * @a paths are relative to CWD (or absolute). Paths in patch are relative
+ * to WC root (@a wc_root_abspath).
+ *
  * ### TODO: Ignore any external diff cmd as configured in config file.
  *     This might also solve the buffering problem.
  */
@@ -233,6 +236,7 @@ write_patch(const char *patch_abspath,
             const apr_array_header_t *paths,
             svn_depth_t depth,
             const apr_array_header_t *changelists,
+            const char *wc_root_abspath,
             svn_client_ctx_t *ctx,
             apr_pool_t *scratch_pool)
 {
@@ -263,6 +267,7 @@ write_patch(const char *patch_abspath,
       if (svn_path_is_url(path))
         return svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
                                  _("'%s' is not a local path"), path);
+      SVN_ERR(svn_dirent_get_absolute(&path, path, scratch_pool));
 
       SVN_ERR(svn_client_diff_peg6(
                      NULL /*options*/,
@@ -270,7 +275,7 @@ write_patch(const char *patch_abspath,
                      &peg_revision,
                      &start_revision,
                      &end_revision,
-                     NULL,
+                     wc_root_abspath,
                      depth,
                      TRUE /*notice_ancestry*/,
                      FALSE /*no_diff_added*/,
@@ -505,6 +510,7 @@ svn_client_shelf_save_new_version(svn_cl
                             scratch_pool, scratch_pool));
   SVN_ERR(write_patch(patch_abspath,
                       paths, depth, changelists,
+                      shelf->wc_root_abspath,
                       shelf->ctx, scratch_pool));
 
   SVN_ERR(svn_io_stat(&file_info, patch_abspath, APR_FINFO_MTIME, scratch_pool));

Modified: subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py?rev=1819810&r1=1819809&r2=1819810&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py (original)
+++ subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py Tue Jan  2 12:19:58 2018
@@ -44,21 +44,16 @@ Item = wc.StateItem
 
 #----------------------------------------------------------------------
 
-def shelve_unshelve(sbox, modifier):
-  "Round-trip: shelve and unshelve"
+def shelve_unshelve_verify(sbox):
+  """Round-trip: shelve; verify all changes are reverted;
+     unshelve; verify all changes are restored.
+  """
 
-  sbox.build()
-  was_cwd = os.getcwd()
-  os.chdir(sbox.wc_dir)
-  sbox.wc_dir = ''
-  wc_dir = ''
-
-  # Make some changes to the working copy
-  modifier(sbox)
+  wc_dir = sbox.wc_dir
 
   # Save the modified state
   _, output, _ = svntest.main.run_svn(None, 'status', '-v', '-u', '-q',
-                                      sbox.wc_dir)
+                                      wc_dir)
   modified_state = svntest.wc.State.from_status(output, wc_dir)
 
   # Shelve; check there are no longer any modifications
@@ -72,6 +67,23 @@ def shelve_unshelve(sbox, modifier):
                                      'unshelve', 'foo')
   svntest.actions.run_and_verify_status(wc_dir, modified_state)
 
+#----------------------------------------------------------------------
+
+def shelve_unshelve(sbox, modifier):
+  """Round-trip: build 'sbox'; apply changes by calling 'modifier(sbox)';
+     shelve and unshelve; verify changes are fully reverted and restored.
+  """
+
+  sbox.build()
+  was_cwd = os.getcwd()
+  os.chdir(sbox.wc_dir)
+  sbox.wc_dir = ''
+
+  # Make some changes to the working copy
+  modifier(sbox)
+
+  shelve_unshelve_verify(sbox)
+
   os.chdir(was_cwd)
 
 ######################################################################
@@ -126,6 +138,24 @@ def shelve_deletes(sbox):
 
 #----------------------------------------------------------------------
 
+def shelve_from_inner_path(sbox):
+  "shelve from inner path"
+
+  def modifier(sbox):
+    sbox.simple_append('A/mu', 'appended mu text')
+
+  sbox.build()
+  was_cwd = os.getcwd()
+  os.chdir(sbox.ospath('A'))
+  sbox.wc_dir = '..'
+
+  modifier(sbox)
+  shelve_unshelve_verify(sbox)
+
+  os.chdir(was_cwd)
+
+#----------------------------------------------------------------------
+
 def state_from_status(wc_dir):
   _, output, _ = svntest.main.run_svn(None, 'status', '-v', '-u', '-q',
                                       wc_dir)
@@ -195,6 +225,7 @@ test_list = [ None,
               shelve_prop_changes,
               shelve_adds,
               shelve_deletes,
+              shelve_from_inner_path,
               checkpoint_basic,
              ]