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 2010/03/16 15:22:23 UTC

svn commit: r923751 - in /subversion/branches/1.6.x: ./ CHANGES STATUS subversion/libsvn_client/log.c subversion/tests/cmdline/log_tests.py

Author: hwright
Date: Tue Mar 16 14:22:23 2010
New Revision: 923751

URL: http://svn.apache.org/viewvc?rev=923751&view=rev
Log:
Merge r901752 from trunk:

 * r901752
   Allow 'svn log' on an uncommitted copy/move destination.
   Notes:
     svn_client_log5 API promises that unspecified peg revisions default
     to svn_opt_revision_working for WC paths; prior to r901752 we were
     not keeping this promise.
   Justification:
     APIs should do what they say they do.
   Votes:
     +1: pburba, cmpilato, rhuijben

Modified:
    subversion/branches/1.6.x/   (props changed)
    subversion/branches/1.6.x/CHANGES   (props changed)
    subversion/branches/1.6.x/STATUS
    subversion/branches/1.6.x/subversion/libsvn_client/log.c
    subversion/branches/1.6.x/subversion/tests/cmdline/log_tests.py

Propchange: subversion/branches/1.6.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 16 14:22:23 2010
@@ -57,4 +57,4 @@
 /subversion/branches/tc_url_rev:870696-870828
 /subversion/branches/tree-conflicts:864636-869499
 /subversion/branches/tree-conflicts-notify:870271-870353
-/subversion/trunk:875976,875980-875981,876054-876056,876092,876175,876299,876306,876427,876440,876450,876507,876571,879093,879688,880274-880275,880370,880450,880474,880525-880526,880552,881905,884842,886164,886197,888715,888979,889081,889840,891672,895514,895653,896522,898963,899826,899828,900797,904594,905326,922516
+/subversion/trunk:875976,875980-875981,876054-876056,876092,876175,876299,876306,876427,876440,876450,876507,876571,879093,879688,880274-880275,880370,880450,880474,880525-880526,880552,881905,884842,886164,886197,888715,888979,889081,889840,891672,895514,895653,896522,898963,899826,899828,900797,901752,904594,905326,922516

Propchange: subversion/branches/1.6.x/CHANGES
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 16 14:22:23 2010
@@ -56,4 +56,4 @@
 /subversion/branches/tc_url_rev/CHANGES:870696-870828
 /subversion/branches/tree-conflicts/CHANGES:864636-869499
 /subversion/branches/tree-conflicts-notify/CHANGES:870271-870353
-/subversion/trunk/CHANGES:875962-901365,904594,905326,922516
+/subversion/trunk/CHANGES:875962-901365,901752,904594,905326,922516

Modified: subversion/branches/1.6.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x/STATUS?rev=923751&r1=923750&r2=923751&view=diff
==============================================================================
--- subversion/branches/1.6.x/STATUS (original)
+++ subversion/branches/1.6.x/STATUS Tue Mar 16 14:22:23 2010
@@ -227,17 +227,6 @@ Approved changes:
    Votes:
      +1: pburba, rhuijben, cmpilato
 
- * r901752
-   Allow 'svn log' on an uncommitted copy/move destination.
-   Notes:
-     svn_client_log5 API promises that unspecified peg revisions default
-     to svn_opt_revision_working for WC paths; prior to r901752 we were
-     not keeping this promise.
-   Justification:
-     APIs should do what they say they do.
-   Votes:
-     +1: pburba, cmpilato, rhuijben
-
 * r904301, r904394
    Update every occurence of the Subversion repository URL to apache.org,
    except in CHANGES (for sentimental reasons, I guess).

