2017 © Pedro Peláez
 

library vcs

Simple wrapper to log command for git/hg/svn

image

pascalc/vcs

Simple wrapper to log command for git/hg/svn

  • Sunday, May 8, 2016
  • by pascalc
  • Repository
  • 1 Watchers
  • 5 Stars
  • 2,790 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

vcs

PHP library to make it easier to get data from various version control systems used at Mozilla., (*1)

Curretly, its only features are: - Extract commit data from Subversion/Git/Mercurial repositories via the svn|git|hg log command and return that data with the same structure (so data extracted from these logs can be more easily merged/compared). - Run an update command on the repository, (*2)

Installable via Composer:

{
    "require": {
        "pascalc/vcs" : "dev-master"
    }
}

Example of use:

<?php
// Import classes in the current namespace
use VCS\Mercurial;
use VCS\Git;
use VCS\Subversion;

// Composer autoloading
require_once __DIR__ . '/vendor/autoload.php';

// Create objects for each repository we want to analyse
$hg  = new Mercurial('/path/to/hg/repo');
$git = new Git('/path/to/git/repo');
$svn = new Subversion('/path/to/svn/repo');

// Update local repos from remote server
$hg->update();
$git->update();
$svn->update();

// Dump all the commits extracted
var_dump($hg->getCommits());
var_dump($git->getCommits());
var_dump($svn->getCommits());

Data is returned as a structured array:

[
    0 => [
        ['commit']  => (string) '116254',
        ['author']  => (string) 'Joe Bar',
        ['email']   => (string) 'joe@bar.com',
        ['date']    => (object) DateTime(),
        ['summary'] => (string) 'Commit summary field'
        ['vcs']     => (string) 'hg'
    ],
]

The commit field contains a subversion revision number (116254), a short mercurial changeset reference (1645:0be17cfdfdb1), or a full git sha1 (dbf6cf2cdc9bf0ddc65e0b9b5fc330a90db6fc40)., (*3)

The author field contains the name of the committer. For Subversion, it is the same value as email as Subversion doesn't have an Author field., (*4)

The email field is the email used to commit, if the email was not in the log (push by a tool for example), this email is empty., (*5)

The date is the commit date as a DateTime object with the same formatting for all repositories., (*6)

The summary is the first line of the commit message., (*7)

The vcs is the type of Version Control System the commit was done on. The possible values are svn, hg and git., (*8)

Note that Subversion being a centralized VCS, it doesn't keep any local history and needs an active internet connection to get the log from the remote server. For that reason it is a good idea to cache that data in case a connection cannot be established and to avoid overloading the remote subversion server., (*9)

The Versions

08/05 2016

dev-master

9999999-dev http://www.github.com/pascalchevrel/vcs

Simple wrapper to log command for git/hg/svn

  Sources   Download

MPL 2

The Requires

  • php >=5.4.0

 

git svn mercurial hg

06/10 2015

0.5

0.5.0.0 http://www.github.com/pascalchevrel/vcs

Simple wrapper to log command for git/hg/svn

  Sources   Download

MPL 2

The Requires

  • php >=5.4.0

 

git svn mercurial hg

24/07 2014

0.4

0.4.0.0 http://www.github.com/pascalchevrel/vcs

Simple wrapper to log command for git/hg/svn

  Sources   Download

MPL 2

The Requires

  • php >=5.4.0

 

git svn mercurial hg

22/07 2014

0.3

0.3.0.0 http://www.github.com/pascalchevrel/vcs

Simple wrapper to log command for git/hg/svn

  Sources   Download

MPL 2

The Requires

  • php >=5.4.0

 

git svn mercurial hg

16/07 2014

0.2

0.2.0.0 http://www.github.com/pascalchevrel/vcs

Simple wrapper to log command for git/hg/svn

  Sources   Download

MPL 2

The Requires

  • php >=5.4.0

 

git svn mercurial hg

07/07 2014

0.1

0.1.0.0 http://www.github.com/pascalchevrel/vcs

Simple wrapper to log command for git/hg/svn

  Sources   Download

MPL 2

The Requires

  • php >=5.4.0

 

git svn mercurial hg