| #!/usr/bin/php |
| <?php |
| /******************************************************************************* |
| * Copyright (c) 2013 Eclipse Foundation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Wayne Beaton (Eclipse Foundation)- initial API and implementation |
| *******************************************************************************/ |
| error_reporting(E_ALL); |
| ini_set("display_errors", true); |
| |
| /** |
| * This script parses the output of the git log command (with the --numstat |
| * option to include file names) and generates the tabular output format |
| * required by Dash. |
| * |
| * Usage: |
| * |
| * git --git-dir=/gitroot/woolsey/iplog/.git/ log --numstat | php git-author.php |
| * |
| * Examples: |
| * echo -e "technology.dash.woolsey\t/gitroot/woolsey/iplog/.git/" | ./git-author.php |
| * wget http://www.eclipse.org/projects/web-api/roots-generator.php?type=git -O - 2> /dev/null | ./git-author.php |
| * wget http://www.eclipse.org/projects/web-api/roots-generator.php?type=git -O - 2> /dev/null | grep eclipse.orion | ./git-author.php |
| * |
| * @author Wayne Beaton |
| */ |
| |
| require_once dirname(__FILE__) . '/../common/git-functions.inc'; |
| require_once dirname(__FILE__) . '/GitLogCapture.class.inc'; |
| require_once dirname(__FILE__) . '/../common/common-functions.inc'; |
| |
| function captureGitLog($project, $path) { |
| //ensureGitLogCacheTableExists(); |
| //ensureGitLogCacheLogTableExists(); |
| |
| $path = escapeshellcmd($path); |
| $gitCommand = "git --git-dir=$path log --branches --numstat --format=fuller --reverse"; |
| logMessage("Git", $gitCommand); |
| $handle = popen($gitCommand, 'r'); |
| parseGitLog($handle, new GitLogCapture($project, $path)); |
| pclose($handle); |
| } |
| |
| while (!feof(STDIN)) { |
| $line = fgets(STDIN); |
| if (!trim($line)) continue; |
| |
| $parts = explode("\t", $line); |
| |
| $project = trim($parts[0]); |
| $path = trim($parts[1]); |
| |
| if (!$path) continue; |
| |
| captureGitLog($project, $path); |
| } |
| |
| ?> |