You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2009/12/17 13:30:46 UTC

svn commit: r891672 - in /subversion/trunk/subversion: libsvn_client/commit_util.c tests/cmdline/externals_tests.py

Author: stylesen
Date: Thu Dec 17 12:30:43 2009
New Revision: 891672

URL: http://svn.apache.org/viewvc?rev=891672&view=rev
Log:
Fix issue #3552.

* subversion/libsvn_client/commit_util.c
  (harvest_committables): Do not commit a file externals during a
   copy.

* subversion/tests/cmdline/externals_tests.py
  (wc_repos_file_externals): New test.
  (test_list): Add above test to the list.

Modified:
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/tests/cmdline/externals_tests.py

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=891672&r1=891671&r2=891672&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Thu Dec 17 12:30:43 2009
@@ -430,6 +430,9 @@
          svn_dirent_local_style(path, scratch_pool));
     }
 
+  if (entry->file_external_path && copy_mode)
+    return SVN_NO_ERROR;
+
   if (entry->kind == svn_node_dir)
     {
       /* Read the dir's own entries for use when recursing. */

Modified: subversion/trunk/subversion/tests/cmdline/externals_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/externals_tests.py?rev=891672&r1=891671&r2=891672&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/externals_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/externals_tests.py Thu Dec 17 12:30:43 2009
@@ -1456,6 +1456,108 @@
   ### TODO: Commit the propset and update a pristine working copy from
   ### r2 to r3.
 
+#----------------------------------------------------------------------
+
+# Issue #3552
+def wc_repos_file_externals(sbox):
+  "tag directory with file externals from wc to url"
+
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  repo_url = sbox.repo_url
+
+  # Add a file A/theta.
+  theta_path = os.path.join(wc_dir, 'A', 'theta')
+  svntest.main.file_write(theta_path, 'theta', 'w')
+  svntest.main.run_svn(None, 'add', theta_path)
+
+  # Created expected output tree for 'svn ci'
+  expected_output = svntest.wc.State(wc_dir, {
+    'A/theta' : Item(verb='Adding'),
+    })
+
+  # Create expected status tree
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+  expected_status.add({
+    'A/theta' : Item(status='  ', wc_rev=2),
+    })
+
+  # Commit the new file, creating revision 2.
+  svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+                                        expected_status, None, wc_dir)
+
+
+  # Create a file external on the file A/theta
+  C = os.path.join(wc_dir, 'A', 'C')
+  external = os.path.join(C, 'theta')
+  externals_prop = "^/A/theta theta\n"
+
+  # Set and commit the property.
+  change_external(C, externals_prop)
+
+
+  # Now, /A/C/theta is designated as a file external pointing to
+  # the file /A/theta, but the external file is not there yet.
+  # Try to actually insert the external file via a verified update:
+  expected_output = svntest.wc.State(wc_dir, {
+      'A/C/theta'      : Item(status='E '),
+    })
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({
+    'A/theta'      : Item('theta'),
+    'A/C'          : Item(props={'svn:externals':externals_prop}),
+    'A/C/theta'    : Item('theta'),
+    })
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
+  expected_status.add({
+    'A/theta'   : Item(status='  ', wc_rev=3),
+    'A/C/theta' : Item(status='  ', wc_rev=3, switched='X'),
+    })
+
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None, None, None, None,
+                                        True)
+
+  # Copy A/C to a new tag in the repos
+  tag_url = repo_url + '/A/I'
+  svntest.main.run_svn(None, 'cp', C, tag_url, '-m', 'create tag')
+
+  # Try to actually insert the external file (A/I/theta) via a verified update:
+  expected_output = svntest.wc.State(wc_dir, {
+      'A/I'            : Item(status='A '),
+      'A/I/theta'      : Item(status='E '),
+    })
+
+  expected_disk = svntest.main.greek_state.copy()
+  expected_disk.add({
+    'A/theta'      : Item('theta'),
+    'A/C'          : Item(props={'svn:externals':externals_prop}),
+    'A/C/theta'    : Item('theta'),
+    'A/I'          : Item(props={'svn:externals':externals_prop}),
+    'A/I/theta'    : Item('theta'),
+    })
+
+  expected_status = svntest.actions.get_virginal_state(wc_dir, 4)
+  expected_status.add({
+    'A/theta'   : Item(status='  ', wc_rev=4),
+    'A/C/theta' : Item(status='  ', wc_rev=4, switched='X'),
+    'A/I'       : Item(status='  ', wc_rev=4),
+    'A/I/theta' : Item(status='  ', wc_rev=4, switched='X'),
+    })
+
+  svntest.actions.run_and_verify_update(wc_dir,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status,
+                                        None, None, None, None, None,
+                                        True)
+
+
 ########################################################################
 # Run the tests
 
@@ -1484,6 +1586,7 @@
               XFail(switch_relative_external),
               export_sparse_wc_with_externals,
               relegate_external,
+              wc_repos_file_externals,
              ]
 
 if __name__ == '__main__':



RE: svn commit: r891672 - in /subversion/trunk/subversion: libsvn_client/commit_util.c tests/cmdline/externals_tests.py

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: stylesen@apache.org [mailto:stylesen@apache.org]
> Sent: donderdag 17 december 2009 13:31
> To: commits@subversion.apache.org
> Subject: svn commit: r891672 - in /subversion/trunk/subversion:
> libsvn_client/commit_util.c tests/cmdline/externals_tests.py
> 
> Author: stylesen
> Date: Thu Dec 17 12:30:43 2009
> New Revision: 891672
> 
> URL: http://svn.apache.org/viewvc?rev=891672&view=rev
> Log:
> Fix issue #3552.
> 
> * subversion/libsvn_client/commit_util.c
>   (harvest_committables): Do not commit a file externals during a
>    copy.
> 
> * subversion/tests/cmdline/externals_tests.py
>   (wc_repos_file_externals): New test.
>   (test_list): Add above test to the list.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_client/commit_util.c
>     subversion/trunk/subversion/tests/cmdline/externals_tests.py
> 
> Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/co
> mmit_util.c?rev=891672&r1=891671&r2=891672&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
> +++ subversion/trunk/subversion/libsvn_client/commit_util.c Thu Dec 17
> 12:30:43 2009
> @@ -430,6 +430,9 @@
>           svn_dirent_local_style(path, scratch_pool));
>      }
> 
> +  if (entry->file_external_path && copy_mode)
> +    return SVN_NO_ERROR;
> +

Side discussion:

This check is not easy to perform in WC-NG (e.g. not supported by the design). 

A problem is that a node is only an external when you look at it from a certain parent. And another issue is that checking for the file externals definition leaves the question of what we should do with switched files? (This is almost the same thing in our implementation)

In some other cases we decided that it would be better to handle file externals and switched files as the same status, because the definition of a switched file is well defined. (We only define/implement externals in the client layer at this time. There is just a bit of storage in libsvn_wc reserved to support this client feature).

	Bert