Ejemplo n.º 1
0
        /// <summary>
        ///     Add a new repository the crawled data. If that repository already exists (check will be done on the
        ///     GitHubRepositoryId) the repository data will be updated.
        /// </summary>
        /// <param name="repository">The repository to update or insert</param>
        /// <returns>If the last commit date was changed and therefore keywords needs to be updated</returns>
        public bool InsertOrUpdateRepository(ref GitHubRepository repository)
        {
            // Find already existing entry
            GitHubRepository existing = GitHubRepositories.Find(repository.GitHubRepositoryId);
            if (existing == null) // Repository is new => insert
            {
                GitHubRepositories.Add(repository);
                return true;
            }

            // Repository exists => Replace values in DB with values from reporitory parameter
            bool lastCommitChanged = existing.PushedAt != repository.PushedAt;
            existing.Update(repository);
            repository = existing;
            return lastCommitChanged;
        }