def git(registry, xml_parent, data):
 mappings = [('push-merge', 'pushMerge', False), ('push-only-if-success', 'pushOnlyIfSuccess', True), ('force-push', 'forcePush', False)]
 tag_mappings = [('remote', 'targetRepoName', 'origin'), ('name', 'tagName', None), ('message', 'tagMessage', ''), ('create-tag', 'createTag', False), ('update-tag', 'updateTag', False)]
 branch_mappings = [('remote', 'targetRepoName', 'origin'), ('name', 'branchName', None)]
 note_mappings = [('remote', 'targetRepoName', 'origin'), ('message', 'noteMsg', None), ('namespace', 'noteNamespace', 'master'), ('replace-note', 'noteReplace', False)]
 top = XML.SubElement(xml_parent, 'hudson.plugins.git.GitPublisher')
 XML.SubElement(top, 'configVersion').text = '2'
 helpers.convert_mapping_to_xml(top, data, mappings, fail_required=True)
 tags = data.get('tags', [])
 if tags:
  xml_tags = XML.SubElement(top, 'tagsToPush')
  for tag in tags:
   xml_tag = XML.SubElement(xml_tags, 'hudson.plugins.git.GitPublisher_-TagToPush')
   helpers.convert_mapping_to_xml(xml_tag, tag['tag'], tag_mappings, fail_required=True)
 branches = data.get('branches', [])
 if branches:
  xml_branches = XML.SubElement(top, 'branchesToPush')
  for branch in branches:
   xml_branch = XML.SubElement(xml_branches, 'hudson.plugins.git.GitPublisher_-BranchToPush')
   helpers.convert_mapping_to_xml(xml_branch, branch['branch'], branch_mappings, fail_required=True)
 notes = data.get('notes', [])
 if notes:
  xml_notes = XML.SubElement(top, 'notesToPush')
  for note in notes:
   xml_note = XML.SubElement(xml_notes, 'hudson.plugins.git.GitPublisher_-NoteToPush')
   helpers.convert_mapping_to_xml(xml_note, note['note'], note_mappings, fail_required=True)

def git ( registry , xml_parent , data ) : mappings = [ ( 'push-merge' , 'pushMerge' , False ) , ( 'push-only-if-success' , 'pushOnlyIfSuccess' , True ) , ( 'force-push' , 'forcePush' , False ) ] tag_mappings = [ ( 'remote' , 'targetRepoName' , 'origin' ) , ( 'name' , 'tagName' , None ) , ( 'message' , 'tagMessage' , '' ) , ( 'create-tag' , 'createTag' , False ) , ( 'update-tag' , 'updateTag' , False ) ] branch_mappings = [ ( 'remote' , 'targetRepoName' , 'origin' ) , ( 'name' , 'branchName' , None ) ] note_mappings = [ ( 'remote' , 'targetRepoName' , 'origin' ) , ( 'message' , 'noteMsg' , None ) , ( 'namespace' , 'noteNamespace' , 'master' ) , ( 'replace-note' , 'noteReplace' , False ) ] top = XML . SubElement ( xml_parent , 'hudson.plugins.git.GitPublisher' ) XML . SubElement ( top , 'configVersion' ) . text = '2' helpers . convert_mapping_to_xml ( top , data , mappings , fail_required = True ) tags = data . get ( 'tags' , [ ] ) if tags : xml_tags = XML . SubElement ( top , 'tagsToPush' ) for tag in tags : xml_tag = XML . SubElement ( xml_tags , 'hudson.plugins.git.GitPublisher_-TagToPush' ) helpers . convert_mapping_to_xml ( xml_tag , tag [ 'tag' ] , tag_mappings , fail_required = True ) branches = data . get ( 'branches' , [ ] ) if branches : xml_branches = XML . SubElement ( top , 'branchesToPush' ) for branch in branches : xml_branch = XML . SubElement ( xml_branches , 'hudson.plugins.git.GitPublisher_-BranchToPush' ) helpers . convert_mapping_to_xml ( xml_branch , branch [ 'branch' ] , branch_mappings , fail_required = True ) notes = data . get ( 'notes' , [ ] ) if notes : xml_notes = XML . SubElement ( top , 'notesToPush' ) for note in notes : xml_note = XML . SubElement ( xml_notes , 'hudson.plugins.git.GitPublisher_-NoteToPush' ) helpers . convert_mapping_to_xml ( xml_note , note [ 'note' ] , note_mappings , fail_required = True )
most git commands play nicer without a tty .