You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/08/18 16:02:58 UTC

svn commit: r1159226 - in /subversion/branches/1.7.x: ./ STATUS subversion/svnversion/main.c subversion/tests/cmdline/special_tests.py subversion/tests/cmdline/svnversion_tests.py

Author: hwright
Date: Thu Aug 18 14:02:57 2011
New Revision: 1159226

URL: http://svn.apache.org/viewvc?rev=1159226&view=rev
Log:
Merge r1158196, r1158201, r1158207, r1158209, r1158210, r1158217 from trunk:

 * r1158196, r1158201, r1158207, r1158209, r1158210, r1158217
   Fix another variant of issues #2557 and #3987: 'svnversion symlink/to/wc'.
   Justification:
     That syntax should work.
   Notes:
     r1158196, r1158201, r1158207 adds (and tweaks) the test for tis problem.
   Votes:
     +1: rhuijben, danielsh, cmpilato

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/svnversion/main.c
    subversion/branches/1.7.x/subversion/tests/cmdline/special_tests.py
    subversion/branches/1.7.x/subversion/tests/cmdline/svnversion_tests.py

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 18 14:02:57 2011
@@ -58,4 +58,4 @@
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
 /subversion/branches/uris-as-urls:1060426-1064427
-/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152282,1152726,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158193-1158194,1158285,1158288,115
 8303,1158421,1158436,1158455,1158634
+/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152282,1152726,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,1158193-1158194,1158196,1158201,115
 8207,1158209-1158210,1158217,1158285,1158288,1158303,1158421,1158436,1158455,1158634

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1159226&r1=1159225&r2=1159226&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Thu Aug 18 14:02:57 2011
@@ -145,15 +145,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1158196, r1158201, r1158207, r1158209, r1158210, r1158217
-   Fix another variant of issues #2557 and #3987: 'svnversion symlink/to/wc'.
-   Justification:
-     That syntax should work.
-   Notes:
-     r1158196, r1158201, r1158207 adds (and tweaks) the test for tis problem.
-   Votes:
-     +1: rhuijben, danielsh, cmpilato
-
  * r1158407, r1158419, r1158854
    Fix issue #3989 'merge which deletes file with native eol-style raises
      spurious tree conflict'.

Modified: subversion/branches/1.7.x/subversion/svnversion/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/svnversion/main.c?rev=1159226&r1=1159225&r2=1159226&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/svnversion/main.c (original)
+++ subversion/branches/1.7.x/subversion/svnversion/main.c Thu Aug 18 14:02:57 2011
@@ -27,6 +27,8 @@
 #include "svn_opt.h"
 #include "svn_version.h"
 
+#include "private/svn_opt_private.h"
+
 #include "svn_private_config.h"
 
 #define SVNVERSION_OPT_VERSION SVN_OPT_FIRST_LONGOPT_ID
@@ -122,12 +124,10 @@ main(int argc, const char *argv[])
   const char *local_abspath;
   apr_allocator_t *allocator;
   apr_pool_t *pool;
-  int wc_format;
   svn_wc_revision_status_t *res;
   svn_boolean_t no_newline = FALSE, committed = FALSE;
   svn_error_t *err;
   apr_getopt_t *os;
-  svn_node_kind_t kind;
   svn_wc_context_t *wc_ctx;
   svn_boolean_t quiet = FALSE;
   svn_boolean_t is_version = FALSE;
@@ -224,86 +224,61 @@ main(int argc, const char *argv[])
       return EXIT_FAILURE;
     }
 
-  SVN_INT_ERR(svn_utf_cstring_to_utf8
-              (&wc_path, (os->ind < argc) ? os->argv[os->ind] : ".",
-               pool));
-  wc_path = svn_dirent_internal_style(wc_path, pool);
+  SVN_INT_ERR(svn_utf_cstring_to_utf8(&wc_path,
+                                      (os->ind < argc) ? os->argv[os->ind] 
+                                                       : ".",
+                                      pool));
+
+  SVN_INT_ERR(svn_opt__arg_canonicalize_path(&wc_path, wc_path, pool));
   SVN_INT_ERR(svn_dirent_get_absolute(&local_abspath, wc_path, pool));
   SVN_INT_ERR(svn_wc_context_create(&wc_ctx, NULL, pool, pool));
 
   if (os->ind+1 < argc)
