[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: Mon, 12 May 2008 09:50:38 +0100

Hi,

On 09/05/2008 09:27, David O'Shea wrote:
> Ok - I'll take another look at the patch over the weekend and see if I
> can figure anything out. Things are rarely as simple as they first seem!

Updated patch attached. This now explicitly checks the target's
"special" status instead of relying on is_binary (should have done that
in the first place really...)

"make check" passes with this patch.

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 special.

  * 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 31119)
+++ subversion/libsvn_wc/merge.c (working copy)
@@ -674,9 +674,16 @@
         }
       else
         {
- svn_boolean_t same;
+ svn_boolean_t same, special;
+ /* Make sure we use the repository normalised form of the
+ target file if it is special (i.e. don't try to follow
+ symlinks). */
+ SVN_ERR(svn_wc__get_special(&special, merge_target, adm_access, pool));
           SVN_ERR(svn_io_files_contents_same_p(&same, result_target,
- merge_target, pool));
+ (special ?
+ tmp_target :
+ merge_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 31119)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -11258,6 +11258,7 @@
   expected_status.tweak('H_COPY/psi_moved', status='MM')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
+
 #----------------------------------------------------------------------
 # Issue #3157
 def dont_explicitly_record_implicit_mergeinfo(sbox):
@@ -11349,6 +11350,32 @@
                                        None, None, None, None, None, 1)
   
 
+# 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
 
@@ -11515,6 +11542,7 @@
                                server_has_mergeinfo)),
               SkipUnless(dont_explicitly_record_implicit_mergeinfo,
                          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-12 10:51:05 CEST

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.