Mercurial > cpython-lru_cache-weakref
diff Tools/scripts/logmerge.py @ 27133:49bcfecb2962 legacy-trunk
Use regular expressions for branch matching, to avoid including
changes on a sub-branch into output for a given branch.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 07 Jan 2003 16:46:24 +0000 |
| parents | 21444bdcb09c |
| children | 42de50e192df |
line wrap: on
line diff
--- a/Tools/scripts/logmerge.py Tue Jan 07 13:41:37 2003 +0000 +++ b/Tools/scripts/logmerge.py Tue Jan 07 16:46:24 2003 +0000 @@ -33,7 +33,7 @@ """ -import os, sys, getopt +import os, sys, getopt, re sep1 = '='*77 + '\n' # file separator sep2 = '-'*28 + '\n' # revision separator @@ -100,7 +100,11 @@ 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 @@ 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 @@ 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
