wiki:TicketQuery

TicketQuery Wiki Macro

The TicketQuery macro lets you display ticket information anywhere that accepts WikiFormatting. The query language used by the [[TicketQuery]] macro is described in the TracQuery page.

Usage

[[TicketQuery]]

Wiki macro listing tickets that match certain criteria.

This macro accepts a comma-separated list of keyed parameters, in the form "key=value".

If the key is the name of a field, the value must use the syntax of a filter specifier as defined in TracQuery#QueryLanguage. Note that this is not the same as the simplified URL syntax used for query: links starting with a ? character. Commas (,) can be included in field values by escaping them with a backslash (\).

Groups of field constraints to be OR-ed together can be separated by a literal or argument.

In addition to filters, several other named parameters can be used to control how the results are presented. All of them are optional.

The format parameter determines how the list of tickets is presented:

  • list -- the default presentation is to list the ticket ID next to the summary, with each ticket on a separate line.
  • compact -- the tickets are presented as a comma-separated list of ticket IDs.
  • count -- only the count of matching tickets is displayed
  • rawcount -- only the count of matching tickets is displayed, not even with a link to the corresponding query (since 1.1.1)
  • table -- a view similar to the custom query view (but without the controls)
  • progress -- a view similar to the milestone progress bars

The max parameter can be used to limit the number of tickets shown (defaults to 0, i.e. no maximum).

The order parameter sets the field used for ordering tickets (defaults to id).

The desc parameter indicates whether the order of the tickets should be reversed (defaults to false).

The group parameter sets the field used for grouping tickets (defaults to not being set).

The groupdesc parameter indicates whether the natural display order of the groups should be reversed (defaults to false).

The verbose parameter can be set to a true value in order to get the description for the listed tickets. For table format only. deprecated in favor of the rows parameter

The rows parameter can be used to specify which field(s) should be viewed as a row, e.g. rows=description|summary

The col parameter can be used to specify which fields should be viewed as columns. For table format only.

For compatibility with Trac 0.10, if there's a last positional parameter given to the macro, it will be used to specify the format. Also, using "&" as a field separator still works (except for order) but is deprecated.

Examples

Example Result Macro
Number of Triage tickets: 17 [[TicketQuery(status=new&milestone=,count)]]
Number of new tickets: 41 [[TicketQuery(status=new,count)]]
Number of reopened tickets: 1 [[TicketQuery(status=reopened,count)]]
Number of assigned tickets: 1 [[TicketQuery(status=assigned,count)]]
Number of invalid tickets: 3 [[TicketQuery(status=closed,resolution=invalid,count)]]
Number of worksforme tickets: 0 [[TicketQuery(status=closed,resolution=worksforme,count)]]
Number of duplicate tickets: 0 [[TicketQuery(status=closed,resolution=duplicate,count)]]
Number of wontfix tickets: 0 [[TicketQuery(status=closed,resolution=wontfix,count)]]
Number of fixed tickets: 29 [[TicketQuery(status=closed,resolution=fixed,count)]]
Number of untriaged tickets (milestone unset): 19 [[TicketQuery(status!=closed,milestone=,count)]]
Total number of tickets: 75 [[TicketQuery(count)]]
Number of tickets reported or owned by current user: 4 [[TicketQuery(reporter=$USER,or,owner=$USER,count)]]
Number of tickets created this month: 0 [[TicketQuery(created=thismonth..,count)]]
Number of closed Firefox tickets: 0 [[TicketQuery(status=closed,keywords~=firefox,count)]]
Number of closed Opera tickets: 0 [[TicketQuery(status=closed,keywords~=opera,count)]]
Number of closed tickets affecting Firefox and Opera: 0 [[TicketQuery(status=closed,keywords~=firefox opera,count)]]
Number of closed tickets affecting Firefox or Opera: 0 [[TicketQuery(status=closed,keywords~=firefox|opera,count)]]
Number of tickets that affect Firefox or are closed and affect Opera: 0 [[TicketQuery(status=closed,keywords~=opera,or,keywords~=firefox,count)]]
Number of closed Firefox tickets that don't affect Opera: 0 [[TicketQuery(status=closed,keywords~=firefox -opera,count)]]
Last 3 modified tickets: #75, #74, #73 [[TicketQuery(max=3,order=modified,desc=1,compact)]]

Details of ticket #1:

[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]

Ticket Owner Reporter
#1 arnault jiri.masik@…
Summary cmt cvstags broken

Format: list

[[TicketQuery(version=0.6|0.7&resolution=duplicate)]]

