subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1850419 - /subversion/site/tools/upcoming.py
Date Fri, 04 Jan 2019 18:39:54 GMT
Author: danielsh
Date: Fri Jan  4 18:39:54 2019
New Revision: 1850419

URL: http://svn.apache.org/viewvc?rev=1850419&view=rev
Log:
site tools: Teach upcoming.py to compute a previously-hardcoded value.

* tools/upcoming.py
  (get_copyfrom_revision_of_tag, SINCE): Remove.
  (copyfrom_revision_of_previous_tag_of_this_stable_branch): New.
  (main): Update caller.

Modified:
    subversion/site/tools/upcoming.py

Modified: subversion/site/tools/upcoming.py
URL: http://svn.apache.org/viewvc/subversion/site/tools/upcoming.py?rev=1850419&r1=1850418&r2=1850419&view=diff
==============================================================================
--- subversion/site/tools/upcoming.py (original)
+++ subversion/site/tools/upcoming.py Fri Jan  4 18:39:54 2019
@@ -16,15 +16,23 @@ import tempfile
 
 import xml.etree.ElementTree as ET
 
-SINCE = '1.11.0'
 SVN = os.getenv('SVN', 'svn')
 LOG_SEPARATOR_LINE = ('-' * 72) + '\n'
 
-def get_copyfrom_revision_of_tag(version_number):
-    """Given a version number, return the copyfrom revision of that release's tag."""
-    assert version_number == SINCE
-    # TODO: parse and return `svn log -r0:HEAD --limit=1 --stop-on-copy ^/subversion/tags/1.11.0
-vq`
-    return 1845131
+def copyfrom_revision_of_previous_tag_of_this_stable_branch():
+    """Returns the copyfrom revision of the previous tag of the stable branch
+    checked out in cwd."""
+    ### Doesn't work during the alpha/beta/rc phase; works only after 1.A.0 has been tagged
+    version_string = subprocess.check_output(['build/getversion.py', 'SVN', 'subversion/include/svn_version.h']).decode()
+    version_broken_down = list(map(int, version_string.split('.')))
+    version_broken_down[-1] -= 1
+    assert version_broken_down[-1] >= 0
+    target = '^/subversion/tags/' + '.'.join(map(str, version_broken_down))
+    log_output = \
+        subprocess.check_output(
+            [SVN, 'log', '-q', '-v', '-l1', '-rHEAD:0', '--stop-on-copy', '--', target]
+        ).decode()
+    return int(re.compile(r'[(]from \S*:(\d+)[)]').search(log_output).group(1))
 
 def get_merges_for_range(start, end):
     """Return an array of revision numbers in the range -r START:END that are
@@ -45,7 +53,8 @@ def get_merges_for_range(start, end):
             yield logentry
 
 def main():
-    for logentry in get_merges_for_range(get_copyfrom_revision_of_tag(SINCE) + 1, "HEAD")
:
+    start_revision = copyfrom_revision_of_previous_tag_of_this_stable_branch() + 1
+    for logentry in get_merges_for_range(start_revision, "HEAD"):
         f = lambda s: logentry.findall('./' + s)[0].text
         f.__doc__ = """Get the contents of the first child tag whose name is given as an
argument."""
         print(LOG_SEPARATOR_LINE, end='')



Mime
View raw message