* adjust for get svnDir.
This commit is contained in:
@@ -104,13 +104,14 @@ class Subversion
|
||||
}
|
||||
|
||||
ksort($dirs);
|
||||
$tags = array();
|
||||
$tags = array();
|
||||
$prefix = empty(trim($path, '/')) ? '/' : '/' . trim($path, '/') . '/';
|
||||
foreach($dirs as $dirNames)
|
||||
{
|
||||
ksort($dirNames);
|
||||
foreach($dirNames as $dirName)
|
||||
{
|
||||
$dirPath = $path . '/' . $dirName;
|
||||
$dirPath = $prefix . $dirName;
|
||||
$tags[$dirPath] = $dirName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$config->jenkins->create = new stdclass();
|
||||
$config->jenkins->edit = new stdclass();
|
||||
$config->jenkins->create->requiredFields = 'name,url,credentials';
|
||||
$config->jenkins->edit->requiredFields = 'name,url,credentials';
|
||||
$config->jenkins->create->requiredFields = 'name,url';
|
||||
$config->jenkins->edit->requiredFields = 'name,url';
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
.checkbox-primary.checkbox-inline label{padding-left:5px !important;}
|
||||
#jkHost_chosen .chosen-single{border-right:0px;}
|
||||
#jkJobBox{width:385px;}
|
||||
#svnDirBox .input-group .chosen-single{min-width:200px;}
|
||||
#svnDirBox .input-group{width:unset !important}
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
.checkbox-primary.checkbox-inline label{padding-left:5px !important;}
|
||||
#jkHost_chosen .chosen-single{border-right:0px;}
|
||||
#jkJobBox{width:385px;}
|
||||
#svnDirBox .input-group .chosen-single{min-width:200px;}
|
||||
#svnDirBox .input-group{width:unset !important}
|
||||
|
||||
@@ -29,7 +29,7 @@ $('#repo').change(function()
|
||||
}
|
||||
})
|
||||
|
||||
$(document).on('change', '#svnDir', function()
|
||||
$(document).on('change', '[name^=svnDir]', function()
|
||||
{
|
||||
var repoID = $('#repo').val();
|
||||
var selectedTag = $(this).val();
|
||||
@@ -61,6 +61,7 @@ $(document).on('change', '#svnDir', function()
|
||||
$('#svnDirBox .loading').remove();
|
||||
$('#svnDirBox .input-group').append(html);
|
||||
$('#svnDirBox #svnDir' + length).chosen();
|
||||
$('#svnDir' + length + '_chosen .chosen-single').css('border-left', '0px');
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ $('#repo').change(function()
|
||||
}
|
||||
})
|
||||
|
||||
$(document).on('change', '#svnDir', function()
|
||||
$(document).on('change', '[name^=svnDir]', function()
|
||||
{
|
||||
var repoID = $('#repo').val();
|
||||
var selectedTag = $(this).val();
|
||||
@@ -61,6 +61,7 @@ $(document).on('change', '#svnDir', function()
|
||||
$('#svnDirBox .loading').remove();
|
||||
$('#svnDirBox .input-group').append(html);
|
||||
$('#svnDirBox #svnDir' + length).chosen();
|
||||
$('#svnDirBox #svnDir' + length + '_chosen .chosen-single').css('border-left', '0px');
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</tr>
|
||||
<tr id='svnDirBox' class='svn-fields'>
|
||||
<th><?php echo $lang->job->svnDir;?></th>
|
||||
<td colspan='2'>
|
||||
<td colspan='3'>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('svnDir[]', array('' => ''), '', "class='form-control chosen'");?>
|
||||
</div>
|
||||
|
||||
@@ -44,12 +44,11 @@
|
||||
</tr>
|
||||
<tr id='svnDirBox' class='svn-fields'>
|
||||
<th><?php echo $lang->job->svnDir;?></th>
|
||||
<td colspan='2'>
|
||||
<td colspan='3'>
|
||||
<div class='input-group'>
|
||||
<?php
|
||||
if($repoType == 'Subversion' and $job->svnDir)
|
||||
{
|
||||
$job->svnDir = '/zentaoext';
|
||||
$path = '';
|
||||
$svnDirs = empty(trim($job->svnDir, '/')) ? '' : $job->svnDir;
|
||||
$svnDirs = explode('/', $svnDirs);
|
||||
|
||||
+3
-34
@@ -270,40 +270,9 @@ class svnModel extends model
|
||||
*/
|
||||
public function getRepoTags($repo, $path)
|
||||
{
|
||||
$parent = '/';
|
||||
if($repo->prefix) $parent = rtrim($repo->prefix, '/');
|
||||
if(trim($path, '/')) $parent = rtrim($repo->prefix, '/') . '/' . trim($path, '/');
|
||||
$stmt = $this->dao->select('t1.*,t2.revision as svnRevision,t2.time')->from(TABLE_REPOFILES)->alias('t1')
|
||||
->leftJoin(TABLE_REPOHISTORY)->alias('t2')->on('t1.revision = t2.id')
|
||||
->where('t1.repo')->eq($repo->id)
|
||||
->andWhere('t1.type')->eq('dir')
|
||||
->andWhere('t1.parent')->eq($parent)
|
||||
->orderBy('path,svnRevision,time')
|
||||
->query();
|
||||
|
||||
$dirs = array();
|
||||
while($row = $stmt->fetch())
|
||||
{
|
||||
$path = $row->path;
|
||||
if($repo->prefix) $path = str_replace($repo->prefix, '', $path);
|
||||
if(empty($path)) $path = '/';
|
||||
|
||||
$dirs[$path] = $row;
|
||||
if($row->action == 'D') unset($dirs[$path]);
|
||||
}
|
||||
|
||||
$dirTime = array();
|
||||
foreach($dirs as $dirPath => $dir) $dirTime[$dir->time][$dirPath] = $dirPath;
|
||||
|
||||
ksort($dirTime);
|
||||
$dirPairs = array();
|
||||
foreach($dirTime as $time => $dirPaths)
|
||||
{
|
||||
ksort($dirPaths);
|
||||
foreach($dirPaths as $dirPath) $dirPairs[$dirPath] = basename($dirPath);
|
||||
}
|
||||
|
||||
return $dirPairs;
|
||||
$scm = $this->app->loadClass('scm');
|
||||
$scm->setEngine($repo);
|
||||
return $scm->tags($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user