private static IEnumerable<HistoryEntry> CreateEntriesForFile(ApplicationLogic appLogic, IFileWithHistory file)
 {
     foreach (var version in file.History) {
         yield return new HistoryEntry (appLogic, file, version);
     }
     yield break;
 }
 public ShowVersionOfFileEventArgs(IFileWithHistory file, IFileVersion version)
 {
     if (file == null || version == null) {
         throw new ArgumentNullException ("File and version must not be null");
     }
     File = file;
     Version = version;
 }
 public string CreateTempFileFromVersion(IFileWithHistory file, IFileVersion version)
 {
     var temp = Path.GetTempFileName ();
     var content = file.GetBinaryContentForVersion (version);
     WriteContentToTempFile (content, temp);
     var completeTempFileName = AppendOriginalFileEnding (temp, ReadOriginalFileEnding (file.PathInRepository));
     File.Move (temp, completeTempFileName);
     return completeTempFileName;
 }
        public HistoryDialog(ApplicationLogic logic, IFileWithHistory file)
        {
            this.Build ();
            RegisterEvents ();
            File = file;

            label.Text = file.PathInRepository;

            var entries = CreateEntriesForFile (logic, file).ToList ();

            entries.ForEach (e => e.OnVersionShown += logic.ShowVersionOfFile);

            DisplayEntries (entries);

            ShowAll ();
        }
        public HistoryEntry(ApplicationLogic appLogic, IFileWithHistory file, IFileVersion version)
        {
            Version = version;
            File = file;
            applicationLogic = appLogic;
            this.Build ();

            openButton.Clicked += HandleOpenButtonClicked;

            dateLabel.Text = Version.CreationAt.ToString ();

            commentTextview.Buffer.Text = Version.Commit.Comment;

            BorderWidth = 5;

            Show ();
        }
 public string GetFile(IFileWithHistory file, IFileVersion version)
 {
     if (file == null || version == null) {
         throw new ArgumentNullException ("file and version must not be null");
     }
     string cachedFile;
     var key = new CacheKey (file, version);
     if (Cache.ContainsKey (key)) {
         cachedFile = Cache[key];
     }
     else {
         var tempFile = creator.CreateTempFileFromVersion (file, version);
         Cache[key] = tempFile;
         cachedFile = tempFile;
     }
     return cachedFile;
 }
 public void SetUp()
 {
     myMockery = new Mockery ();
     file1 = myMockery.NewMock <IFileWithHistory> ();
     version1 = myMockery.NewMock<IFileVersion> ();
     provider = myMockery.NewMock<IHistoryProvider> ();
 }
 public void AddFile(IFileWithHistory file)
 {
     Repository.Index.Add (file.PathInRepository);
 }
 private void AddASingleFile(TreeIter iter, IFileWithHistory file)
 {
     treeStore.AppendValues (iter,
         file.GetStockForType (),
         file.Status.GetStockFromFileStatus (),
         System.IO.Path.GetFileName (file.Path),
         file.Path
         );
 }
 public CacheKey(IFileWithHistory file, IFileVersion version)
 {
     File = file;
     Version = version;
 }