vcstools/vcstools — pull request #21 by jbohren (2012-10-27 06:47:08+00:00)
Title: Feature to get VCS Logs

I've added a function to git, svn, hg, and bzr to retrieve the VCS logs.

It can give the log for a given path and the user can optionally limit the number of entries returned. It returns the information as an array of dicts with the fields as described below in the function prototype.

I've also added some tests for each VCS, though there could arguably be more coverage.

```python
def get_log(self, relpath='', basepath=None, limit=None):
"""
Calls scm log command.

This returns a list of dictionaries with the following fields:
- id: the commit SHA or revision number
- date: the date the commit was made (python datetime)
- username: the name of the author of the commit, if available
- email: the e-mail address of the author of the commit, if available
- message: the commit message, if any

:param relpath: (optional) Log target relative to the repository root
path. If None (default), this is the root of the repository.
:param basepath: (optional) path from which the log should be read. If
None (default), this is the root path of the repository.
:param limit: (optional) the maximum number of log entries that should
be retrieved. If None (default), there is no limit.
"""
raise NotImplementedError("Base class get_log method must be overridden")
```