tests/common-pattern.py
changeset 35449 24528dba0e64
parent 35446 991e4404e910
child 35792 1d118f9f4f57
equal deleted inserted replaced
35448:8251c4c4abdc 35449:24528dba0e64
     1 # common patterns in test at can safely be replaced
     1 # common patterns in test at can safely be replaced
     2 from __future__ import absolute_import
     2 from __future__ import absolute_import
       
     3 
       
     4 import os
     3 
     5 
     4 substitutions = [
     6 substitutions = [
     5     # list of possible compressions
     7     # list of possible compressions
     6     (br'(zstd,)?zlib,none,bzip2',
     8     (br'(zstd,)?zlib,none,bzip2',
     7      br'$USUAL_COMPRESSIONS$'
     9      br'$USUAL_COMPRESSIONS$'
    81     ),
    83     ),
    82 }
    84 }
    83 
    85 
    84 for replace, msgs in _errors.items():
    86 for replace, msgs in _errors.items():
    85     substitutions.extend((m, replace) for m in msgs)
    87     substitutions.extend((m, replace) for m in msgs)
       
    88 
       
    89 # Output lines on Windows that can be autocorrected for '\' vs '/' path
       
    90 # differences.
       
    91 _winpathfixes = [
       
    92     # cloning subrepo s\ss from $TESTTMP/t/s/ss
       
    93     # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar
       
    94     br'(?m)^cloning subrepo \S+\\.*',
       
    95 
       
    96     # pulling from $TESTTMP\issue1852a
       
    97     br'(?m)^pulling from \$TESTTMP\\.*',
       
    98 
       
    99     # pushing to $TESTTMP\a
       
   100     br'(?m)^pushing to \$TESTTMP\\.*',
       
   101 
       
   102     # pushing subrepo s\ss to $TESTTMP/t/s/ss
       
   103     br'(?m)^pushing subrepo \S+\\\S+ to.*',
       
   104 
       
   105     # moving d1\d11\a1 to d3/d11/a1
       
   106     br'(?m)^moving \S+\\.*',
       
   107 
       
   108     # d1\a: not recording move - dummy does not exist
       
   109     br'\S+\\\S+: not recording move .+',
       
   110 
       
   111     # reverting s\a
       
   112     br'(?m)^reverting (?!subrepo ).*\\.*',
       
   113 
       
   114     # saved backup bundle to
       
   115     #     $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg
       
   116     br'(?m)^saved backup bundle to \$TESTTMP.*\.hg',
       
   117 
       
   118     # no changes made to subrepo s\ss since last push to ../tcc/s/ss
       
   119     br'(?m)^no changes made to subrepo \S+\\\S+ since.*',
       
   120 
       
   121     # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing
       
   122     #     $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38
       
   123     br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*',
       
   124 
       
   125     # stuff/maybelarge.dat: largefile 76..38 not available from
       
   126     #     file:/*/$TESTTMP\largefiles-repo (glob)
       
   127     br'.*: largefile \S+ not available from file:/\*/.+',
       
   128 ]
       
   129 
       
   130 if os.name == 'nt':
       
   131     substitutions.extend([(s, lambda match: match.group().replace(b'\\', b'/'))
       
   132                           for s in _winpathfixes])