/// <summary> /// Determines whether the given fork entry is contained in the fork add, update or delete differences. /// </summary> /// <param name="fork">The fork to search for.</param> /// <param name="operation">Which kind of operations to search for.</param> /// <returns><c>true</c> if the given fork participates in any of the given operations.</returns> public bool Contains(Fork fork, LfsOperations operation) { var isInDiff = false; if (operation.HasFlag(LfsOperations.Add)) { isInDiff |= ForkDifferences.ToAdd.Any(f => f.GlobalForkNumber == fork.GlobalForkNumber); } if (operation.HasFlag(LfsOperations.Update)) { isInDiff |= ForkDifferences.ToUpdate.Any(f => f.GlobalForkNumber == fork.GlobalForkNumber); } if (operation.HasFlag(LfsOperations.Remove)) { isInDiff |= ForkDifferences.ToDelete.Contains(fork.GlobalForkNumber) || ForkDifferences.ToUpdate.Any(f => f.GlobalForkNumber == fork.GlobalForkNumber); } return(isInDiff); }
/// <summary> /// Determines whether the given directory entry is contained in the directory add, update or delete differences. /// </summary> /// <param name="directory">The directory to search for.</param> /// <param name="operation">Which kind of operations to search for.</param> /// <returns><c>true</c> if the given directory participates in any of the given operations.</returns> public bool Contains(IDirectory directory, LfsOperations operation) { var isInDiff = false; if (operation.HasFlag(LfsOperations.Add)) { isInDiff |= DirectoryDifferences.ToAdd.Any(d => d.GlobalDirectoryNumber == directory.GlobalDirectoryNumber); } if (operation.HasFlag(LfsOperations.Update)) { isInDiff |= DirectoryDifferences.ToUpdate.Any(d => d.GlobalDirectoryNumber == directory.GlobalDirectoryNumber); } if (operation.HasFlag(LfsOperations.Remove)) { isInDiff |= DirectoryDifferences.ToDelete.Contains(directory.GlobalDirectoryNumber); } return(isInDiff); }
/// <summary> /// Determines whether the given file entry is contained in the file add, update or delete differences. /// </summary> /// <param name="file">The file to search for.</param> /// <param name="operation">Which kind of operations to search for.</param> /// <returns><c>true</c> if the given file participates in any of the given operations.</returns> public bool Contains(ILfsFileInfo file, LfsOperations operation) { var isInDiff = false; if (operation.HasFlag(LfsOperations.Add)) { isInDiff |= FileDifferences.ToAdd.Any(f => f.GlobalFileNumber == file.GlobalFileNumber); } if (operation.HasFlag(LfsOperations.Update)) { isInDiff |= FileDifferences.ToUpdate.Any(f => f.GlobalFileNumber == file.GlobalFileNumber); } if (operation.HasFlag(LfsOperations.Remove)) { isInDiff |= FileDifferences.ToDelete.Contains(file.GlobalFileNumber); } return(isInDiff); }