nCoda Lychee Docs

Version Control Data

“Converts” VCS data into an easier format for clients.

Warning

This module is intended for internal Lychee use only, so the API may change without notice. If you wish to use this module outside Lychee, please contact us to discuss the best way.

Tip

We recommend that you use the converters indirectly. Refer to How to Use the Converters for more information.

Note

This is an outbound converter that does not emit signals directly. Refer to the lychee.signals.outbound module for more information.

Here is a sample of the data outputted from this module.

{
    # "history" is the order of changelogs leading to the current tip
    'history': ['529003fcbb3d8394f324bbd6ccb5586101864cbb', '41962ee9069382d1fbbba5251ee0b5de99b18df6'],
    # "users" is a dict where keys are the users responsible for a changelog leading to the current
    #    tip, and values are a list of their changesets
    'users': {
        'Fortitude Johnson <strong_john@example.com>': ['529003fcbb3d8394f324bbd6ccb5586101864cbb'],
        'Danceathon Smith <danceathon@example.com>': ['41962ee9069382d1fbbba5251ee0b5de99b18df6'],
    },
    # "changesets" is a dict of dicts with information about changesets
    'changesets': {
        '529003fcbb3d8394f324bbd6ccb5586101864cbb': {
            'hash': '529003fcbb3d8394f324bbd6ccb5586101864cbb',
            'user': 'Fortitude Johnson <strong_john@example.com>',
            # "date" as a Unix timestamp in UTC...
            # ... multiply by 1000 for JavaScript's Date.setTime()
            'date': 1424721600.0,
            # list of "score" and/or @xml:id of affected <section> elements
            'files': ['score'],
            'description': 'Add "section_B.mei" to all_files and score',
            'number': '0',
        },
        '41962ee9069382d1fbbba5251ee0b5de99b18df6': {
            'hash': '41962ee9069382d1fbbba5251ee0b5de99b18df6',
            'user': 'Danceathon Smith <danceathon@example.com>',
            'date': 1424894400.0,
            'files': ['270842928'],
            'description': 'Add section C1',
            'number': '1',
        },
    }
}
lychee.converters.outbound.vcs.convert(repo_dir, **kwargs)[source]

Prepare VCS data in a useful format for clients.

Parameters:repo_dir (str) – The absolute pathname to the repository for which to produce data.
Raises:lychee.exceptions.OutboundConversionError when there is a forseeable error.
lychee.converters.outbound.vcs.convert_helper(repo_dir)[source]

Dummy replacement for convert_helper while VCS is disabled.

lychee.converters.outbound.vcs.convert_helper_disabled(repo_dir)[source]

Do the actual work for convert(). This helper function exists so that the document_outbound converter can call this converter without having to emit the CONVERSION_FINISH signal.

Parameters:repo_dir (str) – Absolute pathname to the Mercurial repository’s directory.
Returns:Information from the Version Control System in the format described above.
Return type:dict

Note

If the repository fails to initialize for any reason, this function returns an empty dictionary rather than raising an exception.

lychee.converters.outbound.vcs.prep_files(files)[source]

Given the list of files modified, prepare the output for Julius.

This removes the “.mei” extension for everything except “all_files.mei,” which is not returned.