Example #1
0
    def _ctx_to_commit(self, ctx):
        diff = generate_unified_diff(self, ctx.files(),
                                     ctx.parents()[0].rev(), ctx.rev())

        return Commit(ctx.rev(), ctx.user(),
                      datetime.fromtimestamp(ctx.date()[0]), ctx.description(),
                      ctx.files(), diff)
Example #2
0
    def _ctx_to_commit(self, ctx):
        diff = generate_unified_diff(self, ctx.files(), ctx.parents()[0].rev(), ctx.rev())

        return Commit(ctx.rev(),
                      ctx.user(),
                      datetime.fromtimestamp(ctx.date()[0]),
                      ctx.description(),
                      ctx.files(),
                      diff)
Example #3
0
 def get_commit_by_id(self, commit_id):
     try:
         commit = self._get_commit(commit_id)
         parent = commit.parents[0] if len(commit.parents) else 'NULL'
         files = self._diff_files(commit.id, parent)
         return Commit(commit.id, commit.author,
             datetime.fromtimestamp(commit.commit_time), commit.message, files,
             lambda: generate_unified_diff(self, files, parent, commit.id))
     except KeyError:
         return None