How to Check Out Source Controlled Files #217
Replies: 5 comments
-
You can do something like this: if (dte.SourceControl.IsItemUnderSCC(fileName) && !dte.SourceControl.IsItemCheckedOut(fileName))
{
dte.SourceControl.CheckOutItem(fileName);
} |
Beta Was this translation helpful? Give feedback.
-
Working but what about showing the file after its checked out? if I open many files in a row, check out fails. I think because Windows events are not processing. Is there an equivalent to Application.DoEvents()? |
Beta Was this translation helpful? Give feedback.
-
More specifically, here is my check out routine. CheckOutItem() is successful but IsItemCheckedOut() returns false right after. Is there some Windows events that need to process because DTE is a COM object? How do I let them process between the two calls?
|
Beta Was this translation helpful? Give feedback.
-
Is it possible to do checkout without using DTE? |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what the API is for that. Perhaps @Taysser-Gherfal knows? |
Beta Was this translation helpful? Give feedback.
-
I used to do this to check out files from source control. Always had issues with files not being fully checked out in time for edits. DoEvents() seemed to fix the issue. Is there a better way?
Solution = DTE.Solution;
ProjectItem = Solution.FindProjectItem(File);
Document = ProjectItem.Document;
Window = Document.ActiveWindow;
Window .Activate();
DTE.ExecuteCommand("EditorContextMenus.CodeWindow.CheckOutforEdit");
//System.Threading.Thread.Sleep(100);
Application.DoEvents();
Beta Was this translation helpful? Give feedback.
All reactions