Exemple #1
0
    def commit_set(self, repo, commit):
        self.repo = repo
        self.commit = commit

        self.diff_list.clear()
        self.diff_entry.text = ''

        if commit.sha:
            # a real commit
            text = u'<name>{0}</name>  <b>{1}</b>  {2}<br>' \
                '<bigger><b>{3}</b></bigger>'.format(commit.sha[:9],
                commit.author, format_date(commit.commit_date), commit.title)
            if commit.message:
                msg = commit.message.strip().replace('\n', '<br>')
                text += u'<br><br>{}'.format(msg)
            repo.request_changes(self.changes_done_cb, commit1=commit)
            self.update_action_buttons(['revert'])
        else:
            # or the fake 'local changes' commit
            text = "<bigger><b>Local changes</b></bigger>"
            self.show_local_status()
            self.update_action_buttons(['commit', 'discard'])

        self.entry.text = text
        self.picture.email_set(commit.author_email)
Exemple #2
0
    def __init__(self, parent, repo, commit):
        self.repo = repo
        self.commit = commit

        Table.__init__(self, parent,  padding=(5,5))
        self.show()

        pic = GravatarPict(self)
        pic.email_set(commit.author_email)
        self.pack(pic, 0, 0, 1, 1)
        pic.show()

        text = u'<name>{}</name>  <b>{}</b>  {}<br><br>{}'.format(commit.sha[:9],
                commit.author, format_date(commit.commit_date), commit.title)
        en = Entry(self, text=text)
        en.line_wrap = ELM_WRAP_NONE
        en.size_hint_weight = EXPAND_BOTH
        en.size_hint_align = FILL_BOTH
        self.pack(en, 1, 0, 1, 1)
        en.show()
Exemple #3
0
    def update(self, idx):
        self.idx = idx
        self.stash = self.app.repo.stash[idx]
        stash_len = len(self.app.repo.stash)

        self.title = self.stash.ref

        self.title_entry.text = \
            '<name>Stash item</> #{}   <name>Created</> {}<br>' \
            '<subtitle>{}</>'.format(idx,
            format_date(self.stash.ts), self.stash.desc)

        self.nav_label.text = \
            '{} {}<br>in the stash'.format(stash_len,
            'items' if stash_len > 1 else 'item')

        self.prev_btn.disabled = (idx == 0)
        self.next_btn.disabled = (idx >= stash_len - 1)

        self.diff_entry.loading_set()
        self.app.repo.stash_request_diff(self._diff_done_cb, self.stash)
Exemple #4
0
    def show_commit(self, commit):
        self.commit = commit

        self.picture.email_set(commit.author_email)
        line1 = '<name>{}</name>  <b>{}</b>  {}<br>'.format(commit.sha[:9],
                 commit.author, format_date(commit.commit_date))
        line2 = line3 = line4 = ''
        if commit.committer and commit.committer != commit.author:
            line2 = '<name>Committed by:</name> <b>{}</b><br>'.format(
                     commit.committer)
        if commit.title:
            line3 = '<bigger><b>{}</b></bigger><br>'.format(
                    utf8_to_markup(commit.title.strip()))
        if commit.message:
            line4 = '<br>{}'.format(utf8_to_markup(commit.message.strip()))
        text = line1 + line2 + line3 + line4
        self.entry.text = text

        self.update_action_buttons(['checkout', 'revert', 'cherrypick'])
        self.diff_entry.text = ''
        self.diff_list.clear()
        self.app.repo.request_changes(self._changes_done_cb, commit1=commit)