Mercurial > hg
comparison mercurial/match.py @ 40781:e115a6452b41
match: use _BASE_SIZE instead of magic value 4
Differential Revision: https://phab.mercurial-scm.org/D5351
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 02 Dec 2018 13:45:20 -0800 |
parents | 1e019f45fa88 |
children | 3984409e144b |
comparison
equal
deleted
inserted
replaced
40780:1e019f45fa88 | 40781:e115a6452b41 |
---|---|
1210 | 1210 |
1211 startidx = 0 | 1211 startidx = 0 |
1212 groupsize = _BASE_SIZE | 1212 groupsize = _BASE_SIZE |
1213 for idx, r in enumerate(regexps): | 1213 for idx, r in enumerate(regexps): |
1214 piecesize = len(r) | 1214 piecesize = len(r) |
1215 if (piecesize + 4) > MAX_RE_SIZE: | 1215 if (piecesize + _BASE_SIZE) > MAX_RE_SIZE: |
1216 msg = _("matcher pattern is too long (%d bytes)") % piecesize | 1216 msg = _("matcher pattern is too long (%d bytes)") % piecesize |
1217 raise error.Abort(msg) | 1217 raise error.Abort(msg) |
1218 elif (groupsize + piecesize) > MAX_RE_SIZE: | 1218 elif (groupsize + piecesize) > MAX_RE_SIZE: |
1219 group = regexps[startidx:idx] | 1219 group = regexps[startidx:idx] |
1220 allgroups.append(_joinregexes(group)) | 1220 allgroups.append(_joinregexes(group)) |