def collapse_keywords(self, data, keyword_str):
        """
        Collapse SVN keywords in string.

        SVN allows for several keywords (such as $Id$ and $Revision$) to
        be expanded, though these keywords are limited to a fixed set
        (and associated aliases) and must be enabled per-file.

        Keywords can take two forms: $Keyword$ and $Keyword::     $
        The latter allows the field to take a fixed size when expanded.

        When we cat a file on SVN, the keywords come back expanded, which
        isn't good for us as we need to diff against the collapsed version.
        This function makes that transformation.
        """
        def repl(m):
            if m.group(2):
                return b'$%s::%s$' % (m.group(1), b' ' * len(m.group(3)))

            return b'$%s$' % m.group(1)

        # Get any aliased keywords
        keywords = [re.escape(keyword).encode('utf-8')
                    for name in re.split(r'\W+', keyword_str)
                    for keyword in self.keywords.get(name.lower(), [])]

        regex = re.compile('|'.join(keywords) % r"\$(%s):(:?)([^\$\n\r]*)\$",
                           re.IGNORECASE)
        return regex.sub(repl, data)
dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/scmtools/svn/base.py/Client.collapse_keywords/swapped operands of `%`