'Creates a branch; called by the "Create Branch" button'

def create_branch(self):

    self.getopts()
    revision = self.opts.revision
    branch = self.opts.branch
    no_update = self.no_update_radio.isChecked()
    ffwd_only = self.ffwd_only_radio.isChecked()
    existing_branches = gitcmds.branch_list()
    check_branch = False
    if ((not branch) or (not revision)):
        qtutils.critical(N_(u'Missing    Data'), N_(u'Please    provide    both    a    branch    name    and    revision    expression.'))
        return
    if (branch in existing_branches):
        if no_update:
            msg = (N_(u'Branch    "%s"    already    exists.') % branch)
            qtutils.critical(N_(u'Branch    Exists'), msg)
            return
        commits = gitcmds.rev_list_range(revision, branch)
        check_branch = bool(commits)
    if check_branch:
        msg = (N_(u'Resetting    "%(branch)s"    to    "%(revision)s"    will    lose    commits.') % dict(branch=branch, revision=revision))
        if ffwd_only:
            qtutils.critical(N_(u'Branch    Exists'), msg)
            return
        lines = [msg]
        for (idx, commit) in enumerate(commits):
            subject = commit[1][0:min(len(commit[1]), 16)]
            if (len(subject) < len(commit[1])):
                subject += u'...'
            lines.append((((u' DCTB ' + commit[0][:8]) + u' DCTB ') + subject))
            if (idx >= 5):
                skip = (len(commits) - 5)
                lines.append((u' DCTB (%s)' % (N_(u'%d    skipped') % skip)))
                break
        line = N_(u'Recovering    lost    commits    may    not    be    easy.')
        lines.append(line)
        info_text = (N_(u'Reset    "%(branch)s"    to    "%(revision)s"?') % dict(branch=branch, revision=revision))
        if (not qtutils.confirm(N_(u'Reset    Branch?'), u'\n'.join(lines), info_text, N_(u'Reset    Branch'), default=False, icon=icons.undo())):
            return
    title = N_(u'Create    Branch')
    label = N_(u'Updating')
    self.progress = ProgressDialog(title, label, self)
    self.progress.show()
    self.thread.start()
