Exemple #1
0
        private void DiffToPreviousSource(PendingChangeWithConflict pc)
        {
            if (pc == null)
            {
                return;
            }
            string exactSource = null;
            var    target      = pc.Change.ServerPath;

            if (target.StartsWith(TargetBranch.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                target = target.Substring(TargetBranch.Name.Length);
            }

            var candidates
                = SourceChangesets
                  .SelectMany(cs => cs.Changes)
                  .Where(change => change.ServerItem.StartsWith(SourceBranch.Name, StringComparison.InvariantCultureIgnoreCase));

            var fullMatch = candidates.FirstOrDefault(candidate => candidate.ServerItem.Substring(SourceBranch.Name.Length) == target);

            if (fullMatch != null)
            {
                exactSource = fullMatch.ServerItem;
            }

            if (exactSource != null && (fullMatch.Change.Item.ChangesetId > 1))
            {
                Repository.Instance.TfsUIInteractionProvider.ShowDifferencesPerTF(
                    TemporaryWorkspace.MappedFolder,
                    exactSource + ";" + (fullMatch.Change.Item.ChangesetId - 1).ToString(),
                    exactSource + ";" + fullMatch.Change.Item.ChangesetId.ToString());
            }
        }
 private bool CanDiffToPreviousSource(PendingChangeWithConflict pc)
 {
     if (pc == null)
     {
         return(false);
     }
     if (pc.IsDelete)
     {
         return(false);
     }
     return(true);
 }
 private bool CanDiffSourceToTarget(PendingChangeWithConflict pc)
 {
     if (pc == null)
     {
         return(false);
     }
     if (!pc.IsEdit)
     {
         return(false);
     }
     return(true);
 }
 private bool CanDiffToPreviousTarget(PendingChangeWithConflict pc)
 {
     if (pc == null)
     {
         return(false);
     }
     if (pc.IsAdd)
     {
         return(false);
     }
     return(true);
 }
Exemple #5
0
 private void DiffToPreviousTarget(PendingChangeWithConflict pc)
 {
     if (pc == null)
     {
         return;
     }
     if (!Repository.Instance.TfsUIInteractionProvider.ShowDifferencesPerTF(
             TemporaryWorkspace.MappedFolder,
             pc.Change.PendingChange.ServerItem + ";" + pc.Change.PendingChange.SourceVersionFrom.ToString(),
             pc.Change.PendingChange.ServerItem + ";" + (pc.Change.PendingChange.SourceVersionFrom - 1).ToString()))
     {
         var mbvm = new MessageBoxViewModel("Cannot show difference", "No differences can be shown.", MessageBoxViewModel.MessageBoxButtons.OK);
         Repository.Instance.ViewManager.ShowModal(mbvm);
     }
 }
        private void DiffSourceToTarget(PendingChangeWithConflict pc)
        {
            try {
                if (pc == null)
                {
                    return;
                }
                string exactSource = null;
                var    target      = pc.Change.ServerPath;
                if (target.StartsWith(TargetBranch.Name, StringComparison.InvariantCultureIgnoreCase))
                {
                    target = target.Substring(TargetBranch.Name.Length);
                }

                var candidates
                    = SourceChangesets
                      .SelectMany(cs => cs.Changes)
                      .Where(change => change.ServerItem.StartsWith(SourceBranch.Name, StringComparison.InvariantCultureIgnoreCase));

                var fullMatch = candidates.FirstOrDefault(candidate => candidate.ServerItem.Substring(SourceBranch.Name.Length) == target);
                if (fullMatch != null)
                {
                    exactSource = fullMatch.ServerItem;
                }

                if (exactSource != null)
                {
                    Repository.Instance.TfsUIInteractionProvider.ShowDifferencesPerTF(
                        TemporaryWorkspace.MappedFolder,
                        exactSource,
                        pc.Change.PendingChange.LocalItem);
                }
            }
            catch (Exception ex)
            {
                SimpleLogger.Log(ex, false, false);
                throw;
            }
        }