'Update the title with the current branch and directory name.'

def refresh(self):

    alerts = []
    branch = self.model.currentbranch
    curdir = core.getcwd()
    is_merging = self.model.is_merging
    is_rebasing = self.model.is_rebasing
    msg = (N_(u'Repository:    %s') % curdir)
    msg += u'\n'
    msg += (N_(u'Branch:    %s') % branch)
    if is_rebasing:
        msg += u'\n\n'
        msg += N_(u'This    repository    is    currently    being    rebased.\nResolve    conflicts,    commit    changes,    and    run:\n                Rebase    >    Continue')
        alerts.append(N_(u'Rebasing'))
    elif is_merging:
        msg += u'\n\n'
        msg += N_(u'This    repository    is    in    the    middle    of    a    merge.\nResolve    conflicts    and    commit    changes.')
        alerts.append(N_(u'Merging'))
    if (self.mode == self.model.mode_amend):
        alerts.append(N_(u'Amending'))
        self.commit_amend_action.setChecked(True)
    else:
        self.commit_amend_action.setChecked(False)
    l = unichr(171)
    r = unichr(187)
    title = (u'%s:    %s    %s%s' % (self.model.project, branch, ((alerts and ((((r + u'    %s    ') + l) + u'    ') % u',    '.join(alerts))) or u''), self.model.git.worktree()))
    self.setWindowTitle(title)
    self.commitdockwidget.setToolTip(msg)
    self.commitmsgeditor.set_mode(self.mode)
    self.update_actions()
