Пример #1
0
 public SyncData(FileData fD, SyncConflictState sCS, SyncDirection sP, SyncActionState sAS)
 {
     FD  = fD;
     SCS = sCS;
     SD  = sP;
     SAS = sAS;
 }
Пример #2
0
 public static void IsInState(SyncActionState expectedState, params SyncAction[] actions)
 {
     foreach (var action in actions)
     {
         Assert.Equal(expectedState, action.State);
     }
 }
Пример #3
0
        public IEnumerable<SyncAction> this[SyncActionState state, string filePath]
        {
            get
            {
                PathValidator.EnsureIsValidFilePath(filePath);
                PathValidator.EnsureIsRootedPath(filePath);

                // branch does not exist => result is empty
                if (!GitGroup.Repository.LocalBranchExists(BranchName))
                {
                    return Enumerable.Empty<SyncAction>();
                }

                // load the root directory of the branch
                var gitDirectory = new GitDirectory(null, "root", GitGroup.Repository.GetLocalBranch(BranchName).Tip);

                // determine if the directory for action with the specified state and path exists and load actions from it            
                var directoryPath = GetRelativeSyncActionDirectoryPath(state, filePath);
                if (!gitDirectory.DirectoryExists(directoryPath))
                {
                    return Enumerable.Empty<SyncAction>();
                }
                else
                {
                    var directory = gitDirectory.GetDirectory(directoryPath);
                    return LoadSyncActions(directory);
                }
            }
        }
Пример #4
0
 public SyncData(FileData fD, SyncConflictState sCS, SyncDirection sP)
 {
     FD  = fD;
     SCS = sCS;
     SD  = sP;
     SAS = SyncActionState.Skip;
 }
Пример #5
0
        private void SetTableItemSASValueTo(SyncActionState SAS)
        {
            var selectedRows = dataGridView1.SelectedRows;

            for (int i = 0; i < selectedRows.Count; i++)
            {
                dataGridView1[0, selectedRows[i].Index].Value = SAS.ToString();
                CurrentSession[selectedRows[i].Index].SAS     = SAS;
            }
        }
Пример #6
0
 public SyncAction(ChangeType type, IFileReference fromVersion, IFileReference toVersion,  Guid id, string target, SyncActionState state, int syncPointId)
     : base(type, fromVersion, toVersion)
 {
     if (syncPointId <= 0)
     {
         throw new ArgumentOutOfRangeException(nameof(syncPointId), "Id must be a positive integer");
     }
     
     this.Target = target;
     this.Id = id;
     this.State = state;
     this.SyncPointId = syncPointId;
 }
Пример #7
0
        public static void ActionsExist(ISyncActionService service, string path, SyncActionState? expectedState = null, int? expectedCount = null, ChangeType? expectedChangeType = null)
        {
            var actions = service[path].ToArray();

            Assert.NotEmpty(actions);

            if (expectedCount.HasValue)
            {
                Assert.Equal(expectedCount, actions.Length);
            }

            if (expectedState.HasValue)
            {                                   
                SyncAssert.IsInState(expectedState.Value, actions);
            }

            if (expectedChangeType != null)
            {
                SyncAssert.HasChangeType(expectedChangeType.Value, actions);
            }

        }
Пример #8
0
 public static SyncAction CreateReplaceFileSyncAction(string target, SyncActionState state, int syncPointId, IFileReference oldVersion, IFileReference newVersion)
 {
     return new SyncAction(ChangeType.Modified, oldVersion, newVersion, Guid.NewGuid(), target, state, syncPointId);
 }
Пример #9
0
 public static SyncAction CreateRemoveFileSyncAction(string target, SyncActionState state, int syncPointId, IFileReference removedFile)
 {
     return new SyncAction(ChangeType.Deleted, removedFile, null, Guid.NewGuid(), target, state, syncPointId);
 }
Пример #10
0
 public static SyncAction CreateAddFileSyncAction(Guid id, string target, SyncActionState state, int syncPointId, IFileReference toVersion)
 {
     return new SyncAction(ChangeType.Added, null, toVersion, id, target, state, syncPointId);
 }
Пример #11
0
 public static SyncAction CreateAddFileSyncAction(string target, SyncActionState state, int syncPointId, IFileReference toVersion)
 {
     return CreateAddFileSyncAction(Guid.NewGuid(), target, state, syncPointId, toVersion);
 }
Пример #12
0
 public SyncAction WithState(SyncActionState state)
 {
     return new SyncAction(Type, FromVersion, ToVersion, Id, Target, state, SyncPointId);
 }
Пример #13
0
 string GetRelativeSyncActionDirectoryPath(SyncActionState state) => state.ToString();
Пример #14
0
 string GetRelativeSyncActionDirectoryPath(SyncActionState state, string filePath) => state + filePath;
Пример #15
0
        //public static void PrioritizeConflictFileDataListSingle(List<SyncData> SDList, SyncDirection SPToSet)
        //{
        //}

        /// <summary>
        /// Function that assigns specific SyncData to specific SyncActionState.
        /// </summary>
        /// <param name="SD">The list of the SyncData to be prioritized.</param>
        /// <param name="SASToSet">Specific SyncActionState that will be applied to this SyncData.</param>
        public static void AssignActionStateToSyncData(SyncData SD, SyncActionState SASToSet)
        {
            SD.SAS = SASToSet;
        }