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/06/06 20:59:03 UTC
svn commit: r1833082 - in /subversion/trunk/subversion:
libsvn_client/shelf.c tests/cmdline/shelf_tests.py
Author: julianfoad
Date: Wed Jun 6 20:59:03 2018
New Revision: 1833082
URL: http://svn.apache.org/viewvc?rev=1833082&view=rev
Log:
Shelving: refuse to shelve mkdir/rmdir, as it is not yet supported.
* subversion/libsvn_client/shelf.c
(write_changes_visitor): Refuse add/del/replace directory.
* subversion/tests/cmdline/shelf_tests.py
(shelve_unshelve_verify,
shelve_unshelve): Support an expected 'cannot shelve' error.
(shelve_mkdir,
shelve_rmdir): Expect refusal; remove XFail.
(shelve_replace_dir): New test.
(test_list): Run the new test.
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=1833082&r1=1833081&r2=1833082&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/shelf.c (original)
+++ subversion/trunk/subversion/libsvn_client/shelf.c Wed Jun 6 20:59:03 2018
@@ -938,10 +938,16 @@ write_changes_visitor(void *baton,
switch (status->node_status)
{
- case svn_wc_status_modified:
case svn_wc_status_deleted:
case svn_wc_status_added:
case svn_wc_status_replaced:
+ if (status->kind != svn_node_file)
+ {
+ SVN_ERR(note_shelved(wb->unshelvable, wc_relpath, wb->pool));
+ break;
+ }
+ /* fall through */
+ case svn_wc_status_modified:
{
/* Store metadata, and base and working versions if it's a file */
SVN_ERR(store_file(local_abspath, wc_relpath, wb->shelf_version,
Modified: subversion/trunk/subversion/tests/cmdline/shelf_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/shelf_tests.py?rev=1833082&r1=1833081&r2=1833082&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/shelf_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/shelf_tests.py Wed Jun 6 20:59:03 2018
@@ -56,7 +56,7 @@ def state_from_status(wc_dir,
_, output, _ = svntest.main.run_svn(None, 'status', wc_dir, *opts)
return svntest.wc.State.from_status(output, wc_dir)
-def shelve_unshelve_verify(sbox, modifier):
+def shelve_unshelve_verify(sbox, modifier, cannot_shelve=False):
"""Round-trip: shelve; verify all changes are reverted;
unshelve; verify all changes are restored.
"""
@@ -70,6 +70,11 @@ def shelve_unshelve_verify(sbox, modifie
# Save the modified state
modified_state = state_from_status(wc_dir)
+ if cannot_shelve:
+ svntest.actions.run_and_verify_svn(None, '.* could not be shelved.*',
+ 'shelve', 'foo')
+ return
+
# Shelve; check there are no longer any modifications
svntest.actions.run_and_verify_svn(None, [],
'shelve', 'foo')
@@ -82,7 +87,7 @@ def shelve_unshelve_verify(sbox, modifie
#----------------------------------------------------------------------
-def shelve_unshelve(sbox, modifier):
+def shelve_unshelve(sbox, modifier, cannot_shelve=False):
"""Round-trip: build 'sbox'; apply changes by calling 'modifier(sbox)';
shelve and unshelve; verify changes are fully reverted and restored.
"""
@@ -93,7 +98,7 @@ def shelve_unshelve(sbox, modifier):
os.chdir(sbox.wc_dir)
sbox.wc_dir = ''
- shelve_unshelve_verify(sbox, modifier)
+ shelve_unshelve_verify(sbox, modifier, cannot_shelve)
os.chdir(was_cwd)
@@ -472,7 +477,6 @@ def shelf_status(sbox):
#----------------------------------------------------------------------
-@XFail()
def shelve_mkdir(sbox):
"shelve mkdir"
@@ -482,20 +486,36 @@ def shelve_mkdir(sbox):
sbox.simple_mkdir('D', 'D/D2')
sbox.simple_propset('p', 'v', 'D', 'D/D2')
- shelve_unshelve(sbox, modifier)
+ shelve_unshelve(sbox, modifier, cannot_shelve=True)
#----------------------------------------------------------------------
-@XFail()
def shelve_rmdir(sbox):
"shelve rmdir"
sbox.build()
+ sbox.simple_propset('p', 'v', 'A/C')
+ sbox.simple_commit()
def modifier(sbox):
sbox.simple_rm('A/C', 'A/D/G')
- shelve_unshelve(sbox, modifier)
+ shelve_unshelve(sbox, modifier, cannot_shelve=True)
+
+#----------------------------------------------------------------------
+
+def shelve_replace_dir(sbox):
+ "shelve replace dir"
+
+ sbox.build()
+ sbox.simple_propset('p', 'v', 'A/C')
+ sbox.simple_commit()
+
+ def modifier(sbox):
+ sbox.simple_rm('A/C', 'A/D/G')
+ sbox.simple_mkdir('A/C', 'A/C/D2')
+
+ shelve_unshelve(sbox, modifier, cannot_shelve=True)
########################################################################
@@ -522,6 +542,7 @@ test_list = [ None,
shelf_status,
shelve_mkdir,
shelve_rmdir,
+ shelve_replace_dir,
]
if __name__ == '__main__':