Exemple #1
0
        public static void FindPeopleForCommit(DBLane lane, DBRevision revision, List <DBPerson> people)
        {
            if (lane.source_control == "git")
            {
                GITUpdater.FindPeopleForCommit(lane, revision, people);

                /*
                 * } else if (lane.source_control == "svn") {
                 * SVNUpdater.FindPeopleForCommit (lane, revision, people);
                 * */
            }
            else
            {
                Logger.Log("FindPeopleForCommit (): unknown source control: '{0}'", lane.source_control);
            }
        }
Exemple #2
0
        public static void FindPeopleForCommit(DBLane lane, DBRevision revision, List <DBPerson> people)
        {
            if (lane.source_control == "git")
            {
                GITUpdater.FindPeopleForCommit(lane, revision, people);

                /*
                 * } else if (lane.source_control == "svn") {
                 * SVNUpdater.FindPeopleForCommit (lane, revision, people);
                 * */
            }
            else
            {
                log.ErrorFormat("Unknown source control for lane {0}: {1}", lane.lane, lane.source_control);
            }
        }
		public static bool ExecuteScheduler (bool forcefullupdate)
		{
			DateTime start;
			Lock scheduler_lock = null;
			List<DBLane> lanes;

			List<DBHost> hosts;
			List<DBHostLane> hostlanes;
			List<XmlDocument> reports;
			
			try {
				scheduler_lock = Lock.Create ("MonkeyWrench.Scheduler");
				if (scheduler_lock == null) {
					log.Info ("Could not aquire scheduler lock.");
					return false;
				}

				log.Info ("Scheduler lock aquired successfully.");
				
				is_executing = true;
				start = DateTime.Now;

				// SVNUpdater.StartDiffThread ();

				// Check reports
				reports = GetReports (forcefullupdate);

				using (DB db = new DB (true)) {
					lanes = db.GetAllLanes ();
					hosts = db.GetHosts ();
					hostlanes = db.GetAllHostLanes ();

					log.InfoFormat ("Updater will now update {0} lanes.", lanes.Count);

					GITUpdater git_updater = null;
					// SVNUpdater svn_updater = null;

					foreach (DBLane lane in lanes) {
						if (!lane.enabled) {
							log.InfoFormat ("Schedule: lane {0} is disabled, skipping it.", lane.lane);
							continue;
						}

						SchedulerBase updater;
						switch (lane.source_control) {
							/*
						case "svn":
							if (svn_updater == null)
								svn_updater = new SVNUpdater (forcefullupdate);
							updater = svn_updater;
							break;
							 * */
						case "git":
							if (git_updater == null)
								git_updater = new GITUpdater (forcefullupdate);
							updater = git_updater;
							break;
						default:
							log.ErrorFormat ("Unknown source control: {0} for lane {1}", lane.source_control, lane.lane);
							continue;
						}
						updater.Clear ();
						updater.AddChangeSets (reports);
						updater.UpdateRevisionsInDB (db, lane, hosts, hostlanes);
					}

					AddRevisionWork (db);
					AddWork (db, hosts, lanes, hostlanes);
					CheckDependencies (db, hosts, lanes, hostlanes);
				}

				// SVNUpdater.StopDiffThread ();

				log.InfoFormat ("Update finished successfully in {0} seconds.", (DateTime.Now - start).TotalSeconds);

				return true;
			} catch (Exception ex) {
				log.ErrorFormat ("An exception occurred: {0}", ex);
				return false;
			} finally {
				if (scheduler_lock != null)
					scheduler_lock.Unlock ();
				is_executing = false;
			}
		}
Exemple #4
0
		public static bool ExecuteScheduler (bool forcefullupdate)
		{
			Lock scheduler_lock = null;
			List<DBLane> lanes;

			List<DBHost> hosts;
			List<DBHostLane> hostlanes;
			List<XmlDocument> reports;
			
			try {
				scheduler_lock = Lock.Create ("MonkeyWrench.Scheduler");
				if (scheduler_lock == null) {
					Logger.Log ("Could not aquire scheduler lock.");
					return false;
				}

				Logger.Log ("Scheduler lock aquired successfully.");
				
				is_executing = true;

				SVNUpdater.StartDiffThread ();

				// Check reports
				reports = GetReports (forcefullupdate);

				using (DB db = new DB (true)) {
					lanes = db.GetAllLanes ();
					hosts = db.GetHosts ();
					hostlanes = db.GetAllHostLanes ();
					Logger.Log ("Updater will now update {0} lanes.", lanes.Count);
					foreach (DBLane lane in lanes) {
						SchedulerBase updater;
						switch (lane.source_control) {
						case "svn":
							updater = new SVNUpdater (forcefullupdate);
							break;
						case "git":
							updater = new GITUpdater (forcefullupdate);
							break;
						default:
							Logger.Log ("Unknown source control: {0} for lane {1}", lane.source_control, lane.lane);
							continue;
						}
						updater.AddChangeSets (reports);
						updater.UpdateRevisionsInDB (db, lane, hosts, hostlanes);
						UpdateBuildLogDB (db, lane, hosts, hostlanes);
					}
				}

				Logger.Log ("Update done, waiting for diff thread to finish...");

				SVNUpdater.StopDiffThread ();

				Logger.Log ("Update finished successfully.");

				return true;
			} catch (Exception ex) {
				Logger.Log ("An exception occurred: {0}", ex.ToString ());
				return false;
			} finally {
				if (scheduler_lock != null)
					scheduler_lock.Unlock ();
				is_executing = false;
			}
		}
Exemple #5
0
        public static bool ExecuteScheduler(bool forcefullupdate)
        {
            DateTime      start;
            Lock          scheduler_lock = null;
            List <DBLane> lanes;

            List <DBHost>      hosts;
            List <DBHostLane>  hostlanes;
            List <XmlDocument> reports;

            try {
                scheduler_lock = Lock.Create("MonkeyWrench.Scheduler");
                if (scheduler_lock == null)
                {
                    Logger.Log("Could not aquire scheduler lock.");
                    return(false);
                }

                Logger.Log("Scheduler lock aquired successfully.");

                is_executing = true;
                start        = DateTime.Now;

                // SVNUpdater.StartDiffThread ();

                // Check reports
                reports = GetReports(forcefullupdate);

                using (DB db = new DB(true)) {
                    lanes     = db.GetAllLanes();
                    hosts     = db.GetHosts();
                    hostlanes = db.GetAllHostLanes();

                    Logger.Log("Updater will now update {0} lanes.", lanes.Count);

                    GITUpdater git_updater = null;
                    // SVNUpdater svn_updater = null;

                    foreach (DBLane lane in lanes)
                    {
                        if (!lane.enabled)
                        {
                            Logger.Log("Schedule: lane {0} is disabled, skipping it.", lane.lane);
                            continue;
                        }

                        SchedulerBase updater;
                        switch (lane.source_control)
                        {
                        /*
                         * case "svn":
                         * if (svn_updater == null)
                         *      svn_updater = new SVNUpdater (forcefullupdate);
                         * updater = svn_updater;
                         * break;
                         * */
                        case "git":
                            if (git_updater == null)
                            {
                                git_updater = new GITUpdater(forcefullupdate);
                            }
                            updater = git_updater;
                            break;

                        default:
                            Logger.Log("Unknown source control: {0} for lane {1}", lane.source_control, lane.lane);
                            continue;
                        }
                        updater.Clear();
                        updater.AddChangeSets(reports);
                        updater.UpdateRevisionsInDB(db, lane, hosts, hostlanes);
                    }

                    AddRevisionWork(db);
                    AddWork(db, hosts, lanes, hostlanes);
                    CheckDependencies(db, hosts, lanes, hostlanes);
                }

                Logger.Log("Update done, waiting for diff thread to finish...");

                // SVNUpdater.StopDiffThread ();

                Logger.Log("Update finished successfully in {0} seconds.", (DateTime.Now - start).TotalSeconds);

                return(true);
            } catch (Exception ex) {
                Logger.Log("An exception occurred: {0}", ex.ToString());
                return(false);
            } finally {
                if (scheduler_lock != null)
                {
                    scheduler_lock.Unlock();
                }
                is_executing = false;
            }
        }