Modified: subversion/branches/1.6.x/subversion/libsvn_client/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x/subversion/libsvn_client/log.c?rev=923751&r1=923750&r2=923751&view=diff
==============================================================================
--- subversion/branches/1.6.x/subversion/libsvn_client/log.c (original)
+++ subversion/branches/1.6.x/subversion/libsvn_client/log.c Tue Mar 16 14:22:23 2010
@@ -317,6 +317,7 @@ svn_client_log5(const apr_array_header_t
   pre_15_receiver_baton_t rb = {0};
   apr_pool_t *iterpool;
   int i;
+  svn_opt_revision_t peg_rev;
 
   if (revision_ranges->nelts == 0)
     {
@@ -325,6 +326,11 @@ svn_client_log5(const apr_array_header_t
          _("Missing required revision specification"));
     }
 
+  /* Make a copy of PEG_REVISION, we may need to change it to a
+     default value. */
+  peg_rev.kind = peg_revision->kind;
+  peg_rev.value = peg_revision->value;
+
   /* Use the passed URL, if there is one.  */
   url_or_path = APR_ARRAY_IDX(targets, 0, const char *);
   is_url = svn_path_is_url(url_or_path);
@@ -362,7 +368,7 @@ svn_client_log5(const apr_array_header_t
           /* Default to any specified peg revision.  Otherwise, if the
            * first target is an URL, then we default to HEAD:0.  Lastly,
            * the default is BASE:0 since WC@HEAD may not exist. */
-          if (peg_revision->kind == svn_opt_revision_unspecified)
+          if (peg_rev.kind == svn_opt_revision_unspecified)
             {
               if (svn_path_is_url(url_or_path))
                 range->start.kind = svn_opt_revision_head;
@@ -370,7 +376,7 @@ svn_client_log5(const apr_array_header_t
                 range->start.kind = svn_opt_revision_base;
             }
           else
-            range->start = *peg_revision;
+            range->start = peg_rev;
 
           if (range->end.kind == svn_opt_revision_unspecified)
             {
@@ -453,6 +459,11 @@ svn_client_log5(const apr_array_header_t
                                 _("When specifying working copy paths, only "
                                   "one target may be given"));
 
+      /* An unspecified PEG_REVISION for a working copy path defautls
+         to svn_opt_revision_working. */
+      if (peg_rev.kind == svn_opt_revision_unspecified)
+          peg_rev.kind = svn_opt_revision_working;
+
       /* Get URLs for each target */
       target_urls = apr_array_make(pool, 1, sizeof(const char *));
       real_targets = apr_array_make(pool, 1, sizeof(const char *));
@@ -504,14 +515,14 @@ svn_client_log5(const apr_array_header_t
     /* If this is a revision type that requires access to the working copy,
      * we use our initial target path to figure out where to root the RA
      * session, otherwise we use our URL. */
-    if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_revision->kind))
+    if (SVN_CLIENT__REVKIND_NEEDS_WC(peg_rev.kind))
       SVN_ERR(svn_path_condense_targets(&ra_target, NULL, targets, TRUE, pool));
     else
       ra_target = url_or_path;
 
     SVN_ERR(svn_client__ra_session_from_path(&ra_session, &ignored_revnum,
                                              &actual_url, ra_target, NULL,
-                                             peg_revision, &session_opt_rev,
+                                             &peg_rev, &session_opt_rev,
                                              ctx, pool));
 
     SVN_ERR(svn_ra_has_capability(ra_session, &has_log_revprops,

Modified: subversion/branches/1.6.x/subversion/tests/cmdline/log_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x/subversion/tests/cmdline/log_tests.py?rev=923751&r1=923750&r2=923751&view=diff
==============================================================================
--- subversion/branches/1.6.x/subversion/tests/cmdline/log_tests.py (original)
+++ subversion/branches/1.6.x/subversion/tests/cmdline/log_tests.py Tue Mar 16 14:22:23 2010
@@ -1640,6 +1640,57 @@ def merge_sensitive_log_propmod_merge_in
   run_log_g_r8(A_COPY_path)
   run_log_g_r8(A_COPY_psi_path)
 
+#----------------------------------------------------------------------
+# Should be able to run 'svn log' against an uncommitted copy or move
+# destination.  See http://svn.haxx.se/dev/archive-2010-01/0492.shtml.
+def log_of_local_copy(sbox):
+  "svn log on an uncommitted copy"
+
+  guarantee_repos_and_wc(sbox)
+
+  C_path         = os.path.join(sbox.wc_dir, "A", "C")
+  C_moved_path   = os.path.join(sbox.wc_dir, "A", "C_MOVED")
+  psi_path       = os.path.join(sbox.wc_dir, "A", "D", "H", "psi")
+  psi_moved_path = os.path.join(sbox.wc_dir, "A", "D", "H", "psi_moved")
+
+  # Get the logs for a directory and a file.
+  exit_code, C_log_out, err = svntest.actions.run_and_verify_svn(
+    None, None, [], 'log', '-v', C_path)
+  exit_code, psi_log_out, err = svntest.actions.run_and_verify_svn(
+    None, None, [], 'log', '-v', psi_path)
+
+  # Move that directory and file.
+  svntest.actions.run_and_verify_svn(None, None, [], 'mv',
+                                     C_path, C_moved_path)
+  svntest.actions.run_and_verify_svn(None, None, [], 'mv',
+                                     psi_path, psi_moved_path)
+  
+  # Get the logs for the move destinations.
+  #
+  # This was failing with:
+  #
+  #   svn log -v log_tests-29\A\C_MOVED
+  #    ..\..\..\subversion\svn\log-cmd.c:600: (apr_err=160013)
+  #    ..\..\..\subversion\libsvn_client\log.c:627: (apr_err=160013)
+  #    ..\..\..\subversion\libsvn_repos\log.c:1449: (apr_err=160013)
+  #    ..\..\..\subversion\libsvn_repos\log.c:1092: (apr_err=160013)
+  #    ..\..\..\subversion\libsvn_fs_fs\tree.c:2818: (apr_err=160013)
+  #    svn: File not found: revision 9, path '/A/C_MOVED'
+  #
+  exit_code, C_moved_log_out, err = svntest.actions.run_and_verify_svn(
+    None, None, [], 'log', '-v', C_moved_path)
+  exit_code, psi_moved_log_out, err = svntest.actions.run_and_verify_svn(
+    None, None, [], 'log', '-v', psi_moved_path)
+
+  # The logs of the move source and destinations should be the same.
+  if C_log_out != C_moved_log_out:
+    raise svntest.Failure("Log on uncommitted move destination '%s' " \
+                          "differs from that on move source '%s'"
+                          % (C_moved_path, C_path))
+  if psi_log_out != psi_moved_log_out:
+    raise svntest.Failure("Log on uncommitted move destination '%s' " \
+                          "differs from that on move source '%s'"
+                          % (psi_moved_path, psi_path))
 
 ########################################################################
 # Run the tests
@@ -1681,6 +1732,7 @@ test_list = [ None,
                          server_has_mergeinfo),
               SkipUnless(merge_sensitive_log_propmod_merge_inheriting_path,
                          server_has_mergeinfo),
+              log_of_local_copy,
              ]
 
 if __name__ == '__main__':