/// <summary>
        /// <inheritdoc cref="ISourceControlProvider.ExportFileHistory"/>
        /// </summary>
        public List <FileRevision> ExportFileHistory(string localFile)
        {
            var result = new List <FileRevision>();

            var log = _gitCli.Log(localFile);

            var historyOfSingleFile = ParseLogString(log);

            foreach (var cs in historyOfSingleFile.ChangeSets)
            {
                var changeItem = cs.Items.First();

                var fi         = new FileInfo(localFile);
                var exportFile = GetPathToExportedFile(fi, cs.Id);

                if (!changeItem.IsDelete())
                {
                    // Download if not already in cache
                    if (!File.Exists(exportFile))
                    {
                        // If item is deleted we won't find it in this changeset.
                        _gitCli.ExportFileRevision(changeItem.ServerPath, cs.Id, exportFile);
                    }

                    var revision = new FileRevision(changeItem.LocalPath, cs.Id, cs.Date, exportFile);
                    result.Add(revision);
                }
            }

            return(result);
        }
Exemple #2
0
        public List <FileRevision> ExportFileHistory(string localFile)
        {
            var result = new List <FileRevision>();

            var xml = _gitCli.Log(localFile);

            var historyOfSingleFile = ParseLogString(xml);

            foreach (var cs in historyOfSingleFile.ChangeSets)
            {
                var changeItem = cs.Items.First();

                var fi         = new FileInfo(localFile);
                var exportFile = GetPathToExportedFile(fi, cs.Id);

                // Download if not already in cache
                if (!File.Exists(exportFile))
                {
                    _gitCli.ExportFileRevision(changeItem.ServerPath, cs.Id, exportFile);
                }

                var revision = new FileRevision(changeItem.LocalPath, cs.Id, cs.Date, exportFile);
                result.Add(revision);
            }

            return(result);
        }