예제 #1
0
 protected override void Execute(string filename, AbstractProjectBrowserTreeNode node, Action callback)
 {
     try {
         TFS.AddFile(filename);
     }
     catch (Exception ex)
     {
         TFSMessageView.Log("TFSError: Add: " + ex.Message + " (" + filename + ")");
     }
 }
예제 #2
0
        public static void UndoFile(string fileName)
        {
            var item = GetTfsItem(fileName);

            if (item != null)
            {
                int changes = item.Workspace.Undo(fileName);
                var status  = item.Workspace.Get(new[] { fileName }, VersionSpec.Latest, RecursionType.None, GetOptions.Overwrite);
                TFSMessageView.Log("TFS: {0} changes undone", changes);
                if (changes > 0)
                {
                    UpdateStatusCacheAndEnqueueFile(fileName);
                }
            }
        }
예제 #3
0
        protected override void Execute(string filename, AbstractProjectBrowserTreeNode node, Action callback)
        {
            try
            {
                var nodes = new List <AbstractProjectBrowserTreeNode> {
                    node
                };

                GetNodesRecursive(nodes, node);
                var anythingUpdated = false;

                foreach (var treeNode in nodes)
                {
                    var itemPath = TFS.GetFileName(treeNode);
                    if (string.IsNullOrWhiteSpace(itemPath))
                    {
                        continue;
                    }
                    var item = TFS.GetTfsItem(itemPath);
                    if (item == null)
                    {
                        continue;
                    }
                    GetRequest request = new GetRequest(item.ItemSpec, VersionSpec.Latest);
                    GetStatus  status  = item.Workspace.Get(request, GetOptions.None);
                    if (!status.NoActionNeeded)
                    {
                        TFSMessageView.Log(item.Path + " updated.");
                    }

                    anythingUpdated = anythingUpdated || !status.NoActionNeeded;
                }

                if (!anythingUpdated)
                {
                    TFSMessageView.Log("All files are up to date.");
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #4
0
        protected override void Execute(string filename, AbstractProjectBrowserTreeNode node, Action callback)
        {
            try
            {
                var item = TFS.GetTfsItem(filename);
                if (item == null)
                {
                    return;
                }
                var itemEx = item.Workspace.VersionControlServer.GetItem(filename, VersionSpec.Latest, DeletedState.Any, true);
                var path   = Path.GetTempPath() + itemEx.ChangesetId + "_" +
                             itemEx.ServerItem.Split('/')[itemEx.ServerItem.Split('/').Length - 1];
                itemEx.DownloadFile(path);

                Difference.VisualDiffFiles(path, filename, "Latest", "Local", "Latest", "Local", true, false, true, false);
            }
            catch (Exception ex)
            {
                TFSMessageView.Log("TFSError: Add: " + ex.Message + " (" + filename + ")");
            }
        }