[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix for reverting broken softlinks

From: David O'Shea <david.oshea_at_s3group.com>
Date: 2007-11-28 10:36:25 CET

Hi,

On 23/11/2007 19:37, David Glasser wrote:
> It looks like a good bug find and fix. Can you write a regression
> test as well? The connection between the "revert" code and
> compare_and_verify isn't immediately obvious to me, so a test is
> especially nice.

I'm attaching an updated patch which contains a new test in revert_tests.py

The diff is against a 1.4.5 tarball, as I cannot check out the trunk
from here. I hope this isn't a problem.

Regards,

David.

-- 
The information contained in this e-mail and in any attachments is confidential and is designated solely for the attention of the intended recipient(s). If you are not an intended recipient, you must not use, disclose, copy, distribute or retain this e-mail or any part thereof. If you have received this e-mail in error, please notify the sender by return e-mail and delete all copies of this e-mail from your computer system(s).
Please direct any additional queries to: communications@s3group.com.
Thank You.
Silicon and Software Systems Limited. Registered in Ireland no. 378073.
Registered Office: Whelan House, South County Business Park, Leopardstown, Dublin 18

[[[
Fix for reverting WC with broken softlinks.

* subversion/libsvn_wc/questions.c
   (compare_and_verify): Do not attempt to read untranslated special files.

]]]

Index: subversion/libsvn_wc/questions.c
=======================================
--- subversion/libsvn_wc/questions.c 2006-07-10 20:36:44.000000000 +0100
+++ subversion/libsvn_wc/questions.c 2007-10-15 11:21:13.000000000 +0100
@@ -308,8 +308,22 @@
         }
       else
         {
- SVN_ERR(svn_io_file_open(&v_file_h, versioned_file, APR_READ,
- APR_OS_DEFAULT, pool));
+ if (special)
+ {
+ const char *dst_tmp;
+ SVN_ERR(svn_io_open_unique_file2(&v_file_h, &dst_tmp, versioned_file,
+ ".tmp", svn_io_file_del_on_close, pool));
+ SVN_ERR(svn_subst_copy_and_translate3(versioned_file, dst_tmp,
+ eol_str, FALSE,
+ keywords, FALSE,
+ special, pool));
+ }
+ else
+ {
+ SVN_ERR(svn_io_file_open(&v_file_h, versioned_file, APR_READ,
+ APR_OS_DEFAULT, pool));
+ }
+
           v_stream = svn_stream_from_aprfile2(v_file_h, FALSE, pool);
 
           if (need_translation)

Index: subversion/tests/cmdline/revert_tests.py
=======================================
--- subversion/tests/cmdline/revert_tests.py 2006-10-23 19:42:53.000000000 +0100
+++ subversion/tests/cmdline/revert_tests.py 2007-11-28 09:20:39.000000000 +0000
@@ -632,6 +632,21 @@
                                      iota_path)
 
 
+def revert_broken_link(sbox):
+ "revert a broken softlink"
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ link_path = os.path.join(wc_dir, 'link')
+ os.symlink('iota', link_path)
+ svntest.main.run_svn(None, 'add', link_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'link', link_path)
+ os.unlink(link_path)
+ os.symlink('broken', link_path)
+ expected_output = re.escape("Reverted '" + link_path + "'")
+ svntest.actions.run_and_verify_svn(None, expected_output, [], 'revert',
+ link_path)
+
 ########################################################################
 # Run the tests
 
@@ -652,6 +667,7 @@
               revert_propset__file,
               revert_propdel__dir,
               revert_propdel__file,
+ revert_broken_link,
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 28 10:36:45 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.