[Python-checkins] python/dist/src/Tools/scripts logmerge.py,1.9,1.10

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 07 Jan 2003 08:46:28 -0800


Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv21044

Modified Files:
	logmerge.py 
Log Message:
Use regular expressions for branch matching, to avoid including
changes on a sub-branch into output for a given branch.


Index: logmerge.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/logmerge.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** logmerge.py	29 Sep 2002 04:37:36 -0000	1.9
--- logmerge.py	7 Jan 2003 16:46:24 -0000	1.10
***************
*** 34,38 ****
  """
  
! import os, sys, getopt
  
  sep1 = '='*77 + '\n'                    # file separator
--- 34,38 ----
  """
  
! import os, sys, getopt, re
  
  sep1 = '='*77 + '\n'                    # file separator
***************
*** 101,105 ****
      else:
          working_file = None
!     if branch and branch != "HEAD":
          revisions = {}
          key = 'symbolic names:\n'
--- 101,109 ----
      else:
          working_file = None
!     if branch is None:
!         pass
!     elif branch == "HEAD":
!         branch = re.compile(r"^\d+\.\d+$")
!     else:
          revisions = {}
          key = 'symbolic names:\n'
***************
*** 117,124 ****
                      found = 0
          rev = revisions.get(branch)
          if rev:
              if rev.find('.0.') >= 0:
!                 rev = rev.replace('.0.', '.') + '.'
!         branch = rev or "<>" # <> to force a mismatch
      records = []
      for lines in chunk[1:]:
--- 121,129 ----
                      found = 0
          rev = revisions.get(branch)
+         branch = re.compile(r"^<>$") # <> to force a mismatch by default
          if rev:
              if rev.find('.0.') >= 0:
!                 rev = rev.replace('.0.', '.')
!                 branch = re.compile(r"^" + re.escape(rev) + r"\.\d+$")
      records = []
      for lines in chunk[1:]:
***************
*** 145,155 ****
              rev = words[1]
          else:
              rev = None
              text.insert(0, revline)
          if branch:
!             if branch == "HEAD":
!                 if rev is not None and rev.count('.') > 1:
!                     continue
!             elif rev is None or not rev.startswith(branch):
                  continue
          records.append((date, working_file, rev, author, text))
--- 150,158 ----
              rev = words[1]
          else:
+             # No 'revision' line -- weird...
              rev = None
              text.insert(0, revline)
          if branch:
!             if rev is None or not branch.match(rev):
                  continue
          records.append((date, working_file, rev, author, text))