Skip to content
This repository was archived by the owner on Dec 8, 2019. It is now read-only.
This repository was archived by the owner on Dec 8, 2019. It is now read-only.

acai: Add Mercurial adapter #4

@MartinHelmut

Description

@MartinHelmut

It would be nice to support version control systems others than Git. Mercurial seams like a choice for very large repositories that could be a easy start to support: https://www.mercurial-scm.org/

This could be a new file in packages/acai/src/adapter and the interface to implement for an adapter could look like:

module.exports = {
    /**
     * Get commit message messages.
     *
     * @param {string} repoPath The path to the repository
     * @param {string} branchName The target branch name
     * @param {number} [depth=Infinity] How much commits in the past should be considered
     * @returns {Promise<Object>} Returns a promise resolving to an array of commit objects
     */
    async getCommits(repoPath, branchName, depth) {},
    /**
     * Return filtered commit messages
     *
     * @param {Object[]} commits A list of adapted commit messages
     * @param {commitFilterCallback} fn A pattern to match the commit message
     * @returns {Object[]} An array of filtered commit messages
     */
    filterCommits(commits, fn) {},
    /**
     * Get an object representation of the commit message
     *
     * @param {Object} commit The adapted commit message
     * @returns {Promise<Commit>} A promise resolving to the commit descriptor
     */
    async getDescriptor(commit) {}
};

Where commitFilterCallback is:

/**
 * @callback commitFilterCallback The callback to filter commit messages
 * @param {string} commitMessage Git commit message
 * @returns {boolean}
 */

And the final Commit object:

/**
 * @global
 * @namespace Commit
 * @property {string} message A commit message for the matched pattern
 * @property {number} time The time of the commit as unix timestamp
 * @property {string[]} files A list of associated files to that commit
 */

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions