locked
get latest on checkout macro RRS feed

  • Question

  • We just started using team system, and were switching over from vss. We're used to the vss get latest on check out way of working. I know there's a million reasons given as to why this is taken out in team system...but our team wants it to work the regular way (it's to the point where superiors will can the product if a workaround isn't found). It's currently our only draw back to fully using team systems for all internal projects.

    I posted the macro mentioned on other posts to accomplish this functionality below. My question is how do you set this up to work? Does it work automatically when you check a file out? Do you have to bind it to a button that you hit when you check it out? Any help or solutions will be greatly appreciated.

     

        Sub CheckoutLatest()
            DTE.ExecuteCommand("File.TfsGetLatestVersion")
            DTE.ExecuteCommand("File.TfsCheckOut")
        End Sub

     

    Friday, July 28, 2006 6:55 PM

Answers

  •  gleason78 wrote:

    Is there any way to get this to happen automatically whenever i check out for edit now?

    Not in the v1 client.  The MSSCCI plugin has this feature, and future versions of Team Explorer may support it as well, but the macro is the closest alternative in today's shipping code.  You could use UI automation, I suppose, but that's likely to be more effort than it's worth.

    Tuesday, August 1, 2006 7:32 PM
    Moderator

All replies

  • Yes, you can add this macro to you toolbar or menu item. To do it,

    - Go to Tools\Customize...

    - On Commands tab, select "rearrange commands"

    - On preferred toolbar or menu, click on "Add" and choose "Macros" in cateogory and add your macro.

    To add a macro, there is Tools/Macro command. You can also click "record a macro" and do this getlatest & checkout operations to get a template of macro which you can edit later.

    Friday, July 28, 2006 8:05 PM
  • Is there any way to get this to happen automatically whenever i check out for edit now? Like can i attach to the check out event in visual studio somehow? It'd be great if it worked with check out on edit.


    using the macro does wierd stuff (i set it up). Like if you check out a file that has not changed, it gives you an annoying window that tells you that.

    Another thing that would be passable, is a simple warning on checkout that the file is different on the server. I noticed in the output window it says this. Is there any way to make the alert more noticeable?

     

    Friday, July 28, 2006 8:12 PM
  • I see "GetLatest on Checkout support" in current MSSCCI plugin - http://blogs.msdn.com/edhintz/default.aspx
    Monday, July 31, 2006 9:26 PM
  •  gleason78 wrote:

    Is there any way to get this to happen automatically whenever i check out for edit now?

    Not in the v1 client.  The MSSCCI plugin has this feature, and future versions of Team Explorer may support it as well, but the macro is the closest alternative in today's shipping code.  You could use UI automation, I suppose, but that's likely to be more effort than it's worth.

    Tuesday, August 1, 2006 7:32 PM
    Moderator
  • Can you use the msscci plugin within visual studio 2005? Will you lose any functionality doing this?
    Tuesday, August 1, 2006 7:34 PM
  • You cannot use Msscci provider within VS2005, it's intended for other IDEs (VB6, VC6, VS2003 and others).
    Monday, August 7, 2006 2:52 PM
  • Try this:

    Public Sub DocumentEvents_DocumentOpening(ByVal DocumentPath As String, _

    ByVal Read_Only As Boolean) Handles DocumentEvents.DocumentOpening

    Dim attr As FileAttributes

    attr = File.GetAttributes(DocumentPath)

    If (attr.ReadOnly) Then

    DTE.ExecuteCommand("File.TfsGetLatestVersion")

    End If

    End Sub

    Paste it into the EnvironmentEvents window in Macro Explorer, just under the automatically generated code and  save.

    Now every time you open a file that is not read only (i.e. not checked out) VS will automatically get the latest version.

    Hope this helps

    Enzo

    Monday, September 25, 2006 8:50 AM
  • Please change this line

    If (attr.ReadOnly) Then

    with

    If (attr And FileAttributes.ReadOnly) Then

     

    Otherwise you will get infinite loops when a FileAttributes.Archive fires. I think the VB logical/binary operators are slightly different than C#'s.

     

    Sincerely

     

    Costas

    Monday, November 6, 2006 3:26 PM