enhanced SubversionModel::getRevHistory().

enhanced how to retrieve logs in SubversionModel::revisionGraph()
This commit is contained in:
hyung-hwan 2017-01-03 15:35:32 +00:00
parent e47ecf2afd
commit cc588594a7
3 changed files with 32 additions and 19 deletions

View File

@ -659,16 +659,21 @@ class SubversionModel extends Model
function getRevHistory ($projectid, $path, $rev) function getRevHistory ($projectid, $path, $rev)
{ {
//$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"; //$url = 'file:///'.CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}";
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}"); $orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}/{$path}");
$url = $orgurl;
/* Compose a URL with a peg revision if a specific revision is given. However, /* Compose a URL with a peg revision if a specific revision is given. However,
* It skips composition if the path indicates the project root. Read the comment * It skips composition if the path indicates the project root. Read the comment
* in getFile() to know more about this skipping. * in getFile() to know more about this skipping.
*/ */
if ($rev != SVN_REVISION_HEAD && $path != '') $url = $url . '@' . $rev; if ($rev != SVN_REVISION_HEAD && $path != '') $url = $url . '@' . $rev;
$info = @svn_info ($url, FALSE, $rev); $info = @svn_info ($url, FALSE, $rev);
if ($info === FALSE || count($info) != 1)
{
$info = @svn_info ($orgurl, FALSE, $rev);
if ($info === FALSE || count($info) != 1) return FALSE; if ($info === FALSE || count($info) != 1) return FALSE;
$url = $orgurl;
}
$actual_rev = $rev; $actual_rev = $rev;
if ($info[0]['kind'] == SVN_NODE_FILE) if ($info[0]['kind'] == SVN_NODE_FILE)
@ -682,7 +687,6 @@ class SubversionModel extends Model
$fileinfo['fullpath'] = $info[0]['path']; $fileinfo['fullpath'] = $info[0]['path'];
$actual_rev = $fileinfo['created_rev']; $actual_rev = $fileinfo['created_rev'];
} }
else if ($info[0]['kind'] == SVN_NODE_DIR) else if ($info[0]['kind'] == SVN_NODE_DIR)
{ {
@ -1913,19 +1917,21 @@ class SubversionModel extends Model
return -1; return -1;
} }
function revisionGraph ($projectid, $path, $rev) function revisionGraph ($projectid, $path, $rev = SVN_REVISION_HEAD)
{ {
$orgurl = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}"); $h = $this->getHistory ($projectid, $path, $rev);
$log = &$h['history'];
$startpath = $path; if ($h['type'] == 'dir')
{
$url = 'file://'.$this->_canonical_path(CODEPOT_SVNREPO_DIR."/{$projectid}");
$log = @svn_log ($url, 1, $rev, 0, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE || count($log) <= 0) return FALSE;
}
$nodeids = array (); $nodeids = array ();
$nodes = array (); $nodes = array ();
$edges = array (); $edges = array ();
$log = @svn_log ($orgurl, 1, $rev, 0, SVN_DISCOVER_CHANGED_PATHS);
if ($log === FALSE || count($log) <= 0) return FALSE;
//print_r ($log); //print_r ($log);
$trackset = array (); $trackset = array ();
$delset = array(); $delset = array();
@ -2107,6 +2113,7 @@ class SubversionModel extends Model
} }
else else
{ {
if ($fromrev <= -1) $fromrev = $torev;
$mf_cand[$frompath] = array ($fromrev, $topath, $torev, 1); $mf_cand[$frompath] = array ($fromrev, $topath, $torev, 1);
} }
break; break;

View File

@ -416,22 +416,25 @@ var RevGraphApp = (function ()
layout: { layout: {
hierarchical: { hierarchical: {
enabled: true, enabled: true,
//levelSeparation: 150, //levelSeparation: 150,
//nodeSpacing: 200, //nodeSpacing: 200,
//treeSpacing: 300, //treeSpacing: 300,
direction: 'LR', //'LR' 'UD', 'DU', 'RL' direction: 'LR', //'LR' 'UD', 'DU', 'RL'
sortMethod: 'directed' // 'hubsize' sortMethod: 'directed' // 'hubsize'*/
} }
}, },
edges: { edges: {
smooth: { smooth: {
type: 'cubicBezier', //type: 'cubicBezier',
forceDirection: 'horizontal', // 'vertical', //forceDirection: 'horizontal', // 'vertical',
roundness: 0.4 roundness: 0.4
} }
}, },
physics: { physics: {
enabled: true //enabled: true
enabled: false
} }
}; };

View File

@ -272,22 +272,25 @@ var RevGraphApp = (function ()
layout: { layout: {
hierarchical: { hierarchical: {
enabled: true, enabled: true,
//levelSeparation: 150, //levelSeparation: 150,
//nodeSpacing: 200, //nodeSpacing: 200,
//treeSpacing: 300, //treeSpacing: 300,
direction: 'LR', //'LR' 'UD', 'DU', 'RL' direction: 'LR', //'LR' 'UD', 'DU', 'RL'
sortMethod: 'directed' // 'hubsize' sortMethod: 'directed' // 'hubsize'*/
} }
}, },
edges: { edges: {
smooth: { smooth: {
type: 'cubicBezier', //type: 'cubicBezier',
forceDirection: 'horizontal', // 'vertical', //forceDirection: 'horizontal', // 'vertical',
roundness: 0.4 roundness: 0.4
} }
}, },
physics: { physics: {
enabled: true //enabled: true
enabled: false
} }
}; };