本文整理汇总了C#中DB.GetDBRevisions方法的典型用法代码示例。如果您正苦于以下问题:C# DB.GetDBRevisions方法的具体用法?C# DB.GetDBRevisions怎么用?C# DB.GetDBRevisions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB.GetDBRevisions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateRevisionsInDB
/// <summary>
/// This method must return true if a revision was added to the database.
/// </summary>
/// <param name="db"></param>
/// <param name="lane"></param>
/// <param name="hosts"></param>
/// <param name="hostlanes"></param>
/// <returns></returns>
public bool UpdateRevisionsInDB (DB db, DBLane lane, List<DBHost> hosts, List<DBHostLane> hostlanes)
{
Dictionary<string, DBRevision> revisions;
bool update_steps = false;
string min_revision = null;
bool skip_lane;
Log ("Updating '{0}', ForceFullUpdate: {1}", lane.lane, ForceFullUpdate);
try {
// Skip lanes which aren't configured/enabled on any host completely.
skip_lane = true;
for (int i = 0; i < hostlanes.Count; i++) {
if (hostlanes [i].lane_id == lane.id && hostlanes [i].enabled) {
skip_lane = false;
break;
}
}
if (skip_lane) {
Log ("Skipping lane {0}, not enabled or configured on any host.", lane.lane);
return false;
}
// check for commit reports
if (!HasCommits (lane, out min_revision)) {
Log ("Skipping lane {0}, no commits.", lane.lane);
return false;
}
revisions = db.GetDBRevisions (lane.id);
foreach (string repository in lane.repository.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries)) {
UpdateRevisionsInDBInternal (db, lane, repository, revisions, hosts, hostlanes, min_revision);
}
Log ("Updating db for lane '{0}'... [Done], update_steps: {1}", lane.lane, update_steps);
} catch (Exception ex) {
Log ("There was an exception while updating db for lane '{0}': {1}", lane.lane, ex.ToString ());
}
return update_steps;
}
示例2: GetRevisions
public GetRevisionsResponse GetRevisions (WebServiceLogin login, int? lane_id, string lane, int limit, int offset)
{
GetRevisionsResponse response = new GetRevisionsResponse ();
using (DB db = new DB ()) {
Authenticate (db, login, response, true);
response.Revisions = db.GetDBRevisions (FindLaneId (db, lane_id, lane), limit, offset);
}
return response;
}
示例3: UpdateRevisionsInDB
/// <summary>
/// This method must return true if a revision was added to the database.
/// </summary>
/// <param name="db"></param>
/// <param name="lane"></param>
/// <param name="hosts"></param>
/// <param name="hostlanes"></param>
/// <returns></returns>
public bool UpdateRevisionsInDB (DB db, DBLane lane, List<DBHost> hosts, List<DBHostLane> hostlanes)
{
Dictionary<string, DBRevision> revisions;
bool update_steps = false;
string [] min_revisions;
string [] max_revisions;
string [] repositories;
bool skip_lane;
log.InfoFormat ("Updating '{0}', ForceFullUpdate: {1}", lane.lane, ForceFullUpdate);
try {
// Skip lanes which aren't configured/enabled on any host completely.
skip_lane = true;
for (int i = 0; i < hostlanes.Count; i++) {
if (hostlanes [i].lane_id == lane.id && hostlanes [i].enabled) {
skip_lane = false;
break;
}
}
if (skip_lane) {
log.InfoFormat ("Skipping lane {0}, not enabled or configured on any host.", lane.lane);
return false;
}
/*
// check for commit reports
if (!HasCommits (lane)) {
Log ("Skipping lane {0}, no commits.", lane.lane);
return false;
}
**/
revisions = db.GetDBRevisions (lane.id, false);
repositories = lane.repository.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries);
min_revisions = splitWithMiniumElements (lane.min_revision, repositories.Length);
max_revisions = splitWithMiniumElements (lane.max_revision, repositories.Length);
for (int i = 0; i < repositories.Length; i++) {
UpdateRevisionsInDBInternal (db, lane, repositories [i], revisions, hosts, hostlanes, min_revisions [i], max_revisions [i]);
}
log.InfoFormat ("Updating db for lane '{0}'... [Done], update_steps: {1}", lane.lane, update_steps);
} catch (Exception ex) {
log.ErrorFormat ("There was an exception while updating db for lane '{0}': {1}", lane.lane, ex);
}
return update_steps;
}