Exemplo n.º 1
0
    def dir_feed(self, dir):
        xmldoc, dfeed = feed.atom.new_xmldoc_feed()
        dfeed.title = settings.blog_name + " " + dir
        dfeed.id = settings.blog_url + '/' + dir # << url for feed
        dfeed.updated = self.atom_date(dir)
        links = feed.atom.Link(settings.blog_url) # << url to home.
        dfeed.links.append(links)
        selflink = feed.atom.Link(settings.blog_url + '/' + dir + '.atom')
        selflink.attrs['rel'] = "self"
        dfeed.links.append(selflink)

        for a in self.atom_authors(dir):
            author = feed.atom.Author(a)
            dfeed.authors.append(author)
        
        (eout, eerr) = git.ls(file=dir, name=True)
        for e in eout:
            if dir != '':
                e = dir + '/' + e
            entry = feed.atom.Entry()
            (entryc, ecerr) = git.show(e)
            entry.content = "<![CDATA[\n" + entryc + "\n]]>"
            entry.title = entryc.splitlines()[0]
            entry.id = settings.blog_url + '/' + e
            entry.updated = self.atom_date(e.lstrip('/'))

            dfeed.entries.append(entry)

        return str(xmldoc)
Exemplo n.º 2
0
 def _show_time(self):
     commit_label = self._builder.get_object('CommitLabel')
     sha_entry = self._builder.get_object('ShaEntry')
     data = settings.load_settings()
     git_dir = data['directory']
     commit_text = git.show(git_dir, sha_entry.get_text())
     commit_label.set_text(commit_text)
Exemplo n.º 3
0
def get_commands(ref_name, file_name):
    return {
        'path': file_name,
        'commands': {
            get_command_name(line): i
            for i, line in enumerate(
                git.show('%s:%s' % (ref_name, file_name)).split('\n'), 1)
            if line.find('<command') != -1
        }
    }
Exemplo n.º 4
0
 def GET(self, file):
     file = file.rstrip('/')
     (out, ret) = git.type(file)
     if ret == 128:
         web.webapi.notfound()
     elif out == 'blob':
         (fout, fret) = git.show(file)
         (templ, dict) = get_dict(fout)
         templ = tenv.get_template(templ)
         print templ.render(dict)
     elif out == 'tree':
         print dirify(file, git.ls(file)[0])
     else:
         web.webapi.notfound()
Exemplo n.º 5
0
 def _following_commits(self, commit):
     git = self.git
     try:
         commit_date = git.show(commit, s=True, format="%ct")
     except GitCommandError:
         return tuple()
     until_date = int(commit_date) + self.fixup_seconds
     following_commits = git.rev_list(commit + '..',
                                      until=str(until_date),
                                      since=str(commit_date),
                                      no_merges=True)
     following_commits = following_commits.split('\n')
     # chronological order
     following_commits.reverse()
     return tuple(following_commits)
 def _following_commits(self, commit):
     git = self.git
     try:
         commit_date = git.show(commit, s=True, format="%ct")
     except GitCommandError:
         return tuple()
     until_date = int(commit_date) + self.fixup_seconds
     following_commits = git.rev_list(commit + '..',
                                      until=str(until_date),
                                      since=str(commit_date),
                                      no_merges=True)
     following_commits = following_commits.split('\n')
     # chronological order
     following_commits.reverse()
     return tuple(following_commits)
def date_from_git_objects(run, objects: Iterable[str]) -> List[int]:
    cmd = show(objects=objects, diff=False, format='%at')
    proc = run(cmd)
    stdout = proc_to_stdout(proc)
    return list(int(line) for line in stdout)
Exemplo n.º 8
0
def get_code(*, git, revision, file):
    return git.show('{}:{}'.format(revision, file))
Exemplo n.º 9
0
def test_show_format():
    assert show(format="%at") == ["git", "show", "--format=%at"]
Exemplo n.º 10
0
def test_show_no_diff():
    assert show(diff=False) == ["git", "show", "-s"]
Exemplo n.º 11
0
def test_show_objects():
    assert show(objects=('master',
                         'feature')) == ["git", "show", "master", "feature"]
Exemplo n.º 12
0
def test_show():
    assert show() == ["git", "show"]
Exemplo n.º 13
0
def load_template(templ):
    (res, err) = git.show(settings.templates + '/' + templ)
    return res
Exemplo n.º 14
0
def get_git_file_property(commit, file_name, property):
    lines = git.show('%s:%s' % (commit, file_name)).split('\n')
    lines = [line.strip() for line in lines if line.find(property) > -1]
    return lines[0].split('=')[1] if len(lines) > 0 else None
Exemplo n.º 15
0
def get_code(*, git, revision, file):
    return git.show('{}:{}'.format(revision, file))