2

1

Hi,

we have a kind of special issue regarding the workflow: In case a case of Category X has checkins associated with it, we want to use a different workflow (that is it should be assigned to the QA team when its resolved, and not to the default person (:=author)). I don't see that this is possible with the plain workflow plugin, as there is no access to the checkins. How do I best create a plugin (or perhaps there is already one around) to achive this? Or do I need to modify fogbugz source code?

Any help would be appreciated.

regards Alex

BTW: Did I say that I like this tool here? ;)

flag

3 Answers

2

Workflows are set per-project, not per-case, so you couldn't have a plugin change the workflow without moving the case to a different project. That said, there is a plugin interface you can implement to perform actions when a case receives checkins. In that interface, you could check the category, and if it's X, assign the case to a specific user. That would cover something like wanting immediate code review upon checkin.

For assignment when the case is resolved, I think a plugin could implement the bug commit interface and, if the action is resolve and the case has checkins, assign to a specific user.

These methods would just be overriding the Workflow plugin, not changing the workflow, so it might not work perfectly. e.g. depending on how the Workflow plugin is written, and perhaps the order your plugins are installed, it might make its assignment after you made yours. Also, other status changes would be handled by the Workflow plugin unless you handle those too.

Here is an example of hooking into bug commit, and one for checkins.

link|flag
Great. Thats sounds like what I need. – Alexander Gran Feb 21 2010 at 0:46
Is this the correct answer? Mark it as such. – flipdoubt Jan 21 at 9:46
0

Hi adam, as I just begun to work on the new plugin, I didn't find an (api) way to see if a bug has associated cvs actions. As far as I can tell, it can only be done via a direct query against the database, similar to what fogbugz does in CCVS.was:

    ' ListNowForBug
    '
    ' Returns a RecordSet which enumerates CVS entries for a bug.
    ' TODO CQuery-ize this.
    '
    Internal Function ListNowForBug( ixBug As Int32 )

            Dim cmd = GetCmd("      SELECT CVS.sFile AS sFile, " & _
                                             "             CVS.sPrev AS sPrev, " & _
                                             "             CVS.sNew AS sNew, " & _
                                             "             CVS.ixRepository AS ixRepository, " & _
                                             "             Repository.sName AS sRepositoryName, " & _
                                             "             Repository.sRepo AS sRepo, " & _
                                             "             Repository.sDiffURL AS sDiffURL, " & _
                                             "             Repository.sLogURL AS sLogURL " & _
                                             "        FROM CVS " & _
                                             "  INNER JOIN Repository " & _
                                             "          ON CVS.ixRepository = Repository.ixRepository " & _
                                             "       WHERE CVS.ixBug = ? " & _
                                             "         AND Repository.fDeleted = 0 " & _
                                             "    ORDER BY Repository.sName, sFile, ixCVS", "I" )

            cmd.SetParam 1, ixBug
            Return cmd.Execute()

    End Function

Is that true, or do I miss something?

regards Alex

BTW: THe add comment field doesn't allow such long comments..

link|flag
Alexander, you don't need to use a generic query like this one. You can use an entity query via the CCvs api instance. I will send you an email with some more details, but entity queries are covered here: developers.fogbugz.com/default.asp?W107 – adambox Mar 15 2010 at 15:37
here's an example (also emailed you) fogbugz.stackexchange.com/questions/2094/… – adambox May 5 2010 at 16:03
0

Here's an example entity query (much simpler than the generic one). It just shows the count of checkins in ixRepository 2 for case 13 on a page accessible via a link in the Extras menu:

public class Test : Plugin, IPluginPageDisplay, IPluginExtrasMenu
{
    public Test(CPluginApi api)
        : base(api) { }

    public string PageDisplay()
    {
        CCvsQuery cvsquery = api.SourceControl.NewCVSQuery();
        cvsquery.AddWhere("CVS.ixBug = 13");
        cvsquery.AddWhere("CVS.ixRepository = 2");
        CCvs[] rgCvs = cvsquery.List();
        return string.Format("number: {0}", rgCvs.Length); 
    }

    public PermissionLevel PageVisibility()
    {
        return PermissionLevel.Normal;
    }

    public CNavMenuLink[] ExtrasMenuLinks()
    {
        return new CNavMenuLink[] { new CNavMenuLink("Checkins for case 13", api.Url.PluginPageUrl()) };
    }
}
link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.