mirror of
https://github.com/python/cpython.git
synced 2025-10-13 18:33:34 +00:00
Use regular expressions for branch matching, to avoid including
changes on a sub-branch into output for a given branch.
This commit is contained in:
parent
373c7412f2
commit
8b7b345328
1 changed files with 11 additions and 8 deletions
|
@ -33,7 +33,7 @@ from their output.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, sys, getopt
|
import os, sys, getopt, re
|
||||||
|
|
||||||
sep1 = '='*77 + '\n' # file separator
|
sep1 = '='*77 + '\n' # file separator
|
||||||
sep2 = '-'*28 + '\n' # revision separator
|
sep2 = '-'*28 + '\n' # revision separator
|
||||||
|
@ -100,7 +100,11 @@ def digest_chunk(chunk, branch=None):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
working_file = None
|
working_file = None
|
||||||
if branch and branch != "HEAD":
|
if branch is None:
|
||||||
|
pass
|
||||||
|
elif branch == "HEAD":
|
||||||
|
branch = re.compile(r"^\d+\.\d+$")
|
||||||
|
else:
|
||||||
revisions = {}
|
revisions = {}
|
||||||
key = 'symbolic names:\n'
|
key = 'symbolic names:\n'
|
||||||
found = 0
|
found = 0
|
||||||
|
@ -116,10 +120,11 @@ def digest_chunk(chunk, branch=None):
|
||||||
else:
|
else:
|
||||||
found = 0
|
found = 0
|
||||||
rev = revisions.get(branch)
|
rev = revisions.get(branch)
|
||||||
|
branch = re.compile(r"^<>$") # <> to force a mismatch by default
|
||||||
if rev:
|
if rev:
|
||||||
if rev.find('.0.') >= 0:
|
if rev.find('.0.') >= 0:
|
||||||
rev = rev.replace('.0.', '.') + '.'
|
rev = rev.replace('.0.', '.')
|
||||||
branch = rev or "<>" # <> to force a mismatch
|
branch = re.compile(r"^" + re.escape(rev) + r"\.\d+$")
|
||||||
records = []
|
records = []
|
||||||
for lines in chunk[1:]:
|
for lines in chunk[1:]:
|
||||||
revline = lines[0]
|
revline = lines[0]
|
||||||
|
@ -144,13 +149,11 @@ def digest_chunk(chunk, branch=None):
|
||||||
if len(words) >= 2 and words[0] == 'revision':
|
if len(words) >= 2 and words[0] == 'revision':
|
||||||
rev = words[1]
|
rev = words[1]
|
||||||
else:
|
else:
|
||||||
|
# No 'revision' line -- weird...
|
||||||
rev = None
|
rev = None
|
||||||
text.insert(0, revline)
|
text.insert(0, revline)
|
||||||
if branch:
|
if branch:
|
||||||
if branch == "HEAD":
|
if rev is None or not branch.match(rev):
|
||||||
if rev is not None and rev.count('.') > 1:
|
|
||||||
continue
|
|
||||||
elif rev is None or not rev.startswith(branch):
|
|
||||||
continue
|
continue
|
||||||
records.append((date, working_file, rev, author, text))
|
records.append((date, working_file, rev, author, text))
|
||||||
return records
|
return records
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue