You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2013/02/05 21:42:54 UTC

svn commit: r1442735 - in /subversion/trunk/subversion/tests/cmdline: basic_tests.py merge_tests.py patch_tests.py stat_tests.py tree_conflict_tests.py update_tests.py

Author: julianfoad
Date: Tue Feb  5 20:42:53 2013
New Revision: 1442735

URL: http://svn.apache.org/viewvc?rev=1442735&view=rev
Log:
Put a tiny bit more structure into the Python tests: get the expected text
for a summary of conflicts from the new summary_of_conflicts() function.

* subversion/tests/cmdline/basic_tests.py
  (basic_update): As above.

* subversion/tests/cmdline/merge_tests.py
  (merge_target_selection): Same.

* subversion/tests/cmdline/patch_tests.py
  (patch_absolute_paths,
   patch_add_new_dir,
   patch_reject,
   patch_same_twice,
   patch_dir_properties,
   patch_delete_and_skip,
   single_line_mismatch): Same.

* subversion/tests/cmdline/stat_tests.py
  (status_add_plus_conflict,
   status_with_tree_conflicts): Same.

* subversion/tests/cmdline/tree_conflict_tests.py
  (actual_only_node_behaviour): Same.

* subversion/tests/cmdline/update_tests.py
  (update_output_with_conflicts, update_output_with_conflicts_resolved):
    New functions, using summary_of_conflicts().
  (update_accept_conflicts): Use them.

Modified:
    subversion/trunk/subversion/tests/cmdline/basic_tests.py
    subversion/trunk/subversion/tests/cmdline/merge_tests.py
    subversion/trunk/subversion/tests/cmdline/patch_tests.py
    subversion/trunk/subversion/tests/cmdline/stat_tests.py
    subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py
    subversion/trunk/subversion/tests/cmdline/update_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1442735&r1=1442734&r2=1442735&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Tue Feb  5 20:42:53 2013
@@ -209,8 +209,8 @@ def basic_update(sbox):
   exit_code, out, err = svntest.actions.run_and_verify_svn(
     "update xx/xx",
     ["Skipped '"+xx_path+"'\n",
-    "Summary of conflicts:\n",
-    "  Skipped paths: 1\n"], [], 'update', xx_path)
+    ] + svntest.main.summary_of_conflicts(skipped_paths=1),
+    [], 'update', xx_path)
   exit_code, out, err = svntest.actions.run_and_verify_svn(
     "update xx/xx", [], [],
     'update', '--quiet', xx_path)

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1442735&r1=1442734&r2=1442735&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Tue Feb  5 20:42:53 2013
@@ -18083,9 +18083,7 @@ def merge_target_selection(sbox):
     '   C .\n',
     '--- Recording mergeinfo for merge of r4 into \'.\':\n',
     ' U   .\n',
-    'Summary of conflicts:\n',
-    '  Tree conflicts: 1\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(tree_conflicts=1)
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'merge', '^/dir/binary-file', '-c', '4', '.')
 
@@ -18097,9 +18095,7 @@ def merge_target_selection(sbox):
     '   C %s\n' % os.path.join('binary-file'),
     '--- Recording mergeinfo for merge of r4 into \'binary-file\':\n',
     ' U   binary-file\n',
-    'Summary of conflicts:\n',
-    '  Tree conflicts: 1\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(tree_conflicts=1)
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'merge', '^/dir', '-c', '4', 'binary-file')
 

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1442735&r1=1442734&r2=1442735&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Feb  5 20:42:53 2013
@@ -266,9 +266,7 @@ def patch_absolute_paths(sbox):
   expected_output = [
     'U         %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
     'Skipped missing target: \'%s\'\n' % lambda_path,
-    'Summary of conflicts:\n',
-    '  Skipped paths: 1\n'
-  ]
+  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
 
   alpha_contents = "This is the file 'alpha'.\nWhoooo whooooo whoooooooo!\n"
 
@@ -988,9 +986,7 @@ def patch_add_new_dir(sbox):
     'Skipped missing target: \'%s\'\n' % A_B_E_Y_new_path,
     'Skipped missing target: \'%s\'\n' % A_C_new_path,
     'Skipped missing target: \'%s\'\n' % A_Z_new_path,
-    'Summary of conflicts:\n',
-    '  Skipped paths: 3\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(skipped_paths=3)
 
   # Create the unversioned obstructing directory
   os.mkdir(os.path.dirname(A_Z_new_path))
