How to generically undo a source control checkout from an addin

Unanswered How to generically undo a source control checkout from an addin

  • Tuesday, April 24, 2012 8:10 PM
     
     

    Hi there,

    I'm currently relying on "EnvDTE80.SourceControl2" to perform some basic source control operations in my add-in but there's no "UndoCheckout" function. I'm aware of "SccUncheckout" using the source control plug-in API (formerly MSSCCI API), but don't know how to call this from an add-in (if possible). Moreover, that won't work for a VSPackage presumably where I would need to get hold of the proper interface (and which one would that be). Is there a standard way to do this that will work for both, regardless of which is currently in use (source control plug-in vs VSPackage), and if so how. If not, how do I detect which system is in use and how do I interface with these. Note that I don't want to execute the "File.UndoCheckout" command if possible (in Visual Studio). Thanks for your help.


    • Edited by Robert2415 Tuesday, April 24, 2012 8:11 PM
    •  

All Replies

  • Thursday, April 26, 2012 7:37 AM
    Moderator
     
     

    Hi Robert2415, 

    Do you develop your source control based on Visual Studio? If yes, I suggest you to post this thread to Visual Studio Source Control and SourceSafe forum. If no, please post it to a more suitable forum. If you have no idea which forum should you post, you can ask it in Where is the Forum For…? Forum. They will tell you.


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, April 26, 2012 7:50 PM
     
     
    Ok, thanks. I'll try there (didn't know about it), but I thought the extensibility forum might be relevant. The issue isn't confined to SourceSafe. I just to need to undo a checkout regardless of which source control package is installed (SourceSafe, TFS, or any other). Thanks for your help though.
  • Thursday, April 26, 2012 7:55 PM
     
     

    Hi there,

    My question isn't confined to SourceSafe but any source control package (SourceSafe, TFS, or whatever). I'm currently relying on "EnvDTE80.SourceControl2" to perform some basic source control operations in a Visual Studio add-in but there's no "UndoCheckout" method on this interface. I'm aware of "SccUncheckout" using the source control plug-in API (formerly MSSCCI API), but don't know how to call this from an add-in (if possible). Moreover, that won't work for a VSPackage presumably where I would need to get hold of the proper interface (and which one would that be). Is there a standard way to do this that will work for both, regardless of which is currently in use (source control plug-in vs VSPackage). If not, how do I detect which system is in use and how do I interface with these. Note that I don't want to execute the "File.UndoCheckout" command if possible (in Visual Studio). Thanks for your help.

    • Merged by Bob_BaoMVP Monday, April 30, 2012 2:58 AM VSX development
    •  
  • Monday, April 30, 2012 2:57 AM
     
     

    This thread is related with the Visual Studio extension development, not a VSS thread. So I still recommend to handle at this forum. I have checked the duplicate thread on the VSS forum, and will merge it to this one. Thanks.

    Regards with this question. I think if you are work with the specific VSS, try the Visual SourceSafe Automation. And how to to use EnvDTE.DTE.ExecuteCommand?

    Some information may help you from Carlos J. Quintero's article: http://www.mztools.com/articles/2007/MZ2007013.aspx (lists in http://www.mztools.com/resources_vsnet_addins.aspx)


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

  • Monday, April 30, 2012 12:42 PM
     
     

    Ok, thanks. I've already done quite a bit of research including reading Carlos' articles (his site is highly valuable) as well as the other sources you suggested. There's also an API for handling Team Foundation Server but the original problem remains. There doesn't seem to be a (documented) way to undo a checkout independent of the source control package that's installed. "EnvDTE.DTE.ExecuteCommand" also won't serve my needs because it requires the file to be loaded and made the current document before it will work (in the case where I'd be calling "File.UndoCheckout"). This is impractical where a mass number of changes are required (and too high-level for my needs). Even relying on a specific package's API probably wouldn't help me, since this has to be done within a Visual Studio add-in where source control is integrated into Visual Studio itself. IOW, it's not enough to just undo a checkout using a package's native API, since Visual Studio itself also needs to respond to the "undo checkout" request (in order to update Solution Explorer, and take any other appropriate action which isn't documented, and may be internal and therefore beyond my control). In any case, since I need to target any source control package, I can't assume that SourceSafe or TFS is even going to be in use. It's looking like this may not be possible. At the very least if someone knew the answer to the following I may be able to mitigate the situation:

    1) How to determine what source control package is currently in use and whether it uses the control plug-in API (formerly MSSCCI API) or a VSPackage. These are the two official ways MSFT provides for creating a source control package.

    2) Based on 1 above, if the control plug-in API is in use, how do I go about accessing this API. It's supposed to expose an "SccUncheckout()" method so even if I have to invoke it via "LoadLibrary()" and "GetProcAddress()", that's fine. In this case how would I even officially find the DLL, assuming this is how to officially access the API. OTOH, if a VSPackage is in use instead, which interface am I after, which method do I call on this interface (to undo a file's checkout), and how do I officially get hold of this interface from an add-in. Note that I looked at the interfaces mentioned in Carlos' article (IVsSccXXX), and none of them offer an undo checkout method or any other method where you can ultimately get hold of this (that I could find).





    • Edited by Robert2415 Monday, April 30, 2012 12:46 PM
    • Edited by Robert2415 Monday, April 30, 2012 12:48 PM
    • Edited by Robert2415 Monday, April 30, 2012 12:49 PM
    • Edited by Robert2415 Monday, April 30, 2012 2:23 PM
    •