Beispiel #1
0
        public Ticket(Base @base, Hashtable options)
        {
            Debug.Assert(@base != null);
            if (!options.ContainsKey("user_name"))
                options["user_name"] = @base.Git.Config["user.name"];
            if (!options.ContainsKey("user_email"))
                options["user_email"] = @base.Git.Config["user.email"];

            Base = @base;
            Options = options ?? new Hashtable();

            State = "open"; // by default
            Attachments = new List<object>();
            Comments = new List<Comment>();
            Tags = new List<string>();
        }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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));
 }
Beispiel #4
0
 //    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;
 }