-    SVN_INT_ERR(svn_utf_cstring_to_utf8
-                (&trail_url, os->argv[os->ind+1], pool));
+    SVN_INT_ERR(svn_utf_cstring_to_utf8(&trail_url, os->argv[os->ind+1],
+                                        pool));
   else
     trail_url = NULL;
 
-  SVN_INT_ERR(svn_io_check_path(wc_path, &kind, pool));
-  if (kind == svn_node_dir)
-    {
-      SVN_INT_ERR(svn_wc_check_wc2(&wc_format, wc_ctx, local_abspath, pool));
-      if (wc_format == 0)
-        {
-          SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned directory%s"),
-                                         no_newline ? "" : "\n"));
-          svn_pool_destroy(pool);
-          return EXIT_SUCCESS;
-        }
-      SVN_INT_ERR(svn_wc_revision_status2(&res, wc_ctx, local_abspath,
-                                          trail_url, committed, NULL, NULL,
-                                          pool, pool));
-    }
-  else if (kind == svn_node_file)
+  err = svn_wc_revision_status2(&res, wc_ctx, local_abspath, trail_url,
+                                committed, NULL, NULL, pool, pool);
+
+  if (err && (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND
+              || err->apr_err == SVN_ERR_WC_NOT_WORKING_COPY))
     {
-      SVN_INT_ERR(svn_wc_check_wc2(&wc_format, wc_ctx,
-                                   svn_dirent_dirname(local_abspath, pool),
-                                   pool));
+      svn_node_kind_t kind;
+      svn_boolean_t special;
 
-      /* Unversioned file in unversioned directory */
-      if (wc_format == 0)
+      svn_error_clear(err);
+
+      SVN_INT_ERR(svn_io_check_special_path(local_abspath, &kind, &special,
+                                            pool));
+
+      if (special)
+        SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned symlink%s"),
+                                       no_newline ? "" : "\n"));
+      else if (kind == svn_node_dir)
+        SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned directory%s"),
+                                       no_newline ? "" : "\n"));
+      else if (kind == svn_node_file)
+        SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned file%s"),
+                                       no_newline ? "" : "\n"));
+      else
         {
-          SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned file%s"),
-                                         no_newline ? "" : "\n"));
+          SVN_INT_ERR(svn_cmdline_fprintf(stderr, pool,
+                                          kind == svn_node_none
+                                           ? _("'%s' doesn't exist\n")
+                                           : _("'%s' is of unknown type\n"),
+                                          svn_dirent_local_style(local_abspath,
+                                                                 pool)));
           svn_pool_destroy(pool);
-          return EXIT_SUCCESS;
-        }
-
-      err = svn_wc_revision_status2(&res, wc_ctx, local_abspath,
-                                    trail_url, committed, NULL, NULL,
-                                    pool, pool);
-
-      if (err)
-        {
-          /* Unversioned file in versioned directory */
-          if (err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
-            {
-              svn_error_clear(err);
-              SVN_INT_ERR(svn_cmdline_printf(pool, _("Unversioned file%s"),
-                                             no_newline ? "" : "\n"));
-              svn_pool_destroy(pool);
-              return EXIT_SUCCESS;
-            }
-          else
-              SVN_INT_ERR(err);
+          return EXIT_FAILURE;
         }
-
-    }
-  else if (kind == svn_node_none)
-    {
-      svn_error_clear(svn_cmdline_fprintf(stderr, pool,
-                                          _("'%s' doesn't exist\n"),
-                                          svn_dirent_local_style(wc_path, pool)));
       svn_pool_destroy(pool);
-      return EXIT_FAILURE;
-    }
-  else
-    {
-      svn_error_clear(svn_cmdline_fprintf(stderr, pool,
-                                          _("'%s' is of unknown type\n"),
-                                          svn_dirent_local_style(wc_path, pool)));
-      svn_pool_destroy(pool);
-      return EXIT_FAILURE;
+      return EXIT_SUCCESS;
     }
 
