From dd3ff54154f7a771da07c10f500e3033c8ce71bc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 14 Jan 2016 00:47:28 +0000 Subject: [PATCH] repobrowse: queries are VCS-specific While we want to keep a consistent set of parameters across different VCSes, we cannot expect users of non-git VCSes to use the same parameter names which make sense for git users. --- lib/PublicInbox/RepobrowseBase.pm | 2 +- lib/PublicInbox/RepobrowseGitBlob.pm | 2 +- lib/PublicInbox/RepobrowseGitCommit.pm | 2 +- lib/PublicInbox/RepobrowseGitLog.pm | 2 +- lib/PublicInbox/RepobrowseGitPatch.pm | 2 +- lib/PublicInbox/RepobrowseGitPlain.pm | 2 +- lib/PublicInbox/{RepobrowseQuery.pm => RepobrowseGitQuery.pm} | 2 +- lib/PublicInbox/RepobrowseGitTag.pm | 2 +- lib/PublicInbox/RepobrowseGitTree.pm | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) rename lib/PublicInbox/{RepobrowseQuery.pm => RepobrowseGitQuery.pm} (95%) diff --git a/lib/PublicInbox/RepobrowseBase.pm b/lib/PublicInbox/RepobrowseBase.pm index 06381b2a3..60da2d948 100644 --- a/lib/PublicInbox/RepobrowseBase.pm +++ b/lib/PublicInbox/RepobrowseBase.pm @@ -3,7 +3,7 @@ package PublicInbox::RepobrowseBase; use strict; use warnings; -require PublicInbox::RepobrowseQuery; +require PublicInbox::RepobrowseGitQuery; use PublicInbox::Hval; sub new { bless {}, shift } diff --git a/lib/PublicInbox/RepobrowseGitBlob.pm b/lib/PublicInbox/RepobrowseGitBlob.pm index 273a10186..e890ae847 100644 --- a/lib/PublicInbox/RepobrowseGitBlob.pm +++ b/lib/PublicInbox/RepobrowseGitBlob.pm @@ -12,7 +12,7 @@ our @EXPORT = qw(git_blob_mime_type git_blob_stream_response); sub call_git_blob { my ($self, $req) = @_; my $git = $req->{repo_info}->{git}; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $id = $q->{id}; $id eq '' and $id = 'HEAD'; diff --git a/lib/PublicInbox/RepobrowseGitCommit.pm b/lib/PublicInbox/RepobrowseGitCommit.pm index b3973392c..5c8407b2d 100644 --- a/lib/PublicInbox/RepobrowseGitCommit.pm +++ b/lib/PublicInbox/RepobrowseGitCommit.pm @@ -118,7 +118,7 @@ sub git_commit_stream { sub call_git_commit { my ($self, $req) = @_; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $id = $q->{id}; $id eq '' and $id = 'HEAD'; my $git = $req->{repo_info}->{git}; diff --git a/lib/PublicInbox/RepobrowseGitLog.pm b/lib/PublicInbox/RepobrowseGitLog.pm index 5d2c855cc..4c1697075 100644 --- a/lib/PublicInbox/RepobrowseGitLog.pm +++ b/lib/PublicInbox/RepobrowseGitLog.pm @@ -19,7 +19,7 @@ sub call_git_log { $max = int($max); $max = 50 if $max == 0; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $h = $q->{h}; $h eq '' and $h = 'HEAD'; diff --git a/lib/PublicInbox/RepobrowseGitPatch.pm b/lib/PublicInbox/RepobrowseGitPatch.pm index 7f03864e4..4cb059607 100644 --- a/lib/PublicInbox/RepobrowseGitPatch.pm +++ b/lib/PublicInbox/RepobrowseGitPatch.pm @@ -15,7 +15,7 @@ my $sig = '--signature=git '.join(' ', @CMD); sub call_git_patch { my ($self, $req) = @_; my $git = $req->{repo_info}->{git}; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $id = $q->{id}; $id =~ /\A[\w-]+([~\^][~\^\d])*\z/ or $id = 'HEAD'; diff --git a/lib/PublicInbox/RepobrowseGitPlain.pm b/lib/PublicInbox/RepobrowseGitPlain.pm index ebb4f3972..89788a107 100644 --- a/lib/PublicInbox/RepobrowseGitPlain.pm +++ b/lib/PublicInbox/RepobrowseGitPlain.pm @@ -10,7 +10,7 @@ use PublicInbox::Hval qw(utf8_html); sub call_git_plain { my ($self, $req) = @_; my $git = $req->{repo_info}->{git}; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $id = $q->{id}; $id eq '' and $id = 'HEAD'; diff --git a/lib/PublicInbox/RepobrowseQuery.pm b/lib/PublicInbox/RepobrowseGitQuery.pm similarity index 95% rename from lib/PublicInbox/RepobrowseQuery.pm rename to lib/PublicInbox/RepobrowseGitQuery.pm index e9c5153f8..018b20c92 100644 --- a/lib/PublicInbox/RepobrowseQuery.pm +++ b/lib/PublicInbox/RepobrowseGitQuery.pm @@ -2,7 +2,7 @@ # License: AGPL-3.0+ # query parameter management for repobrowse -package PublicInbox::RepobrowseQuery; +package PublicInbox::RepobrowseGitQuery; use strict; use warnings; use PublicInbox::Hval; diff --git a/lib/PublicInbox/RepobrowseGitTag.pm b/lib/PublicInbox/RepobrowseGitTag.pm index 13af0a348..ebda729eb 100644 --- a/lib/PublicInbox/RepobrowseGitTag.pm +++ b/lib/PublicInbox/RepobrowseGitTag.pm @@ -18,7 +18,7 @@ my %cmd_map = ( # type => action sub call_git_tag { my ($self, $req) = @_; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $h = $q->{h}; $h eq '' and return sub { my ($res) = @_; diff --git a/lib/PublicInbox/RepobrowseGitTree.pm b/lib/PublicInbox/RepobrowseGitTree.pm index 13ded634d..e8012dde3 100644 --- a/lib/PublicInbox/RepobrowseGitTree.pm +++ b/lib/PublicInbox/RepobrowseGitTree.pm @@ -20,7 +20,7 @@ sub git_tree_stream { my ($self, $req, $res) = @_; # res: Plack callback my @extra = @{$req->{extra}}; my $git = $req->{repo_info}->{git}; - my $q = PublicInbox::RepobrowseQuery->new($req->{cgi}); + my $q = PublicInbox::RepobrowseGitQuery->new($req->{cgi}); my $id = $q->{id}; if ($id eq '') { chomp($id = $git->qx(qw(rev-parse --short=10 HEAD))); -- 2.47.3