Пример #1
0
        private void Delete()
        {
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");
            ILocalFileSystem localFileSystem = new LocalFileSystem();

            localSyncTable.CollectRepoFiles(localFile =>
                                            _remoteSyncTable.FilterExistingFiles(localFile, missingRemoteFile =>
                                                {
                                                    missingRemoteFile = localFileSystem.EnrichWithRepoRoot(missingRemoteFile);
                                                    _ui.LogBeginOfOperation(missingRemoteFile);
                                                    missingRemoteFile = localSyncTable.DeleteEntry(missingRemoteFile);
                                                    missingRemoteFile = localFileSystem.Delete(missingRemoteFile);
                                                    _ui.LogEndOfOperation(missingRemoteFile);
                                                }));
        }
Пример #2
0
        private RepoFile ResolveConflicts(RepoFile changedRemoteFile)
        {
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            IConflictMediator conflictMediator = new ConflictMediator();

            var fromLocalSyncTable = localSyncTable.GetTimeStamp(changedRemoteFile);
            var fromLocalFileSystem = localFileSystem.GetTimeStamp(changedRemoteFile);
            conflictMediator.DetectUpdateConflct(fromLocalSyncTable, fromLocalFileSystem, changedRemoteFile,
                                                 _ => { }, localFile => {
                                                                            localFileSystem.Rename(localFile);
                                                                            _ui.LogConflict(localFile);
                                                                        });

            return changedRemoteFile;
        }
Пример #3
0
        private void Delete()
        {
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            IUi ui = new Ui();

            localSyncTable.CollectRepoFiles(repoFile =>
                {
                    repoFile = localFileSystem.EnrichWithRepoRoot(repoFile);
                    localFileSystem.FilterExistingFiles(repoFile, r =>
                        {
                            ui.LogBeginOfOperation(repoFile);
                            r = _remoteSyncTable.DeleteEntry(r);
                            r = _remoteFileStore.Delete(r);
                            r = localSyncTable.DeleteEntry(r);
                            ui.LogEndOfOperation(r);
                        });
                });
        }
Пример #4
0
        private void AddOrUpdate()
        {
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");

            _remoteSyncTable.CollectRepoFiles(remoteFile =>
                {
                    remoteFile = localFileSystem.EnrichWithRepoRoot(remoteFile);
                    localSyncTable.FilterUnchangedById(remoteFile, changedRemoteFile =>
                        {
                            changedRemoteFile = ResolveConflicts(changedRemoteFile);
                            _ui.LogBeginOfOperation(changedRemoteFile);
                            var result = _remoteFileStore.Download(changedRemoteFile);
                            changedRemoteFile = localFileSystem.SaveToFile(result.Item1, result.Item2);
                            localSyncTable.AddOrUpdateEntry(changedRemoteFile);
                            _ui.LogEndOfOperation(changedRemoteFile);
                        });
                });
        }
Пример #5
0
        private void AddOrUpdate()
        {
            ILocalFileSystem localFileSystem = new LocalFileSystem();
            IIgnoreFilter ignoreFilter = new IgnoreFilter(".");
            IUi ui = new Ui();
            ILocalSyncTable localSyncTable = new LocalSyncTable(".");

            var repoRoot = localFileSystem.GetRepoRoot();
            localFileSystem.CollectRepoFiles(repoRoot,
                                             repoFile => ignoreFilter.Filter(repoFile, r1 =>
                                                 {
                                                     r1 = localFileSystem.EnrichWithMetadata(r1);
                                                     localSyncTable.FilterUnchangedByTimeStamp(r1, r2 =>
                                                         {
                                                             ui.LogBeginOfOperation(r2);
                                                             var stream = localFileSystem.LoadFromFile(r2);
                                                             r2 = _remoteFileStore.Upload(r2, stream);
                                                             r2 = UpdateRemoteSyncTable(r2);
                                                             localSyncTable.AddOrUpdateEntry(r2);
                                                             ui.LogEndOfOperation(r2);
                                                         });
                                                 }));
        }