Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No need to order revisions when fetching revisions to check when sche…

…duling.
  • Loading branch information...
commit ebd6884d3d913d1f7a9d9dbc369ba7e2ecb7d7fe 1 parent c18ac0b
@rolfbjarne rolfbjarne authored
View
14 MonkeyWrench.Database/DB.cs
@@ -783,28 +783,30 @@ public List<DBCommand> GetCommands (int lane_id)
return result;
}
- public Dictionary<string, DBRevision> GetDBRevisions (int lane_id)
+ public Dictionary<string, DBRevision> GetDBRevisions (int lane_id, bool ordered)
{
Dictionary<string, DBRevision> result = new Dictionary<string, DBRevision> ();
- foreach (DBRevision rev in GetDBRevisions (lane_id, 0)) {
+ foreach (DBRevision rev in GetDBRevisions (lane_id, 0, false)) {
result.Add (rev.revision, rev);
}
return result;
}
- public List<DBRevision> GetDBRevisions (int lane_id, int limit)
+ public List<DBRevision> GetDBRevisions (int lane_id, int limit, bool ordered = true)
{
- return GetDBRevisions (lane_id, limit, 0);
+ return GetDBRevisions (lane_id, limit, 0, ordered);
}
- public List<DBRevision> GetDBRevisions (int lane_id, int limit, int offset)
+ public List<DBRevision> GetDBRevisions (int lane_id, int limit, int offset, bool ordered = true)
{
List<DBRevision> result = new List<DBRevision> ();
using (IDbCommand cmd = CreateCommand ()) {
- cmd.CommandText = "SELECT * FROM Revision WHERE lane_id = @lane_id ORDER BY date DESC";
+ cmd.CommandText = "SELECT * FROM Revision WHERE lane_id = @lane_id";
+ if (ordered)
+ cmd.CommandText += " ORDER BY date DESC";
if (limit > 0)
cmd.CommandText += " LIMIT " + limit.ToString ();
if (offset > 0)
View
2  MonkeyWrench.Database/SchedulerBase.cs
@@ -221,7 +221,7 @@ public bool UpdateRevisionsInDB (DB db, DBLane lane, List<DBHost> hosts, List<DB
}
**/
- revisions = db.GetDBRevisions (lane.id);
+ revisions = db.GetDBRevisions (lane.id, false);
repositories = lane.repository.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries);
min_revisions = splitWithMiniumElements (lane.min_revision, repositories.Length);
Please sign in to comment.
Something went wrong with that request. Please try again.