comparison prompt.py @ 165:03886f17beef

Fix warnings about bad regex escaping in prompt
author IBBoard <dev@ibboard.co.uk>
date Fri, 30 Aug 2024 16:12:04 +0100
parents 8bf9fc90ce51
children
comparison
equal deleted inserted replaced
164:d6bf7ed9024c 165:03886f17beef
402 tag_end = rb'(\}[^{}]*?)?\}' 402 tag_end = rb'(\}[^{}]*?)?\}'
403 brackets = b'{}' 403 brackets = b'{}'
404 404
405 patterns = { 405 patterns = {
406 b'bookmark': _bookmark, 406 b'bookmark': _bookmark,
407 b'branch(\|quiet)?': _branch, 407 rb'branch(\|quiet)?': _branch,
408 b'closed(\|quiet)?': _closed, 408 rb'closed(\|quiet)?': _closed,
409 b'count(\|[^%b]*?)?' % brackets[-1:]: _count, 409 rb'count(\|[^%b]*?)?' % brackets[-1:]: _count,
410 b'node(?:' 410 b'node(?:'
411 b'(\|short)' 411 rb'(\|short)'
412 b'|(\|merge)' 412 rb'|(\|merge)'
413 b')*': _node, 413 b')*': _node,
414 b'patch(?:' 414 b'patch(?:'
415 b'(\|topindex)' 415 rb'(\|topindex)'
416 b'|(\|applied)' 416 rb'|(\|applied)'
417 b'|(\|unapplied)' 417 rb'|(\|unapplied)'
418 b'|(\|count)' 418 rb'|(\|count)'
419 b'|(\|quiet)' 419 rb'|(\|quiet)'
420 b')*': _patch, 420 b')*': _patch,
421 b'patches(?:' + 421 b'patches(?:' +
422 b'(\|join\([^%b]*?\))' % brackets[-1:] + 422 rb'(\|join\([^%b]*?\))' % brackets[-1:] +
423 b'|(\|reverse)' + 423 rb'|(\|reverse)' +
424 b'|(\|hide_applied)' + 424 rb'|(\|hide_applied)' +
425 b'|(\|hide_unapplied)' + 425 rb'|(\|hide_unapplied)' +
426 b'|(\|pre_applied\([^%b]*?\))' % brackets[-1:] + 426 rb'|(\|pre_applied\([^%b]*?\))' % brackets[-1:] +
427 b'|(\|post_applied\([^%b]*?\))' % brackets[-1:] + 427 rb'|(\|post_applied\([^%b]*?\))' % brackets[-1:] +
428 b'|(\|pre_unapplied\([^%b]*?\))' % brackets[-1:] + 428 rb'|(\|pre_unapplied\([^%b]*?\))' % brackets[-1:] +
429 b'|(\|post_unapplied\([^%b]*?\))' % brackets[-1:] + 429 rb'|(\|post_unapplied\([^%b]*?\))' % brackets[-1:] +
430 b')*': _patches, 430 b')*': _patches,
431 b'queue': _queue, 431 b'queue': _queue,
432 b'rev(\|merge)?': _rev, 432 rb'rev(\|merge)?': _rev,
433 b'root': _root, 433 b'root': _root,
434 b'root\|basename': _basename, 434 rb'root\|basename': _basename,
435 b'status(?:' 435 b'status(?:'
436 b'(\|modified)' 436 rb'(\|modified)'
437 b'|(\|unknown)' 437 rb'|(\|unknown)'
438 b')*': _status, 438 b')*': _status,
439 b'tags(?:' + 439 b'tags(?:' +
440 b'(\|quiet)' + 440 rb'(\|quiet)' +
441 b'|(\|[^%b]*?)' % brackets[-1:] + 441 rb'|(\|[^%b]*?)' % brackets[-1:] +
442 b')*': _tags, 442 b')*': _tags,
443 b'task': _task, 443 b'task': _task,
444 b'tip(?:' 444 b'tip(?:'
445 b'(\|node)' 445 rb'(\|node)'
446 b'|(\|short)' 446 rb'|(\|short)'
447 b')*': _tip, 447 b')*': _tip,
448 b'update': _update, 448 b'update': _update,
449 449
450 b'incoming(\|count)?': _remote(b'incoming'), 450 rb'incoming(\|count)?': _remote(b'incoming'),
451 b'outgoing(\|count)?': _remote(b'outgoing'), 451 rb'outgoing(\|count)?': _remote(b'outgoing'),
452 b'inout': _inout, 452 b'inout': _inout,
453 } 453 }
454 454
455 if opts.get("cache_incoming"): 455 if opts.get("cache_incoming"):
456 _cache_remote(repo, b'incoming') 456 _cache_remote(repo, b'incoming')