AddFile() private method

private AddFile ( string filename, string comment ) : string
filename string
comment string
return string
Beispiel #1
0
        // write this ticket to the git database
        public void SaveNew()
        {
            var dir = Base.CreateDirectory(TicketName);

            Base.AddFile(dir, "TICKET_ID", TicketName);
            Base.AddFile(dir, "ASSIGNED_" + CleanString(Assigned), Assigned);
            Debug.Assert(!string.IsNullOrEmpty(State));
            Base.AddFile(dir, "STATE_" + State, State);
            foreach (var comment in Comments)
            {
                Base.AddFile(dir, CommentName(Email), comment.Text as string);
            }
            var tags = Tags.Select(t => t.Trim()).ToArray();

            if (tags != null && tags.Length > 0)
            {
                foreach (var tag in tags)
                {
                    if (tag.Length == 0)
                    {
                        continue;
                    }
                    var tag_filename = "TAG_" + Ticket.CleanString(tag);
                    Base.AddFileIfNotExists(Path.Combine(TicketName, tag_filename), tag_filename);
                }
            }
            Base.Git.Commit("added ticket " + TicketName, new Author(User, Email));
        }
Beispiel #2
0
        private void AddTagNoCommit(string tag)
        {
            if (string.IsNullOrEmpty(tag))
            {
                return;
            }
            var tag_filename = Path.Combine(TicketName, "TAG_" + tag);

            Base.AddFile(tag_filename, tag);
        }
Beispiel #3
0
        public void AddComment(string comment)
        {
            if (string.IsNullOrEmpty(comment))
            {
                return;
            }
            var comment_filename = Base.AddFile(Path.Combine(TicketName, CommentName(Email)), comment);

            Base.Git.Commit("added comment to ticket " + TicketName, new Author(User, Email));
            Comments.Add(new Comment(Base, comment_filename));
        }
Beispiel #4
0
 public void ChangeAssigned(string new_assigned)
 {
     new_assigned = CleanString(new_assigned ?? "");
     if (new_assigned == Assigned)
     {
         return;
     }
     Base.AddFile(Path.Combine(TicketName, "ASSIGNED_" + new_assigned), new_assigned);
     Base.RemoveFile(Path.Combine(TicketName, "ASSIGNED_" + Assigned));
     Base.Git.Commit("assigned " + new_assigned + " to ticket " + TicketName, new Author(User, Email));
     Assigned = new_assigned;
 }
Beispiel #5
0
 public void ChangeState(string new_state)
 {
     if (string.IsNullOrEmpty(new_state))
     {
         return;
     }
     if (new_state == State)
     {
         return;
     }
     Base.AddFile(Path.Combine(TicketName, "STATE_" + new_state), new_state);
     Base.RemoveFile(Path.Combine(TicketName, "STATE_" + State));
     Base.Git.Commit("added state (" + new_state + ") to ticket " + TicketName, new Author(User, Email));
     State = new_state;
 }