Mercurial > pub > buggler
comparison bug-list.xsl @ 10:14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
author | cin |
---|---|
date | Mon, 07 Sep 2015 01:37:11 +0300 |
parents | 2a5f38eb25a9 |
children | 4eb9fdf4efa9 |
comparison
equal
deleted
inserted
replaced
9:cc7244ab1b9f | 10:14a966369278 |
---|---|
20 <xsl:variable name="resources" | 20 <xsl:variable name="resources" |
21 select="document('resources.xml')/resources/resource" /> | 21 select="document('resources.xml')/resources/resource" /> |
22 | 22 |
23 <xsl:variable name="bugs" select="/bugzilla/bug" /> | 23 <xsl:variable name="bugs" select="/bugzilla/bug" /> |
24 | 24 |
25 <xsl:key name="bugid" match="/bugzilla/bug" use="string(bug_id)" /> | 25 <xsl:key name="bugid" match="/bugzilla/bug" use="string(id)" /> |
26 | 26 |
27 <xsl:variable name="roots" select="$bugs[not(blocked[key('bugid',.)])]" /> | 27 <xsl:variable name="roots" select="$bugs[not(blocks[key('bugid',.)])]" /> |
28 | 28 |
29 <!-- BUILD BUG TREE --> | 29 <!-- BUILD BUG TREE --> |
30 <xsl:variable name="tree"> | 30 <xsl:variable name="tree"> |
31 <xsl:apply-templates mode="tree" select="$roots" /> | 31 <xsl:apply-templates mode="tree" select="$roots" /> |
32 </xsl:variable> | 32 </xsl:variable> |
33 | 33 |
34 <xsl:template match="bug" mode="tree"> | 34 <xsl:template match="bug" mode="tree"> |
35 <xsl:element name="bug"> | 35 <xsl:element name="bug"> |
36 <xsl:attribute name="id"><xsl:value-of select="bug_id" /></xsl:attribute> | 36 <xsl:attribute name="id"><xsl:value-of select="id" /></xsl:attribute> |
37 <xsl:if test="component = 'product' or not(number(estimated_time))"> | 37 <xsl:if test="component = 'product' or not(number(estimated_time))"> |
38 <xsl:attribute name="group"><xsl:value-of select="boolean(1)" /></xsl:attribute> | 38 <xsl:attribute name="group"><xsl:value-of select="boolean(1)" /></xsl:attribute> |
39 </xsl:if> | 39 </xsl:if> |
40 <xsl:for-each select="dependson"> | 40 <xsl:for-each select="depends_on"> |
41 <xsl:apply-templates mode="tree" select="key('bugid', .)" /> | 41 <xsl:apply-templates mode="tree" select="key('bugid', .)" /> |
42 </xsl:for-each> | 42 </xsl:for-each> |
43 </xsl:element> | 43 </xsl:element> |
44 </xsl:template> | 44 </xsl:template> |
45 | 45 |
47 <xsl:variable name="relations"> | 47 <xsl:variable name="relations"> |
48 <xsl:apply-templates select="$bugs" mode="relations" /> | 48 <xsl:apply-templates select="$bugs" mode="relations" /> |
49 </xsl:variable> | 49 </xsl:variable> |
50 | 50 |
51 <xsl:template match="bug" mode="relations"> | 51 <xsl:template match="bug" mode="relations"> |
52 <xsl:variable name="bugid" select="string(bug_id)" /> | 52 <xsl:variable name="bugid" select="string(id)" /> |
53 <bug id="{$bugid}"> | 53 <bug id="{$bugid}"> |
54 <!-- calculate all palaces where the same node appears --> | 54 <!-- calculate all palaces where the same node appears --> |
55 <xsl:apply-templates select="exsl:node-set($tree)//bug[@id = $bugid]" | 55 <xsl:apply-templates select="exsl:node-set($tree)//bug[@id = $bugid]" |
56 mode="traverse-relations"> | 56 mode="traverse-relations"> |
57 </xsl:apply-templates> | 57 </xsl:apply-templates> |
104 </xsl:choose> | 104 </xsl:choose> |
105 </xsl:variable> | 105 </xsl:variable> |
106 | 106 |
107 <!-- applied in context of the bugzilla document --> | 107 <!-- applied in context of the bugzilla document --> |
108 <xsl:template match="bug" mode="structure"> | 108 <xsl:template match="bug" mode="structure"> |
109 <xsl:variable name="id" select="string(bug_id)" /> | 109 <xsl:variable name="id" select="string(id)" /> |
110 <xsl:variable name="self" select="." /> | 110 <xsl:variable name="self" select="." /> |
111 <xsl:variable name="children" | 111 <xsl:variable name="children" |
112 select="exsl:node-set($parents)/bug[@parent = $id]" /> | 112 select="exsl:node-set($parents)/bug[@parent = $id]" /> |
113 <xsl:element name="bug"> | 113 <xsl:element name="bug"> |
114 <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute> | 114 <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute> |
115 <xsl:attribute name="desc"><xsl:value-of select="short_desc" /></xsl:attribute> | 115 <xsl:attribute name="desc"><xsl:value-of select="summary" /></xsl:attribute> |
116 | 116 |
117 <xsl:if test="$children"> | 117 <xsl:if test="$children"> |
118 <xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute> | 118 <xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute> |
119 | 119 |
120 <xsl:for-each select="$children"> | 120 <xsl:for-each select="$children"> |
121 <xsl:variable name="child" select="@id" /> | 121 <xsl:variable name="child" select="@id" /> |
122 <xsl:apply-templates select="$bugs[bug_id = $child]" | 122 <xsl:apply-templates select="$bugs[id = $child]" |
123 mode="structure" /> | 123 mode="structure" /> |
124 </xsl:for-each> | 124 </xsl:for-each> |
125 | 125 |
126 </xsl:if> | 126 </xsl:if> |
127 | 127 |
128 <!-- filter out dependencies --> | 128 <!-- filter out dependencies --> |
129 <!-- exclude children, and missing bugs --> | 129 <!-- exclude children, and missing bugs --> |
130 <xsl:variable name="dependencies" | 130 <xsl:variable name="dependencies" |
131 select="dependson[not(text() = exsl:node-set($parents)/bug/parent[@id=$id]/@bugid)][key('bugid', .)]" /> | 131 select="depends_on[not(text() = exsl:node-set($parents)/bug/parent[@id=$id]/@bugid)][key('bugid', .)]" /> |
132 <xsl:for-each select="$dependencies"> | 132 <xsl:for-each select="$dependencies"> |
133 <dependency id="{.}" /> | 133 <dependency id="{.}" /> |
134 </xsl:for-each> | 134 </xsl:for-each> |
135 </xsl:element> | 135 </xsl:element> |
136 </xsl:template> | 136 </xsl:template> |
145 | 145 |
146 <xsl:template match="bug"> | 146 <xsl:template match="bug"> |
147 <xsl:param name="indent" select="0" /> | 147 <xsl:param name="indent" select="0" /> |
148 <xsl:param name="chargeset" /> | 148 <xsl:param name="chargeset" /> |
149 <xsl:variable name="id" select="@id" /> | 149 <xsl:variable name="id" select="@id" /> |
150 <xsl:variable name="details" select="$bugs[bug_id = $id]" /> | 150 <xsl:variable name="details" select="$bugs[id = $id]" /> |
151 <xsl:variable name="hasTime" | 151 <xsl:variable name="hasTime" |
152 select="number($details/estimated_time) or number($details/actual_time) or number($details/remaining_time)" /> | 152 select="number($details/estimated_time) or number($details/actual_time) or number($details/remaining_time)" /> |
153 | 153 |
154 <!-- task header --> | 154 <!-- task header --> |
155 <xsl:call-template name="start-task"> | 155 <xsl:call-template name="start-task"> |