Beispiel #1
0
 void TrackChangeset(object o)
 {
     try
     {
         TfsChangesetWrapper wrap = (TfsChangesetWrapper)o;
         Repository.Instance.TfsUIInteractionProvider.TrackChangeset(wrap.TfsChangeset.Changeset.ChangesetId);
     }
     catch (Exception)
     {
     }
 }
Beispiel #2
0
        public TfsChangesetWrapper GetChangesetFromCache(int id)
        {
            TfsChangesetWrapper fromCache = null;

            lock (_changesetCacheLock)
            {
                if (_changesetCacheMap.TryGetValue(id, out fromCache))
                {
                    return(fromCache);
                }
                return(UpdateChangesetFromCache(
                           new TfsChangesetWrapper(Repository.Instance.TfsBridgeProvider.GetChangesetById(id))));
            }
        }
Beispiel #3
0
        private void DetermineWarningStatus(ChangesetListElement changesetListElement)
        {
            if (changesetListElement.TargetCheckinId != 0)
            {
                return;
            }

            if (changesetListElement.SourceCheckinId == 0)
            {
                changesetListElement.HasWarning  = true;
                changesetListElement.WarningText =
                    "This changeset has not yet been merged to the selected source branch.";
                changesetListElement.CanBeMerged = false;
                return;
            }

            TfsChangesetWrapper sourceCS =
                TfsItemCache.GetChangesetFromCache(changesetListElement.SourceCheckinId);

            bool anyChangeNotInFilter
                = PathFilter == null ? false :
                  sourceCS.TfsChangeset.GetAllChanges()
                  .Any(change => !change.Change.Item.ServerItem.StartsWith(PathFilter));

            bool allChangesNotInFilter
                = PathFilter == null ? false :
                  sourceCS.TfsChangeset.GetAllChanges()
                  .All(change => !change.Change.Item.ServerItem.StartsWith(PathFilter));

            if (anyChangeNotInFilter || allChangesNotInFilter)
            {
                changesetListElement.HasWarning = true;
                if (allChangesNotInFilter)
                {
                    changesetListElement.WarningText =
                        "No change in this changeset is part of the merge due to the path filter selection.";
                    changesetListElement.CanBeMerged = false;
                }
                else if (anyChangeNotInFilter)
                {
                    changesetListElement.WarningText =
                        "Some changes in this changeset are not part of the merge due to the path filter selection.";
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Checks if a specific element is already in the cache; if so, it updates
        /// the cache (if necessary).
        /// It returns the cached element in any case.
        /// Purpose: avoids reading the elements' properties more than once
        /// (since they involve a round-trip to the TFS server)
        /// </summary>
        /// <param name="workItem">The work item check</param>
        /// <returns>The work item from the cache</returns>
        public TfsChangesetWrapper UpdateChangesetFromCache(TfsChangesetWrapper changeset)
        {
            TfsChangesetWrapper fromCache = null;

            lock (_changesetCacheLock)
            {
                if (_changesetCacheMap.TryGetValue(changeset.TfsChangeset.Changeset.ChangesetId, out fromCache))
                {
                    if (changeset.TfsChangeset.HasChangesLoaded &&
                        fromCache.TfsChangeset.HasChangesLoaded == false)
                    {
                        fromCache.TfsChangeset = changeset.TfsChangeset;
                    }
                    return(fromCache);
                }

                _changesetCache.Add(changeset);
                _changesetCacheMap[changeset.TfsChangeset.Changeset.ChangesetId] = changeset;
            }
            return(changeset);
        }
Beispiel #5
0
 public ChangesetHasBeenMergedEventArgs(TfsChangesetWrapper changeset)
 {
     Changeset = changeset;
 }