diff options
author | Guido van Rossum <guido@python.org> | 2003-01-07 16:46:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-01-07 16:46:24 (GMT) |
commit | 8b7b345328ac5b742377a05cf1f23c7005af57c7 (patch) | |
tree | e45ce061ab28a7f419b5ba15e2aedf99b9f79742 /Tools | |
parent | 373c7412f297c375d84c5984f753557b441dd6f4 (diff) | |
download | cpython-8b7b345328ac5b742377a05cf1f23c7005af57c7.zip cpython-8b7b345328ac5b742377a05cf1f23c7005af57c7.tar.gz cpython-8b7b345328ac5b742377a05cf1f23c7005af57c7.tar.bz2 |
Use regular expressions for branch matching, to avoid including
changes on a sub-branch into output for a given branch.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/logmerge.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Tools/scripts/logmerge.py b/Tools/scripts/logmerge.py index 5409a70..f6766d2 100755 --- a/Tools/scripts/logmerge.py +++ b/Tools/scripts/logmerge.py @@ -33,7 +33,7 @@ from their output. """ -import os, sys, getopt +import os, sys, getopt, re sep1 = '='*77 + '\n' # file separator sep2 = '-'*28 + '\n' # revision separator @@ -100,7 +100,11 @@ def digest_chunk(chunk, branch=None): break else: working_file = None - if branch and branch != "HEAD": + if branch is None: + pass + elif branch == "HEAD": + branch = re.compile(r"^\d+\.\d+$") + else: revisions = {} key = 'symbolic names:\n' found = 0 @@ -116,10 +120,11 @@ def digest_chunk(chunk, branch=None): else: 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 = rev or "<>" # <> to force a mismatch + rev = rev.replace('.0.', '.') + branch = re.compile(r"^" + re.escape(rev) + r"\.\d+$") records = [] for lines in chunk[1:]: revline = lines[0] @@ -144,13 +149,11 @@ def digest_chunk(chunk, branch=None): if len(words) >= 2 and words[0] == 'revision': rev = words[1] else: + # No 'revision' line -- weird... 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): + if rev is None or not branch.match(rev): continue records.append((date, working_file, rev, author, text)) return records |