subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1669864 - in /subversion/trunk/tools/dist: backport/merger.py backport_tests.py detect-conflicting-backports.py merge-approved-backports.py
Date Sun, 29 Mar 2015 07:17:38 GMT
Author: danielsh
Date: Sun Mar 29 07:17:37 2015
New Revision: 1669864

URL: http://svn.apache.org/r1669864
Log:
backport: Port another feature to backport.py.  Add a regression test.

* tools/dist/detect-conflicting-backports.py,
* tools/dist/merge-approved-backports.py:
    Check for local mods to STATUS.

* tools/dist/backport/merger.py
  (no_local_mods): New function.

* tools/dist/backport_tests.py
  (backport_STATUS_mods): New test.

Modified:
    subversion/trunk/tools/dist/backport/merger.py
    subversion/trunk/tools/dist/backport_tests.py
    subversion/trunk/tools/dist/detect-conflicting-backports.py
    subversion/trunk/tools/dist/merge-approved-backports.py

Modified: subversion/trunk/tools/dist/backport/merger.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport/merger.py?rev=1669864&r1=1669863&r2=1669864&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport/merger.py (original)
+++ subversion/trunk/tools/dist/backport/merger.py Sun Mar 29 07:17:37 2015
@@ -121,6 +121,11 @@ def last_changed_revision(path_or_url):
     else:
       raise Exception("'svn info' did not print last changed revision")
 
+def no_local_mods(path):
+  "Check PATH for local mods.  Raise if there are any."
+  if run_svn(['status', '-q', '--', path])[1]:
+    raise UnableToMergeException("Local mods on {!r}".format(path))
+
 def _includes_only_svn_mergeinfo_changes(status_output):
   """Return TRUE iff there is exactly one local mod, and it is an svn:mergeinfo
   change.  Use the provided `status -q` output."""

Modified: subversion/trunk/tools/dist/backport_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport_tests.py?rev=1669864&r1=1669863&r2=1669864&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport_tests.py (original)
+++ subversion/trunk/tools/dist/backport_tests.py Sun Mar 29 07:17:37 2015
@@ -624,6 +624,23 @@ def backport_otherproject_change(sbox):
                                 expected_stdout, expected_stderr)
 
 #----------------------------------------------------------------------
+@BackportTest(None)
+def backport_STATUS_mods(sbox):
+  "local mods to STATUS"
+
+  # Introduce a local mod.
+  sbox.simple_append(STATUS, "\n")
+
+  exit_code, output, errput = run_backport(sbox, error_expected=True)
+  expected_stdout = None
+  expected_stderr = ".*Local mods.*STATUS.*"
+  if exit_code == 0:
+    # Can't use verify_exit_code() since the exact code used varies.
+    raise svntest.Failure("exit_code should be non-zero")
+  svntest.verify.verify_outputs(None, output, errput,
+                                expected_stdout, expected_stderr)
+
+#----------------------------------------------------------------------
 
 ########################################################################
 # Run the tests
@@ -640,6 +657,7 @@ test_list = [ None,
               backport_double_conflict,
               backport_branch_with_original_revision,
               backport_otherproject_change,
+              backport_STATUS_mods,
               # When adding a new test, include the test number in the last
               # 6 bytes of the UUID.
              ]

Modified: subversion/trunk/tools/dist/detect-conflicting-backports.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/detect-conflicting-backports.py?rev=1669864&r1=1669863&r2=1669864&view=diff
==============================================================================
--- subversion/trunk/tools/dist/detect-conflicting-backports.py (original)
+++ subversion/trunk/tools/dist/detect-conflicting-backports.py Sun Mar 29 07:17:37 2015
@@ -68,6 +68,7 @@ if sys.argv[1:]:
   print(__doc__)
   sys.exit(0)
 
+backport.merger.no_local_mods('./STATUS')
 sf = backport.status.StatusFile(open('./STATUS'))
 
 ERRORS = collections.defaultdict(list)

Modified: subversion/trunk/tools/dist/merge-approved-backports.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/merge-approved-backports.py?rev=1669864&r1=1669863&r2=1669864&view=diff
==============================================================================
--- subversion/trunk/tools/dist/merge-approved-backports.py (original)
+++ subversion/trunk/tools/dist/merge-approved-backports.py Sun Mar 29 07:17:37 2015
@@ -39,6 +39,7 @@ if sys.argv[1:]:
   print(__doc__)
   sys.exit(0)
 
+backport.merger.no_local_mods('./STATUS')
 sf = backport.status.StatusFile(open('./STATUS'))
 
 # Duplicate sf.paragraphs, since merge() will be removing elements from it.



Mime
View raw message