示例#1
0
        void Remove(List <Shelf> stashes, Shelf s)
        {
            int i = stashes.FindIndex(st => st.CommitId == s.CommitId);

            if (i != -1)
            {
                stashes.RemoveAt(i);
                Shelf next = stashes.FirstOrDefault(ns => ns.PrevShelfCommitId == s.CommitId);
                if (next != null)
                {
                    next.PrevShelfCommitId = s.PrevShelfCommitId;
                }
                if (stashes.Count == 0)
                {
                    // No more stashes. The ref and log files can be deleted.
                    ShelfRefFile.Delete();
                    ShelfLogFile.Delete();
                    return;
                }
                WriteShelfes(stashes);
                if (i == stashes.Count)
                {
                    // We deleted the head. Write the new head.
                    File.WriteAllText(ShelfRefFile.FullName, stashes.Last().CommitId + "\n");
                }
            }
        }
示例#2
0
 public void Clear()
 {
     if (ShelfRefFile.Exists)
     {
         ShelfRefFile.Delete();
     }
     if (ShelfLogFile.Exists)
     {
         ShelfLogFile.Delete();
     }
 }