* This also involved adding support for plain diffs against arbitrary refs.
after diff_plain => sub {
my ($self, $c) = @_;
$self->_diff($c);
- $c->response->content_type('text/plain; charset=utf-8');
};
after tree => sub {
my $compare = $c->req->param('hbp') || $c->req->param('hp');
return '/ref/diff', [$repos, $ref], $compare, $c->req->param('f');
},
+ blobdiff_plain => sub {
+ my($c, $action, $repos) = @_;
+ my $ref = $c->req->param('hb') || $c->req->param('h');
+ my $compare = $c->req->param('hbp') || $c->req->param('hp');
+ return '/ref/diff_plain', [$repos, $ref], $compare, $c->req->param('f');
+ },
);
sub _legacy_uri {
sub diff_fancy : Chained('diff') PathPart('') Args() {
my($self, $c, $comparison, @rest) = @_;
# FIXME - This ain't pretty
- $c->stash->{parent} = $comparison
+ $c->stash(parent => $comparison)
if $comparison;
- $c->stash->{filename} = $rest[0]
+ $c->stash(filename => $rest[0])
if @rest;
}
-sub diff_plain : Chained('diff') PathPart('plain') Args(0) {
- my($self, $c) = @_;
- $c->stash->{no_wrapper} = 1;
+sub diff_plain : Chained('diff') PathPart('plain') Args() {
+ my($self, $c, $comparison, @rest) = @_;
+ # FIXME - This ain't pretty
+ $c->stash(parent => $comparison)
+ if $comparison;
+ $c->stash(filename => $rest[0])
+ if @rest;
+ $c->stash(no_wrapper => 1);
+ $c->response->content_type('text/plain; charset=utf-8');
}
sub commit : Chained('find') PathPart('commit') Args(0) {}
test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
test('/', 'a=blobdiff;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=refs/heads/master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
-{
-
- local $TODO = 'FIXME';
-
test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=36c6c6708b8360d7023e8a1649c45bcf9b3bd818;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=3f7567c7bdf7e7ebf410926493b92d398333116e;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=HEAD;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
test('/', 'a=blobdiff_plain;f=file1;h=5716ca5987cbf97d6bb54920bea6adde242d87e6;hp=257cc5642cb1a054f08cc83f2d943e56fd3ebe99;hb=master;hpb=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');
+{
+
+ local $TODO = 'FIXME';
+
test('/', 'a=commit');
test('/', 'a=commit;h=36c6c6708b8360d7023e8a1649c45bcf9b3bd818');
test('/', 'a=commit;h=3bc0634310b9c62222bb0e724c11ffdfb297b4ac');