예제 #1
0
def open_patcher_portal():
    fix_id = None
    fix_name = None

    if current_branch.find('patcher-') == 0:
        fix_id = current_branch[len('patcher-'):]
    elif current_branch.find('fix-pack-fix-') == 0:
        fix_id = current_branch[len('fix-pack-fix-'):]

    for typeFilter in ['0', '1', '6', '2']:
        if fix_id is None:
            fix_id, fix_name = get_fix_id(typeFilter)

    if fix_id is None:
        print('No existing fix to update, opening window for a new fix...')
        base_url = 'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/fixes/create'
    else:
        print('Opening window to update fix %s...' % fix_id)
        base_url = 'https://patcher.liferay.com/group/guest/patching/-/osb_patcher/fixes/%s/edit' % fix_id

    product_version, project_version = get_baseline_id()

    origin_name = sys.argv[1]

    parameters = {
        'patcherProductVersionId': product_version,
        'patcherProjectVersionId': project_version,
        'committish': current_branch,
        'gitRemoteURL': origin_name
    }

    if fix_name is not None:
        parameters['patcherFixName'] = fix_name
    elif fix_id is not None:
        parameters['patcherFixName'] = get_fix_name_from_id(fix_id)
    else:
        pattern = re.compile('LP[EPS]-[0-9]*')
        fixes = set()

        for line in git.log('%s..%s' % (base_tag, 'HEAD'),
                            '--pretty=%s').split('\n'):
            fixes.update(pattern.findall(line))

        parameters['patcherFixName'] = ','.join(sorted(fixes))

    namespaced_parameters = get_namespaced_parameters(
        '1_WAR_osbpatcherportlet', parameters)

    query_string = '&'.join([
        '%s=%s' % (key, value) for key, value in namespaced_parameters.items()
    ])
    webbrowser.open_new_tab('%s?%s' % (base_url, query_string))
예제 #2
0
def get_candidate_fix_names():
	pattern = re.compile('LP[EPS]-[0-9]*')

	if current_branch.find('LPE-') == 0 or current_branch.find('LPP-') == 0 or current_branch.find('LPS-') == 0:
		yield ','.join(sorted(pattern.findall(current_branch)))

	fixes = set()

	for line in git.log('%s..%s' % (base_tag, 'HEAD'), '--pretty=%s').split('\n'):
		fixes.update(pattern.findall(line))

	if len(fixes) > 0:
		yield ','.join(sorted(fixes))