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

Re: [PATCH] Fix merging with broken softlink as target

From: David O'Shea <david.oshea_at_s3group.com>
Date: Wed, 07 May 2008 08:18:55 +0100

Hi,

Updated patch attached.

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_at_s3group.com.
Thank You.
Silicon and Software Systems Limited. Registered in Ireland no. 378073.
Registered Office: South County Business Park, Leopardstown, Dublin 18

[[[
Fix a file not found error when a merge target is a broken symbolic link.

* subversion/libsvn_wc/merge.c
  (svn_wc__merge_internal): Diff translated target file if not binary.

* subversion/tests/cmdlink/merge_tests.py
  (merge_broken_link): New test function.
  (test_list): Call the new test function.
]]]

Index: subversion/libsvn_wc/merge.c
===================================================================
--- subversion/libsvn_wc/merge.c (revision 31014)
+++ subversion/libsvn_wc/merge.c (working copy)
@@ -655,8 +655,15 @@
       else
         {
           svn_boolean_t same;
+ /* Make sure we use the repository normalised form of the
+ target file if it is available (i.e. if the file is
+ not binary). This means it should do the right thing
+ for symlinks and not try to follow them. */
           SVN_ERR(svn_io_files_contents_same_p(&same, result_target,
- merge_target, pool));
+ (is_binary ?
+ merge_target :
+ tmp_target),
+ pool));
 
           *merge_outcome = same ? svn_wc_merge_unchanged : svn_wc_merge_merged;
         }
Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py (revision 31014)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -11245,6 +11245,33 @@
   expected_status.tweak('H_COPY/psi_moved', status='MM')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
+
+# Test for issue where merging a change to a broken link fails
+def merge_broken_link(sbox):
+ "merge with broken symlinks in target"
+
+ # Create our good 'ole greek tree.
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ src_path = os.path.join(wc_dir, 'A', 'B', 'E')
+ copy_path = os.path.join(wc_dir, 'A', 'B', 'E_COPY')
+ link_path = os.path.join(src_path, 'beta_link')
+
+ os.symlink('beta_broken', link_path)
+ svntest.main.run_svn(None, 'add', link_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'Create a broken link', link_path)
+ svntest.main.run_svn(None, 'copy', src_path, copy_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'Copy the tree with the broken link',
+ copy_path)
+ os.unlink(link_path)
+ os.symlink('beta', link_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'Fix a broken link', link_path)
+ svntest.actions.run_and_verify_svn(
+ None,
+ expected_merge_output([[4]], 'U ' + copy_path + '/beta_link\n'),
+ [], 'merge', '-c4', src_path, copy_path)
+
+
 ########################################################################
 # Run the tests
 
@@ -11409,6 +11436,7 @@
                                server_has_mergeinfo)),
               XFail(SkipUnless(merge_chokes_on_renamed_subtrees,
                                server_has_mergeinfo)),
+ merge_broken_link,
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-07 09:29:13 CEST

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