* Fix error and add unit testcase.
This commit is contained in:
@@ -217,7 +217,10 @@ class gitlab
|
||||
$count = $count == 0 ? '' : "-n $count";
|
||||
|
||||
$list = $this->getCommitsByPath($path, $fromRevision, $toRevision);
|
||||
foreach($list as $commit) $commit->diffs = $this->getFilesByCommit($commit->id);
|
||||
foreach($list as $commit)
|
||||
{
|
||||
if(isset($commit->id)) $commit->diffs = $this->getFilesByCommit($commit->id);
|
||||
}
|
||||
|
||||
return $this->parseLog($list);
|
||||
}
|
||||
@@ -653,6 +656,7 @@ class gitlab
|
||||
{
|
||||
$results = $this->fetch($api, $params);
|
||||
$params->page ++;
|
||||
if(!is_array($results)) $results = array();
|
||||
$allResults = $allResults + $results;
|
||||
if(count($results) < 100) break;
|
||||
}
|
||||
@@ -748,6 +752,7 @@ class gitlab
|
||||
$i = 0;
|
||||
foreach($logs as $commit)
|
||||
{
|
||||
if(!isset($commit->id)) continue;
|
||||
$parsedLog = new stdclass();
|
||||
$parsedLog->revision = $commit->id;
|
||||
$parsedLog->committer = $commit->committer_name;
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
|
||||
|
||||
/**
|
||||
|
||||
title=测试 gitlabModel::apiCreateBranch();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
通过gitlabID,projectID,分支对象创建GitLab分支 >> test_branch5
|
||||
|
||||
*/
|
||||
|
||||
$gitlab = $tester->loadModel('gitlab');
|
||||
|
||||
$gitlabID = 1;
|
||||
$projectID = 1555;
|
||||
$branch = new stdclass();
|
||||
$branch->branch = 'test_branch5';
|
||||
$branch->ref = 'master';
|
||||
r($gitlab->apiCreateBranch($gitlabID, $projectID, $branch)) && p('name') && e($branch->branch); //通过gitlabID,projectID,分支对象创建GitLab分支
|
||||
Reference in New Issue
Block a user