Skip to content
Snippets Groups Projects
  1. Apr 07, 2017
  2. Jan 10, 2017
    • Remi Chaintron's avatar
      revlog: flag processor · c1b7b2285522
      Remi Chaintron authored
      Add the ability for revlog objects to process revision flags and apply
      registered transforms on read/write operations.
      
      This patch introduces:
      - the 'revlog._processflags()' method that looks at revision flags and applies
        flag processors registered on them. Due to the need to handle non-commutative
        operations, flag transforms are applied in stable order but the order in which
        the transforms are applied is reversed between read and write operations.
      - the 'addflagprocessor()' method allowing to register processors on flags.
        Flag processors are defined as a 3-tuple of (read, write, raw) functions to be
        applied depending on the operation being performed.
      - an update on 'revlog.addrevision()' behavior. The current flagprocessor design
        relies on extensions to wrap around 'addrevision()' to set flags on revision
        data, and on the flagprocessor to perform the actual transformation of its
        contents. In the lfs case, this means we need to process flags before we meet
        the 2GB size check, leading to performing some operations before it happens:
        - if flags are set on the revision data, we assume some extensions might be
          modifying the contents using the flag processor next, and we compute the
          node for the original revision data (still allowing extension to override
          the node by wrapping around 'addrevision()').
        - we then invoke the flag processor to apply registered transforms (in lfs's
          case, drastically reducing the size of large blobs).
        - finally, we proceed with the 2GB size check.
      
      Note: In the case a cachedelta is passed to 'addrevision()' and we detect the
      flag processor modified the revision data, we chose to trust the flag processor
      and drop the cachedelta.
      c1b7b2285522
Loading