tests/flagprocessorext.py
changeset 42730 92ac6b1697a7
parent 41413 fad627d2047c
child 42732 6d61be152c55
equal deleted inserted replaced
42729:05c80f9ef100 42730:92ac6b1697a7
     9     changegroup,
     9     changegroup,
    10     exchange,
    10     exchange,
    11     extensions,
    11     extensions,
    12     revlog,
    12     revlog,
    13     util,
    13     util,
       
    14 )
       
    15 from mercurial.revlogutils import (
       
    16     flagutil,
    14 )
    17 )
    15 
    18 
    16 # Test only: These flags are defined here only in the context of testing the
    19 # Test only: These flags are defined here only in the context of testing the
    17 # behavior of the flag processor. The canonical way to add flags is to get in
    20 # behavior of the flag processor. The canonical way to add flags is to get in
    18 # touch with the community and make them known in revlog.
    21 # touch with the community and make them known in revlog.
    56 
    59 
    57 def makewrappedfile(obj):
    60 def makewrappedfile(obj):
    58     class wrappedfile(obj.__class__):
    61     class wrappedfile(obj.__class__):
    59         def addrevision(self, text, transaction, link, p1, p2,
    62         def addrevision(self, text, transaction, link, p1, p2,
    60                         cachedelta=None, node=None,
    63                         cachedelta=None, node=None,
    61                         flags=revlog.REVIDX_DEFAULT_FLAGS):
    64                         flags=flagutil.REVIDX_DEFAULT_FLAGS):
    62             if b'[NOOP]' in text:
    65             if b'[NOOP]' in text:
    63                 flags |= REVIDX_NOOP
    66                 flags |= REVIDX_NOOP
    64 
    67 
    65             if b'[BASE64]' in text:
    68             if b'[BASE64]' in text:
    66                 flags |= REVIDX_BASE64
    69                 flags |= REVIDX_BASE64
   100                  'allsupportedversions',
   103                  'allsupportedversions',
   101                  allsupportedversions)
   104                  allsupportedversions)
   102 
   105 
   103     # Teach revlog about our test flags
   106     # Teach revlog about our test flags
   104     flags = [REVIDX_NOOP, REVIDX_BASE64, REVIDX_GZIP, REVIDX_FAIL]
   107     flags = [REVIDX_NOOP, REVIDX_BASE64, REVIDX_GZIP, REVIDX_FAIL]
   105     revlog.REVIDX_KNOWN_FLAGS |= util.bitsfrom(flags)
   108     flagutil.REVIDX_KNOWN_FLAGS |= util.bitsfrom(flags)
   106     revlog.REVIDX_FLAGS_ORDER.extend(flags)
   109     revlog.REVIDX_FLAGS_ORDER.extend(flags)
   107 
   110 
   108     # Teach exchange to use changegroup 3
   111     # Teach exchange to use changegroup 3
   109     for k in exchange._bundlespeccontentopts.keys():
   112     for k in exchange._bundlespeccontentopts.keys():
   110         exchange._bundlespeccontentopts[k][b"cg.version"] = b"03"
   113         exchange._bundlespeccontentopts[k][b"cg.version"] = b"03"