contrib/convert-repo
author Jim Hague <jim.hague@acm.org>
Thu, 01 Mar 2012 15:27:24 +0000
changeset 16223 ac4fd3238ead
parent 6365 1d3eb332f3cb
permissions -rwxr-xr-x
bugzilla: allow change comment to mark bugs fixed Add a second regular expression used when scanning change comments. Bugs matched by this new regular expression have the bug comments and optionally hours updated as with the first regular expression, but they are also marked as fixed. The bug status and resolution to set to mark a bug as fixed can be configured. By default status is set to RESOLVED and resolution to FIXED, the default Bugzilla settings. For example, a change comment containing 'Fixes 1234 h1.5' will be added to bug 1234, the bug will have its working time increased by 1.65 hours, and the bug will be marked RESOLVED/FIXED. Change comments may contain both bug update and fix instructions. If the same bug ID occurs in both, the last instruction found takes precedence. The patch adds new bug states 'bug_status' and 'resolution' and actions to update them to the XMLRPC and XMLRPC/email access methods. XMLRPC does not support marking bugs as fixed when used with Bugzilla versions prior to 4.0. When used with an earlier Bugzilla version, a warning is issued and only comment and hours updated.

#!/usr/bin/env python
#
# Wrapper script around the convert.py hgext extension
# for foreign SCM conversion to mercurial format.
#

import sys
from mercurial import ui, fancyopts
from hgext import convert

# Options extracted from the cmdtable
func, options, help = convert.cmdtable['convert']

# An ui instance
u = ui.ui()

opts = {}
args = []
try:
    args = list(fancyopts.fancyopts(sys.argv[1:], options, opts))
    args += [None]*(3 - len(args))
    src, dest, revmapfile = args
except (fancyopts.getopt.GetoptError, ValueError), inst:
    u.warn('Usage:\n%s\n' % help)
    sys.exit(-1)

convert.convert(u, src, dest, revmapfile, **opts)