@@ -1174,9 +1170,7 @@ def patch_reject(sbox):
   expected_output = [
     'C         %s\n' % sbox.ospath('A/D/gamma'),
     '>         rejected hunk @@ -1,1 +1,1 @@\n',
-    'Summary of conflicts:\n',
-    '  Text conflicts: 1\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.tweak('A/D/gamma', contents=gamma_contents)
@@ -2456,9 +2450,7 @@ def patch_same_twice(sbox):
     '>         hunk @@ -6,6 +6,9 @@ already applied\n',
     '>         hunk @@ -14,11 +17,8 @@ already applied\n',
     'Skipped \'%s\'\n' % beta_path,
-    'Summary of conflicts:\n',
-    '  Skipped paths: 1\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
 
   expected_skip = wc.State('', {beta_path : Item(verb='Skipped')})
 
@@ -2543,9 +2535,7 @@ def patch_dir_properties(sbox):
   expected_output = [
     ' U        %s\n' % wc_dir,
     ' C        %s\n' % sbox.ospath('A/B'),
-    'Summary of conflicts:\n',
-    '  Property conflicts: 1\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(prop_conflicts=1)
 
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.add({
@@ -3969,9 +3959,7 @@ def patch_delete_and_skip(sbox):
     'D         %s\n' % os.path.join('A', 'B', 'E', 'beta'),
     'D         %s\n' % os.path.join('A', 'B', 'E'),
     'Skipped missing target: \'%s\'\n' % skipped_path,
-    'Summary of conflicts:\n',
-    '  Skipped paths: 1\n'
-  ]
+  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
 
   expected_disk = svntest.main.greek_state.copy()
   expected_disk.remove('A/B/E/alpha')
@@ -4402,9 +4390,7 @@ def single_line_mismatch(sbox):
   expected_output = [
     'C         %s\n' % sbox.ospath('test'),
     '>         rejected hunk @@ -1,1 +1,1 @@\n',
-    'Summary of conflicts:\n',
-    '  Text conflicts: 1\n',
-  ]
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
 
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'patch', patch_file_path, wc_dir)

Modified: subversion/trunk/subversion/tests/cmdline/stat_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/stat_tests.py?rev=1442735&r1=1442734&r2=1442735&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/stat_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/stat_tests.py Tue Feb  5 20:42:53 2013
@@ -1073,9 +1073,7 @@ def status_add_plus_conflict(sbox):
     "?       " + sbox.ospath('trunk/file.merge-right.r5') + "\n",
     "?       " + sbox.ospath('trunk/file.working') + "\n",
     "C  +    " + sbox.ospath('trunk/file') + "\n",
-    "Summary of conflicts:\n",
-    "  Text conflicts: 1\n",
-  ]
+  ] + svntest.main.summary_of_conflicts(text_conflicts=1)
   if svntest.main.server_has_mergeinfo():
     lines.append(" M      " + sbox.ospath('trunk') + "\n")
 
@@ -1745,9 +1743,7 @@ def status_with_tree_conflicts(sbox):
           "      >   local file delete, incoming file edit upon update\n",
           "!     C %s\n" % tau,
           "      >   local file delete, incoming file delete upon update\n",
-          "Summary of conflicts:\n",
-          "  Tree conflicts: 3\n",
-          ])
+         ] + svntest.main.summary_of_conflicts(tree_conflicts=3))
 
   svntest.actions.run_and_verify_svn(None,
                                      expected,
@@ -1763,10 +1759,7 @@ def status_with_tree_conflicts(sbox):
           "      >   local file edit, incoming file delete upon update\n",
           "!     C                                  %s\n" % tau,
           "      >   local file delete, incoming file delete upon update\n",
-          "Summary of conflicts:\n",
-          "  Tree conflicts: 3\n",
-          ])
-
+         ] + svntest.main.summary_of_conflicts(tree_conflicts=3))
 
   svntest.actions.run_and_verify_svn(None,
                                      expected,

Modified: subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py?rev=1442735&r1=1442734&r2=1442735&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py Tue Feb  5 20:42:53 2013
@@ -1376,9 +1376,7 @@ def actual_only_node_behaviour(sbox):
   # update (up)
   expected_stdout = [
    "Skipped '%s' -- Node remains in conflict\n" % sbox.ospath('A/foo'),
-   "Summary of conflicts:\n",
-   "  Skipped paths: 1\n",
-  ]
+  ] + svntest.main.summary_of_conflicts(skipped_paths=1)
   expected_stderr = []
   run_and_verify_svn(None, expected_stdout, expected_stderr,
                      "update", foo_path)

Modified: subversion/trunk/subversion/tests/cmdline/update_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/update_tests.py?rev=1442735&r1=1442734&r2=1442735&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/update_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/update_tests.py Tue Feb  5 20:42:53 2013
@@ -3694,6 +3694,35 @@ def update_copied_and_deleted_prop(sbox)
 
 #----------------------------------------------------------------------
 
+def update_output_with_conflicts(rev, target, paths=None):
+  """Return the expected output for an update of TARGET to revision REV, in
+     which all of the PATHS are updated and conflicting.
+
+     If PATHS is None, it means [TARGET].  The output is a list of lines.
+  """
+  if paths is None:
+    paths = [target]
+
+  lines = ["Updating '%s':\n" % target]
+  for path in paths:
+    lines += ['C    %s\n' % path]
+  lines += ['Updated to revision %d.\n' % rev]
+  lines += svntest.main.summary_of_conflicts(text_conflicts=len(paths))
+  return lines
+
+def update_output_with_conflicts_resolved(rev, target, paths=None):
+  """Like update_output_with_conflicts(), but where all of the conflicts are
+     resolved within the update.
+  """
+  if paths is None:
+    paths = [target]
+
+  lines = update_output_with_conflicts(rev, target, paths)
+  for path in paths:
+    lines += ["Resolved conflicted state of '%s'\n" % path]
+  return lines
+
+#----------------------------------------------------------------------
 
 def update_accept_conflicts(sbox):
   "update --accept automatic conflict resolution"
@@ -3778,22 +3807,16 @@ def update_accept_conflicts(sbox):
   # Just leave the conflicts alone, since run_and_verify_svn already uses
   # the --non-interactive option.
   svntest.actions.run_and_verify_svn(None,
-                                     ["Updating '%s':\n" % (iota_path_backup),
-                                      'C    %s\n' % (iota_path_backup,),
-                                      'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n'],
+                                     update_output_with_conflicts(
+                                       2, iota_path_backup),
                                      [],
                                      'update', iota_path_backup)
 
   # lambda: --accept=postpone
   # Just leave the conflicts alone.
   svntest.actions.run_and_verify_svn(None,
-                                     ["Updating '%s':\n" % (lambda_path_backup),
-                                      'C    %s\n' % (lambda_path_backup,),
-                                      'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n'],
+                                     update_output_with_conflicts(
+                                       2, lambda_path_backup),
                                      [],
                                      'update', '--accept=postpone',
                                      lambda_path_backup)
@@ -3801,13 +3824,8 @@ def update_accept_conflicts(sbox):
   # mu: --accept=base
   # Accept the pre-update base file.
   svntest.actions.run_and_verify_svn(None,
-                                     ["Updating '%s':\n" % (mu_path_backup),
-                                      'C    %s\n' % (mu_path_backup,),
-                                      'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n',
-                                      "Resolved conflicted state of '%s'\n"
-                                        % (mu_path_backup)],
+                                     update_output_with_conflicts_resolved(
+                                       2, mu_path_backup),
                                      [],
                                      'update', '--accept=base',
                                      mu_path_backup)
@@ -3815,13 +3833,8 @@ def update_accept_conflicts(sbox):
   # alpha: --accept=mine
   # Accept the user's working file.
   svntest.actions.run_and_verify_svn(None,
-                                     ["Updating '%s':\n" % (alpha_path_backup),
-                                      'C    %s\n' % (alpha_path_backup,),
-                                      'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n',
-                                      "Resolved conflicted state of '%s'\n"
-                                        % (alpha_path_backup)],
+                                     update_output_with_conflicts_resolved(
+                                       2, alpha_path_backup),
                                      [],
                                      'update', '--accept=mine-full',
                                      alpha_path_backup)
@@ -3829,13 +3842,8 @@ def update_accept_conflicts(sbox):
   # beta: --accept=theirs
   # Accept their file.
   svntest.actions.run_and_verify_svn(None,
-                                     ["Updating '%s':\n" % (beta_path_backup),
-                                      'C    %s\n' % (beta_path_backup,),
-                                      'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n',
-                                      "Resolved conflicted state of '%s'\n"
-                                        % (beta_path_backup)],
+                                     update_output_with_conflicts_resolved(
+                                       2, beta_path_backup),
                                      [],
                                      'update', '--accept=theirs-full',
                                      beta_path_backup)
@@ -3845,13 +3853,8 @@ def update_accept_conflicts(sbox):
   # conflicts in place, so expect a message on stderr, but expect
   # svn to exit with an exit code of 0.
   svntest.actions.run_and_verify_svn2(None,
-                                      ["Updating '%s':\n" % (pi_path_backup),
-                                       'C    %s\n' % (pi_path_backup,),
-                                       'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n',
-                                      "Resolved conflicted state of '%s'\n"
-                                        % (pi_path_backup)],
+                                      update_output_with_conflicts_resolved(
+                                        2, pi_path_backup),
                                       "system(.*) returned.*", 0,
                                       'update', '--accept=edit',
                                       '--force-interactive',
@@ -3860,11 +3863,8 @@ def update_accept_conflicts(sbox):
   # rho: --accept=launch
   # Run the external merge tool, it should leave conflict markers in place.
   svntest.actions.run_and_verify_svn(None,
-                                     ["Updating '%s':\n" % (rho_path_backup),
-                                      'C    %s\n' % (rho_path_backup,),
-                                      'Updated to revision 2.\n',
-                                      'Summary of conflicts:\n',
-                                      '  Text conflicts: 1\n'],
+                                     update_output_with_conflicts(
+                                       2, rho_path_backup),
                                      [],
                                      'update', '--accept=launch',
                                      '--force-interactive',