Пример #1
0
        private void createGitHelpers(DataCache dataCache, ILocalCommitStorageFactory factory)
        {
            if (dataCache.MergeRequestCache == null || dataCache.DiscussionCache == null)
            {
                return;
            }

            LocalCommitStorageType storageType = ConfigurationHelper.GetPreferredStorageType(Program.Settings);
            bool isGitStorageUsed = storageType == LocalCommitStorageType.FullGitRepository ||
                                    storageType == LocalCommitStorageType.ShallowGitRepository;

            _gitDataUpdater = Program.Settings.CacheRevisionsPeriodMs > 0
            ? new GitDataUpdater(
                dataCache.MergeRequestCache, dataCache.DiscussionCache, this, factory,
                Program.Settings.CacheRevisionsPeriodMs, _mergeRequestFilter, isGitStorageUsed)
            : null;

            if (Program.Settings.UseGitBasedSizeCollection)
            {
                _diffStatProvider = new GitBasedDiffStatProvider(
                    dataCache.MergeRequestCache, dataCache.DiscussionCache, this, factory);
            }
            else
            {
                _diffStatProvider = new DiscussionBasedDiffStatProvider(dataCache.DiscussionCache);
            }
            _diffStatProvider.Update += onGitStatisticManagerUpdate;
        }
Пример #2
0
        internal GitDataUpdater(
            IMergeRequestCache mergeRequestCache,
            IDiscussionCache discussionCache,
            ISynchronizeInvoke synchronizeInvoke,
            ILocalCommitStorageFactory gitFactory,
            int autoUpdatePeriodMs,
            MergeRequestFilter mergeRequestFilter,
            bool isInitialUpdateNeeded)
            : base(mergeRequestCache, discussionCache, synchronizeInvoke, gitFactory)
        {
            if (autoUpdatePeriodMs < 1)
            {
                throw new ArgumentException("Bad auto-update period specified");
            }
            _mergeRequestFilter = mergeRequestFilter;

            _timer = new System.Timers.Timer {
                Interval = autoUpdatePeriodMs
            };
            _timer.Elapsed            += onTimer;
            _timer.SynchronizingObject = synchronizeInvoke;
            _timer.Start();

            if (isInitialUpdateNeeded)
            {
                scheduleAllProjectsUpdate();
            }
        }
Пример #3
0
 internal GitBasedDiffStatProvider(
     IMergeRequestCache mergeRequestCache,
     IDiscussionCache discussionCache,
     ISynchronizeInvoke synchronizeInvoke,
     ILocalCommitStorageFactory gitFactory)
     : base(mergeRequestCache, discussionCache, synchronizeInvoke, gitFactory)
 {
     scheduleAllProjectsUpdate();
 }
Пример #4
0
        internal BaseGitHelper(
            IMergeRequestCache mergeRequestCache,
            IDiscussionCache discussionCache,
            ISynchronizeInvoke synchronizeInvoke,
            ILocalCommitStorageFactory gitFactory)
        {
            _mergeRequestCache = mergeRequestCache;
            _mergeRequestCache.MergeRequestEvent += onMergeRequestEvent;

            _discussionCache = discussionCache;

            _gitFactory = gitFactory;
            if (_gitFactory != null)
            {
                _gitFactory.GitRepositoryCloned += onGitRepositoryCloned;
            }
            _synchronizeInvoke = synchronizeInvoke;
        }
Пример #5
0
        /// <summary>
        /// Make some checks and create a commit storage
        /// </summary>
        /// <returns>null if could not create a repository</returns>
        private ILocalCommitStorage getCommitStorage(ProjectKey projectKey, bool showMessageBoxOnError)
        {
            ILocalCommitStorageFactory factory = getCommitStorageFactory(showMessageBoxOnError);

            if (factory == null)
            {
                return(null);
            }

            LocalCommitStorageType type = ConfigurationHelper.GetPreferredStorageType(Program.Settings);
            ILocalCommitStorage    repo = factory.GetStorage(projectKey, type);

            if (repo == null && showMessageBoxOnError)
            {
                MessageBox.Show(String.Format(
                                    "Cannot obtain disk storage for project {0} in \"{1}\"",
                                    projectKey.ProjectName, Program.Settings.LocalStorageFolder),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(repo);
        }