Beispiel #1
0
        public void StartExecute()
        {
            // Start the 1st domino!!!
            if (executing == true)
                return;

            JobList targetl = new JobList();

            // TODO: Exclusive control is necessary.
            this.executing = true;

            Job job;
            while (this.jobl.Count > 0)
            {
                while (true)
                {
                    if (this.jobl.Count <= 0)
                        break;

                    job = this.jobl[0];

                    if (job.Action != ActionType.Added
                        && job.Action != ActionType.Changed
                        && job.Action != ActionType.Removed
                        && targetl.Count > 0)
                    {
                        break;
                    }

                    this.jobl.RemoveAt(0);
                    targetl.Add(job);
                }
                this.Execute(targetl);
                targetl.Clear();
            }

            // TODO: Exclusive control is necessary.
            this.executing = false;
        }
Beispiel #2
0
        public JobList GetAllJobs()
        {
            JobList jl = new JobList();

            int i;
            for (i = 0; i < el.Count; i++)
            {
                jl.AddRange(this.el[i].GetJobs());
            }

            return jl;
        }
Beispiel #3
0
 public JobExecuter(string path)
 {
     this.jobl = new JobList();
     this.git = new GitManager();
     this.path = path;
 }
Beispiel #4
0
        private void Execute(JobList jobq)
        {
            List<string> tochange = new List<string>();
            List<string> toadd = new List<string>();
            List<string> toremove = new List<string>();
            GitJobParameters p = new GitJobParameters();

            p.tochange = tochange;
            p.toadd = toadd;
            p.toremove = toremove;
            p.gitpath = this.path;

            Job j;

            if (jobq[0].Action == ActionType.Added
                || jobq[0].Action == ActionType.Changed
                || jobq[0].Action == ActionType.Removed)
            {
                // git add/rm are packed into a series and git commit/push are executed after executing the git add/rm Jobs.
                while(jobq.Count > 0)
                {
                    j = jobq[0];
                    jobq.RemoveAt(0);
                    switch (j.Action)
                    {
                        case ActionType.Changed:
                            p.tochange.Add(j.FullPath);
                            break;
                        case ActionType.Added:
                            p.toadd.Add(j.FullPath);
                            break;
                        case ActionType.Removed:
                            p.toremove.Add(j.FullPath);
                            break;
                    }
                }

                this.git.StartCommitChanges(p);
            }
            else
            {
                // git status/clone/push is executed alone.

                p.tarpath = jobq[0].FullPath;
                this.git.StartGitActions(p, jobq[0].Action);
            }
        }