public static void Delete(Base b, Ticket t) { var path = Path.Combine(b.Git.WorkingDirectory, t.TicketName); b.Git.Index.Remove(path); b.Git.Commit("deleted " + t.TicketName, new Author(t.User, t.Email)); DeleteDirectory(new DirectoryInfo(path)); }
public static Ticket Create(Base repo, string title, Hashtable options) { var t = new Ticket(repo, options); t.Title = title; t.TicketName = CreateTicketName(title); t.SaveNew(); return t; }
// public static Ticket Open(base, ticket_name, ticket_hash, options = {}) public static Ticket Open(Base @base, string ticket_name, DirectoryInfo ticket_dir, Hashtable options) { string tid = null; var t = new Ticket(@base, options); t.TicketName = ticket_name; var h = ParseTicketName(ticket_name); if (h == null) return null; t.Title = h["title"] as string; t.Opened = (DateTime)h["time"]; foreach (var f in ticket_dir.GetFiles()) { if (f.Name == "TICKET_ID") tid = File.ReadAllText(f.FullName); else { var data = f.Name.Split('_'); if (data[0] == "ASSIGNED") t.Assigned = data[1]; else if (data[0] == "COMMENT") t.Comments.Add(new Comment(@base, f.FullName)); else if (data[0] == "TAG") t.Tags.Add(data[1]); else if (data[0] == "STATE") t.State = data[1]; } } t.TicketId = tid; return t; }