You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/04/17 15:58:01 UTC

svn commit: r935177 - in /subversion/trunk/subversion: svnversion/main.c tests/cmdline/svnversion_tests.py

Author: dannas
Date: Sat Apr 17 13:58:01 2010
New Revision: 935177

URL: http://svn.apache.org/viewvc?rev=935177&view=rev
Log:
After the changes in r922176, versioned but not yet committed files were
not properly detected. Fixed now!

* subversion/svnversion/main.c
  (main): Check for invalid revision number for both files and dirs.

* subversion/tests/cmdline/svnversion_tests.py
  (svnversion_with_structural_changes): New.
  (tests_list): Add new test.

Review by: stsp

Modified:
    subversion/trunk/subversion/svnversion/main.c
    subversion/trunk/subversion/tests/cmdline/svnversion_tests.py

Modified: subversion/trunk/subversion/svnversion/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnversion/main.c?rev=935177&r1=935176&r2=935177&view=diff
==============================================================================
--- subversion/trunk/subversion/svnversion/main.c (original)
+++ subversion/trunk/subversion/svnversion/main.c Sat Apr 17 13:58:01 2010
@@ -290,6 +290,16 @@ main(int argc, const char *argv[])
       return EXIT_FAILURE;
     }
 
+  if (! SVN_IS_VALID_REVNUM(res->min_rev))
+    {
+      /* Local uncommitted modifications, no revision info was found. */
+      SVN_INT_ERR(svn_cmdline_printf(pool, _("Uncommitted local addition, "
+                                             "copy or move%s"),
+                                             no_newline ? "" : "\n"));
+      svn_pool_destroy(pool);
+      return EXIT_SUCCESS;
+    }
+
   /* Build compact '123[:456]M?S?' string. */
   SVN_INT_ERR(svn_cmdline_printf(pool, "%ld", res->min_rev));
   if (res->min_rev != res->max_rev)

Modified: subversion/trunk/subversion/tests/cmdline/svnversion_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnversion_tests.py?rev=935177&r1=935176&r2=935177&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svnversion_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svnversion_tests.py Sat Apr 17 13:58:01 2010
@@ -237,6 +237,36 @@ def svnversion_with_excluded_subtrees(sb
                                             D_path, repo_url + '/A/D',
                                             [ "1P\n" ], [])
 
+def svnversion_with_structural_changes(sbox):
+  "test 'svnversion' with structural changes"
+  sbox.build()
+  wc_dir = sbox.wc_dir
+  repo_url = sbox.repo_url
+
+  iota_path = os.path.join(wc_dir, 'iota')
+  iota_copy_path = os.path.join(wc_dir, 'iota_copy')
+
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'cp', iota_path, iota_copy_path)
+
+  svntest.actions.run_and_verify_svnversion("Copied file",
+                                            iota_copy_path, repo_url +
+                                            '/iota_copy',
+                                            [ "Uncommitted local addition, "
+                                            "copy or move\n" ], 
+                                            [])
+  C_path = os.path.join(wc_dir, 'A', 'C')
+  C_copy_path = os.path.join(wc_dir, 'C_copy')
+  svntest.actions.run_and_verify_svn(None, None, [],
+                                     'cp', C_path, C_copy_path)
+
+  svntest.actions.run_and_verify_svnversion("Copied dir",
+                                            C_copy_path, repo_url +
+                                            '/C_copy',
+                                            [ "Uncommitted local addition, "
+                                            "copy or move\n" ], 
+                                            [])
+
 ########################################################################
 # Run the tests
 
@@ -246,6 +276,7 @@ test_list = [ None,
               svnversion_test,
               ignore_externals,
               svnversion_with_excluded_subtrees,
+              svnversion_with_structural_changes,
              ]
 
 if __name__ == '__main__':