BUG - Custom checkin policies and checking in files for multiple team projects - Policies are not evaluated!!
howdie, everyone. if selected wrong forum this, apologize.
i should qualify subject line of discussion saying using visual studio 2010 (10.0.30319.1 rtmrel) ultimate. can reproduce same behavior on visual studio 2010 premium.
we have team project *collection*. title of thing implies, have multiple team projects in collection. trouble comes in popup checkin window, pending changes checkin window, show items checked out entire collection. appropriate, since may need make changes several projects in course of fixing problem, or may need start making changes in one project, , switch on project before completed or checked in.
once have pending changes multiple team projects, can witness behavior checking checkboxes items in different team projects, , clicking paper/red circle/white minus sign icon evaluate checkin policies. when have items multiple team projects selected, evaluates none of policies in of projects, rather falsely tells "all check-in policies satisfied", outright lie.
to compare, checkbox items in 1 team project, , click policy evaluate button again, , voila!! policies evaluated.
as team lead, unacceptable me if 1 of developers selects items more 1 team project, can bypass check-in policy evaluation altogether. don't alert setup notify me , boss when check-in policy manually bypassed because developer not forced enter override comment.
i try abuse mind such extent can rationalize behavior design... sorry, can't. bug. when checking in files multiple team projects, part of general integrity of system, unique list of team projects (which _affectedteamprojectschanged event tells knows about) needs have checkin policies evaluated in order. or else, make impossible mark check-ins separate team projects.
for seeking repro, can use of default checkin policies witness bug.
btw: if have come here seeking answer (and happy find has defined problem), please co-miserate post adding reply says "me too". =)
ok...
what boy i withold profanities. =)
alright... check out hack-zilla solution. should not required, expect better microsoft... but...
i had create visual studio add-in (connect.vb code below).
this seems work. if developer accidentally selects files more 1 team project , clicks check-in, receive popup message box says:
- i'm sorry, dave. can't that.
not allowed simultaneously checkin items multiple team projects.
still... <insert favorite profanity here>.
i should hope "me too"s on one, , issue escalated sp1.
<8/20/2010 6:35 - code below updated; no sooner published add-in yesterday, worked fine source control explorer, team-mate broke checkin through solution tree. add-in handles methods of checking in now>
public class connect
implements idtextensibility2
private _applicationobject as dte2
private _addininstance as addin
private oversioncontrol as microsoft.visualstudio.teamfoundation.versioncontrol.versioncontrolext
dim withevents otfs as microsoft.teamfoundation.client.tfsteamprojectcollection
dim withevents oversioncontrolserver as microsoft.teamfoundation.versioncontrol.client.versioncontrolserver
dim withevents otfsext as microsoft.visualstudio.teamfoundation.teamfoundationserverext
dim oprojectcontext as microsoft.visualstudio.teamfoundation.projectcontext
dim spendingprojects as new generic.list(of string)
'''<summary>implements the constructor for the add-in object. place your initialization code within this method.</summary>
public sub new()
end sub
'''<summary>implements the onconnection method of the idtextensibility2 interface. receives notification that the add-in is being loaded.</summary>
'''<param name='application'>root object of the host application.</param>
'''<param name='connectmode'>describes how the add-in is being loaded.</param>
'''<param name='addininst'>object representing this add-in.</param>
'''<remarks></remarks>
public sub onconnection(byval application as object, byval connectmode as ext_connectmode, byval addininst as object, byref custom as array) implements idtextensibility2.onconnection
_applicationobject = ctype(application, dte2)
_addininstance = ctype(addininst, addin)
end sub
'''<summary>implements the ondisconnection method of the idtextensibility2 interface. receives notification that the add-in is being unloaded.</summary>
'''<param name='disconnectmode'>describes how the add-in is being unloaded.</param>
'''<param name='custom'>array of parameters that are host application specific.</param>
'''<remarks></remarks>
public sub ondisconnection(byval disconnectmode as ext_disconnectmode, byref custom as array) implements idtextensibility2.ondisconnection
end sub
'''<summary>implements the onaddinsupdate method of the idtextensibility2 interface. receives notification that the collection of add-ins has changed.</summary>
'''<param name='custom'>array of parameters that are host application specific.</param>
'''<remarks></remarks>
public sub onaddinsupdate(byref custom as array) implements idtextensibility2.onaddinsupdate
end sub
'''<summary>implements the onstartupcomplete method of the idtextensibility2 interface. receives notification that the host application has completed loading.</summary>
'''<param name='custom'>array of parameters that are host application specific.</param>
'''<remarks></remarks>
public sub onstartupcomplete(byref custom as array) implements idtextensibility2.onstartupcomplete
otfsext = _applicationobject.getobject("microsoft.visualstudio.teamfoundation.teamfoundationserverext")
end sub
'''<summary>implements the onbeginshutdown method of the idtextensibility2 interface. receives notification that the host application is being unloaded.</summary>
'''<param name='custom'>array of parameters that are host application specific.</param>
'''<remarks></remarks>
public sub onbeginshutdown(byref custom as array) implements idtextensibility2.onbeginshutdown
end sub
private sub otfsext_projectcontextchanged(byval sender as object, byval e as system.eventargs) handles otfsext.projectcontextchanged
'
try
oversioncontrol = _applicationobject.getobject("microsoft.visualstudio.teamfoundation.versioncontrol.versioncontrolext")
dim oprojectcontextinfo as system.reflection.fieldinfo = otfsext.activeprojectcontext.gettype.getfield("m_projectcontext", system.reflection.bindingflags.instance or system.reflection.bindingflags.nonpublic)
oprojectcontext = oprojectcontextinfo.getvalue(otfsext.activeprojectcontext)
dim otfsinfo as system.reflection.fieldinfo = oprojectcontext.gettype().getfield("m_tfs", system.reflection.bindingflags.nonpublic or system.reflection.bindingflags.instance)
otfs = otfsinfo.getvalue(oprojectcontext)
oversioncontrolserver = otfs.getservice(of microsoft.teamfoundation.versioncontrol.client.versioncontrolserver)()
catch ex as exception
end try
end sub
private sub oversioncontrolserver_beforecheckinpendingchange(byval sender as object, byval e as microsoft.teamfoundation.versioncontrol.client.processingchangeeventargs) handles oversioncontrolserver.beforecheckinpendingchange
dim sprojectname as string
dim oproject as microsoft.teamfoundation.versioncontrol.client.teamproject = oversioncontrolserver.getteamprojectforserverpath(e.pendingchange.serveritem)
if not oproject is nothing then
sprojectname = oproject.name
if not spendingprojects.contains(sprojectname) then
spendingprojects.add(sprojectname)
end if
end if
if spendingprojects.count > 1 then
oversioncontrolserver.canceled = true
msgbox("i'm sorry, dave. i can't do that." & vbcrlf & vbcrlf & "you are not allowed to simultaneously checkin items from multiple team projects.")
end if
end sub
private sub oversioncontrolserver_operationstarting(byval sender as object, byval e as microsoft.teamfoundation.versioncontrol.client.operationeventargs) handles oversioncontrolserver.operationstarting
if e.type = microsoft.teamfoundation.versioncontrol.client.operationeventtype.checkin then
spendingprojects = new generic.list(of string)
end if
end sub
end class
Archived Forums V > Team Foundation Server - Source and Version Control
Comments
Post a Comment