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

[PATCH] Fix merging with broken softlink as target

From: David O'Shea <david.oshea_at_s3group.com>
Date: Mon, 05 May 2008 22:34:18 +0100

Hi,

When merging a branch with a symbolic link change onto another branch
where the original link destination doesn't exist, the merge fails.

(e.g http://svn.haxx.se/dev/archive-2008-02/0772.shtml)

This is a problem in 1.4.x and on the trunk. The attached patch (with
test included) against the trunk fixes this.

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_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)
@@ -656,7 +656,10 @@
         {
           svn_boolean_t same;
           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-05 23:34:29 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.