This is displayed as:

No results

[[TicketQuery(id=123)]]

This is displayed as:

No results

Format: compact

[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

This is displayed as:

No results

Format: count

[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

This is displayed as:

0

Format: progress

[[TicketQuery(milestone=0.12.8&group=type,format=progress)]]

This is displayed as:

Format: table

You can choose the columns displayed in the table format (format=table) using col=<field>. You can specify multiple fields and the order they are displayed by placing pipes (|) between the columns:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Results (1 - 3 of 32)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#61 fixed CMT crashes with SEGV whan handling file paths longer than 256 bytes arnault Francesco.Prelz@…
#57 fixed allow to run setup.csh from any place arnault Hubert.Degaudenzi@…
#56 fixed pacman installation of CMT fails if . not in PATH? arnault anonymous
1 2 3 4 5 6 7 8 9 10 11

Full rows

In table format you can specify full rows using rows=<field>:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 32)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#61 fixed CMT crashes with SEGV whan handling file paths longer than 256 bytes arnault Francesco.Prelz@…
Description

Acting on reports of ATLAS code consistently failing at the Milan site, I tracked down the failure to a stack corruption originating from CmtSystem::pwd.

Pathnames up to 4kbytes long are legal in Linux, and we accidentally found ourselves operating in a directory whose name is exactly 256 bytes long (257 with the terminating NULL).

The following code in cmt_system.cxx, still present in the CMT code tracker HEAD, causes a memory overwrite with undefined results whenever the contents of the PWD environment are longer or equal to 256 bytes.

64 cmt_string CmtSystem::pwd () 65 { 66 char buffer[256] = ""; 67 char* ptr = 0; 68 char* pwd_env = 0; 69 70 pwd_env = ::getenv ("PWD"); 71 72 if (pwd_env != 0) 73 { 74 strcpy (buffer, pwd_env); 75 }

In other calls used on Linux (getwd, realpath_) paths longer that 256 bytes are truncated with equally undefined results. The size of the fixed buffer should be set to at least PATH_MAX+1, if PATH_MAX is defined, or dynamic buffers should be used if possible (which is the case for the getenv() call above).

For the time being, we'll look for workarounds to make the directory names shorter: we have very little controls on the way they are built, however.

#57 fixed allow to run setup.csh from any place arnault Hubert.Degaudenzi@…
Description

We have a problem with the setup.[c]sh (setup.bat on windows) script which is produced by "cmt config" and I think this is a defect.

Without using the project paradigm, we could setup the runtime environment of a package simply by doing "source [path to package]/cmt/setup.csh". And everything was working fine, deduced from the CMTPATH variable.

Now with the CMTPROJECTPATH, we cannot do this anymore. If I do the previous command in a random directory (with a correct CMTPROJECTPATH) this will failed. The setup will not be done.

In order tout have the setup script run correctly, I have to go to the cmt directory of the package I want to setup and run the "source setup.csh" from there.

Kind regards,

Hubert

#56 fixed pacman installation of CMT fails if . not in PATH? arnault anonymous
Description

Hi,

I think the pacman kit of CMT can be made more portable if

. setup.sh

commands in it are replaced by

. ./setup.sh

When I run with the stock .pacman file on Ubuntu I'm getting Package tmp/cmt:trusted.caches:http://cern.ch/atlas-computing/links/kitsDirectory/CMT/pacman/cache:CMT not [installed]:

None of the following alternatives succeeded:

.: 1: setup.sh: not found .: 1: setup.sh: not found

this can be avoided by adding . on the PATH or by the change above. I think replacing . setup.sh with . ./setup.sh would be a better practice because the former depends on the way how the shell is invoked and what user already has in the PATH and anyway the intention is to source the setup in the current directory and nowhere else.

Another issue which might be revisited is the invocation of gmake command. I think most of the platforms capable of running Atlas/CMT have GNU make as make but they need not provide an alias gmake. One could modify CMT*.pacman

shellOutputContains ('. ./setup.sh; cmt version', 'v1r20p20070208')

OR shell ('. ./setup.sh; gmake') OR shell ('. ./setup.sh; make')

I think the risk of running of non-gnu make nowadays is much lower than failing because of executing a non-existing gmake instead of make. And of course one can easily test beforehand by make -v.

cheers

Jiri

1 2 3 4 5 6 7 8 9 10 11


See also: TracQuery, TracTickets, TracReports

Last modified 5 years ago Last modified on Jul 15, 2019, 9:40:48 AM