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 2017/12/19 21:07:10 UTC

svn commit: r1818720 - /subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py

Author: julianfoad
Date: Tue Dec 19 21:07:09 2017
New Revision: 1818720

URL: http://svn.apache.org/viewvc?rev=1818720&view=rev
Log:
On the 'shelve-checkpoint' branch: Add a basic regression test.

* subversion/tests/cmdline/shelve_tests.py
  (state_from_status, save_revert_restore, checkpoint_basic): New.
  (test_list): Run 'checkpoint_basic'.

Modified:
    subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py

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=1818720&r1=1818719&r2=1818720&view=diff
==============================================================================
--- subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py (original)
+++ subversion/branches/shelve-checkpoint/subversion/tests/cmdline/shelve_tests.py Tue Dec 19 21:07:09 2017
@@ -126,6 +126,65 @@ def shelve_deletes(sbox):
 
 #----------------------------------------------------------------------
 
+def state_from_status(wc_dir):
+  _, output, _ = svntest.main.run_svn(None, 'status', '-v', '-u', '-q',
+                                      wc_dir)
+  return svntest.wc.State.from_status(output, wc_dir)
+
+def save_revert_restore(sbox, modifier1, modifier2):
+  "Save 2 checkpoints; revert; restore 1st"
+
+  sbox.build()
+  was_cwd = os.getcwd()
+  os.chdir(sbox.wc_dir)
+  sbox.wc_dir = ''
+  wc_dir = ''
+
+  # Make some changes to the working copy
+  modifier1(sbox)
+
+  # Remember the modified state
+  modified_state1 = state_from_status(wc_dir)
+
+  # Save a checkpoint; check nothing changed
+  svntest.actions.run_and_verify_svn(None, [],
+                                     'sp', 'save', 'foo')
+  svntest.actions.run_and_verify_status(wc_dir, modified_state1)
+
+  # Modify again; remember the state; save a checkpoint
+  modifier2(sbox)
+  modified_state2 = state_from_status(wc_dir)
+  svntest.actions.run_and_verify_svn(None, [],
+                                     'sp', 'save', 'foo')
+  svntest.actions.run_and_verify_status(wc_dir, modified_state2)
+
+  # Revert
+  svntest.actions.run_and_verify_svn(None, [],
+                                     'revert', '-R', '.')
+  virginal_state = svntest.actions.get_virginal_state(wc_dir, 1)
+  svntest.actions.run_and_verify_status(wc_dir, virginal_state)
+
+  # Restore; check the original modifications are here again
+  svntest.actions.run_and_verify_svn(None, [],
+                                     'sp', 'restore', 'foo', '1')
+  svntest.actions.run_and_verify_status(wc_dir, modified_state1)
+
+  os.chdir(was_cwd)
+
+#----------------------------------------------------------------------
+
+def checkpoint_basic(sbox):
+  "checkpoint basic"
+
+  def modifier1(sbox):
+    sbox.simple_append('A/mu', 'appended mu text\n')
+
+  def modifier2(sbox):
+    sbox.simple_append('iota', 'appended iota text\n')
+    sbox.simple_append('A/mu', 'appended another line\n')
+
+  save_revert_restore(sbox, modifier1, modifier2)
+
 
 ########################################################################
 # Run the tests
@@ -136,6 +195,7 @@ test_list = [ None,
               shelve_prop_changes,
               shelve_adds,
               shelve_deletes,
+              checkpoint_basic,
              ]
 
 if __name__ == '__main__':