subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1705174 - in /subversion/trunk/tools/dist/backport: merger.py status.py
Date Thu, 24 Sep 2015 22:04:55 GMT
Author: danielsh
Date: Thu Sep 24 22:04:54 2015
New Revision: 1705174

URL: http://svn.apache.org/viewvc?rev=1705174&view=rev
Log:
backport.py: Start multiproject support.

* tools/dist/backport/status.py
  (StatusFile.BRANCHES): Replace this member object with..
  (StatusFile.branch_url): .. this member function.
  (StatusFile.TRUNK): Replace this member object with..
  (StatusFile.trunk_url): .. this member function.

* tools/dist/backport/merger.py
  (merge, validate_branch_contains_named_revisions): Track API changes.

Modified:
    subversion/trunk/tools/dist/backport/merger.py
    subversion/trunk/tools/dist/backport/status.py

Modified: subversion/trunk/tools/dist/backport/merger.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport/merger.py?rev=1705174&r1=1705173&r2=1705174&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport/merger.py (original)
+++ subversion/trunk/tools/dist/backport/merger.py Thu Sep 24 22:04:54 2015
@@ -161,7 +161,7 @@ def merge(entry, expected_stderr=None, *
   # Prepare mergeargs and logmsg.
   logmsg = ""
   if entry.branch:
-    branch_url = "%s/%s" % (sf.BRANCHES, entry.branch)
+    branch_url = sf.branch_url(entry.branch)
     if svn_version() >= (1, 8):
       mergeargs = ['--', branch_url]
       logmsg = "Merge {}:\n".format(entry.noun())
@@ -181,7 +181,7 @@ def merge(entry, expected_stderr=None, *
       logmsg += "Merge {} from trunk:\n".format(entry.noun())
     logmsg += "\n"
     mergeargs.extend('-c' + str(revision) for revision in entry.revisions)
-    mergeargs.extend(['--', sf.TRUNK])
+    mergeargs.extend(['--', sf.trunk_url()])
   logmsg += entry.raw
 
   # TODO(interactive mode): exclude STATUS from reverts
@@ -237,9 +237,9 @@ def validate_branch_contains_named_revis
     return # skip check
 
   sf = entry.status_file
-  branch_url = "%s/%s" % (sf.BRANCHES, entry.branch)
+  branch_url = sf.branch_url(entry.branch)
   present_str = (
-    run_svn(['mergeinfo', '--show-revs=merged', '--', sf.TRUNK, branch_url])[1]
+    run_svn(['mergeinfo', '--show-revs=merged', '--', sf.trunk_url(), branch_url])[1]
     +
     run_svn(['mergeinfo', '--show-revs=eligible', '--', branch_url])[1]
   )

Modified: subversion/trunk/tools/dist/backport/status.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport/status.py?rev=1705174&r1=1705173&r2=1705174&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport/status.py (original)
+++ subversion/trunk/tools/dist/backport/status.py Thu Sep 24 22:04:54 2015
@@ -157,13 +157,24 @@ class Paragraph:
 class StatusFile:
   "Encapsulates the STATUS file."
 
-  TRUNK = '^/subversion/trunk'
-  BRANCHES = '^/subversion/branches'
-
   def __init__(self, status_fp):
     "Constructor.  STATUS_FP is an open file-like object to parse."
     self._parse(status_fp)
     self.validate_unique_entry_ids() # Use-case for making this optional?
+    self._project_root_url = '^/subversion'
+
+  def branch_url(self, branch_basename):
+    """Return the URL of a branch with a given basename, of 'Branch:' headers
+    that specify a basename only.
+
+    The returned URL may be an ^/foo short URL."""
+    return (self._project_root_url + "/branches/" + branch_basename)
+
+  def trunk_url(self):
+    """Return the URL to trunk.  Trunk is used as the default merge source.
+
+    The returned URL may be an ^/foo short URL."""
+    return self._project_root_url + '/trunk'
 
   def _parse(self, status_fp):
     "Parse self.status_fp into self.paragraphs."



Mime
View raw message