+  SVN_INT_ERR(err);
+
   if (! SVN_IS_VALID_REVNUM(res->min_rev))
     {
       /* Local uncommitted modifications, no revision info was found. */

Modified: subversion/branches/1.7.x/subversion/tests/cmdline/special_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/cmdline/special_tests.py?rev=1159226&r1=1159225&r2=1159226&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/cmdline/special_tests.py (original)
+++ subversion/branches/1.7.x/subversion/tests/cmdline/special_tests.py Thu Aug 18 14:02:57 2011
@@ -800,6 +800,67 @@ def merge_foreign_symlink(sbox):
   #     'A/zeta' : Item(status='A ', wc_rev='-', props={'svn:special': '*'}),
   #     })
 
+#----------------------------------------------------------------------
+# See also symlink_to_wc_svnversion().
+@Issue(2557,3987)
+@SkipUnless(svntest.main.is_posix_os)
+def symlink_to_wc_basic(sbox):
+  "operate on symlink to wc"
+
+  sbox.build(read_only = True)
+  wc_dir = sbox.wc_dir
+
+  # Create a symlink
+  symlink_path = sbox.add_wc_path('2')
+  assert not os.path.islink(symlink_path)
+  os.symlink(os.path.basename(wc_dir), symlink_path) ### implementation detail
+  symlink_basename = os.path.basename(symlink_path)
+
+  # Some basic tests
+  wc_uuid = svntest.actions.get_wc_uuid(wc_dir)
+  expected_info = [{
+      'Path' : re.escape(os.path.join(symlink_path)),
+      'Working Copy Root Path' : re.escape(os.path.abspath(symlink_path)),
+      'Repository Root' : sbox.repo_url,
+      'Repository UUID' : wc_uuid,
+      'Revision' : '1',
+      'Node Kind' : 'directory',
+      'Schedule' : 'normal',
+  }, {
+      'Name' : 'iota',
+      'Path' : re.escape(os.path.join(symlink_path, 'iota')),
+      'Working Copy Root Path' : re.escape(os.path.abspath(symlink_path)),
+      'Repository Root' : sbox.repo_url,
+      'Repository UUID' : wc_uuid,
+      'Revision' : '1',
+      'Node Kind' : 'file',
+      'Schedule' : 'normal',
+  }]
+  svntest.actions.run_and_verify_info(expected_info,
+                                      symlink_path, symlink_path + '/iota')
+
+#----------------------------------------------------------------------
+# Similar to #2557/#3987; see symlink_to_wc_basic().
+@Issue(2557,3987)
+@SkipUnless(svntest.main.is_posix_os)
+def symlink_to_wc_svnversion(sbox):
+  "svnversion on symlink to wc"
+
+  sbox.build(read_only = True)
+  wc_dir = sbox.wc_dir
+
+  # Create a symlink
+  symlink_path = sbox.add_wc_path('2')
+  assert not os.path.islink(symlink_path)
+  os.symlink(os.path.basename(wc_dir), symlink_path) ### implementation detail
+  symlink_basename = os.path.basename(symlink_path)
+
+  # Some basic tests
+  svntest.actions.run_and_verify_svnversion("Unmodified symlink to wc",
+                                            symlink_path, sbox.repo_url,
+                                            [ "1\n" ], [])
+
+
 ########################################################################
 # Run the tests
 
@@ -824,6 +885,8 @@ test_list = [ None,
               unrelated_changed_special_status,
               symlink_destination_change,
               merge_foreign_symlink,
+              symlink_to_wc_basic,
+              symlink_to_wc_svnversion,
              ]
 
 if __name__ == '__main__':

Modified: subversion/branches/1.7.x/subversion/tests/cmdline/svnversion_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/cmdline/svnversion_tests.py?rev=1159226&r1=1159225&r2=1159226&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/cmdline/svnversion_tests.py (original)
+++ subversion/branches/1.7.x/subversion/tests/cmdline/svnversion_tests.py Thu Aug 18 14:02:57 2011
@@ -147,7 +147,8 @@ def svnversion_test(sbox):
   X_path = os.path.join(wc_dir, 'Q', 'X')
   svntest.actions.run_and_verify_svnversion("Nonexistent file or directory",
                                             X_path, repo_url,
-                                            None, [ "'%s' doesn't exist\n" % X_path ])
+                                            None, [ "'%s' doesn't exist\n"
+                                                   % os.path.abspath(X_path) ])
 
   # Perform a sparse checkout of under the existing WC, and confirm that
   # svnversion detects it as a "partial" WC.
@@ -287,9 +288,8 @@ def svnversion_with_structural_changes(s
   svntest.actions.run_and_verify_svnversion("Deleted file",
                                             sbox.ospath('iota'),
                                             repo_url + '/iota',
+                                            ["1M\n"],
                                             [],
-                                            [ "'%s' doesn't exist\n" % \
-                                              sbox.ospath('iota')],
                                             )
   svntest.actions.run_and_verify_svnversion("Deleted file", wc_dir, repo_url,
                                             [ "1:2M\n" ], [])