MCPcopy
hub / github.com/django/django / check_trac_status

Function check_trac_status

scripts/pr_quality/check_pr.py:241–271  ·  view source on GitHub ↗

The referenced Trac ticket must be Accepted or Ready for checkin, unresolved, and assigned. ticket_data is the dict returned by fetch_trac_ticket(). Passing None skips the check (non-fatal fetch error). Passing TICKET_NOT_FOUND fails with a generic not-ready message.

(ticket_id, ticket_data)

Source from the content-addressed store, hash-verified

239
240
241def check_trac_status(ticket_id, ticket_data):
242 """The referenced Trac ticket must be Accepted or Ready for checkin,
243 unresolved, and assigned.
244
245 ticket_data is the dict returned by fetch_trac_ticket(). Passing None
246 skips the check (non-fatal fetch error). Passing TICKET_NOT_FOUND fails
247 with a generic not-ready message.
248 """
249 if ticket_data is None:
250 return None # Non-fatal fetch error; skip.
251 if ticket_data is TICKET_NOT_FOUND:
252 return Message(
253 *INVALID_TRAC_STATUS,
254 ticket_id=ticket_id,
255 current_state="ticket not found in Trac",
256 )
257 stage = ticket_data.get("custom", {}).get("stage", "").strip()
258 resolution = (ticket_data.get("resolution") or "").strip()
259 status = ticket_data.get("status", "").strip()
260 if stage in ALLOWED_STAGES and not resolution and status == "assigned":
261 return None
262 current_state = [
263 f"{stage=}" if stage not in ALLOWED_STAGES else "",
264 f"{resolution=}" if resolution else "",
265 f"{status=}" if status != "assigned" else "",
266 ]
267 return Message(
268 *INVALID_TRAC_STATUS,
269 ticket_id=ticket_id,
270 current_state=", ".join(s for s in current_state if s),
271 )
272
273
274def check_trac_has_patch(ticket_id, initial_data, poll_interval=1, poll_timeout=10):

Callers 1

mainFunction · 0.85

Calls 3

MessageClass · 0.90
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected