add ChiselRepository

This commit is contained in:
Songmu 2024-11-09 11:27:22 +09:00
parent d311cb9071
commit 333c15314f
2 changed files with 25 additions and 0 deletions

View file

@ -19,6 +19,7 @@ export GHQ_ROOT=$tmpdir
ghq get www.mercurial-scm.org/repo/hello
ghq get https://launchpad.net/shutter
ghq get --vcs fossil https://www.sqlite.org/src
ghq get http://chiselapp.com/user/sti/repository/fossil-gui
ghq get --shallow --vcs=git-svn https://svn.apache.org/repos/asf/httpd/httpd
ghq get https://svn.apache.org/repos/asf/subversion
ghq get --shallow hub.darcs.net/byorgey/split
@ -28,6 +29,7 @@ export GHQ_ROOT=$tmpdir
test -d $tmpdir/www.mercurial-scm.org/repo/hello/.hg
test -d $tmpdir/launchpad.net/shutter/.bzr
test -f $tmpdir/www.sqlite.org/src/.fslckout
test -f $tmpdir/chiselapp.com/user/sti/repository/fossil-gui/.fslckout
test -d $tmpdir/svn.apache.org/repos/asf/httpd/httpd/.git/svn
test -d $tmpdir/svn.apache.org/repos/asf/subversion/.svn
test -d $tmpdir/hub.darcs.net/byorgey/split/_darcs
@ -35,7 +37,9 @@ export GHQ_ROOT=$tmpdir
: testing 'ghq list'
cat <<EOF | sort > $tmpdir/expect
chiselapp.com/user/sti/repository/fossil-gui
github.com/x-motemen/ghq
github.com/x-motemen/gore.git
www.mercurial-scm.org/repo/hello
launchpad.net/shutter
www.sqlite.org/src

View file

@ -134,6 +134,25 @@ func (repo *CodeCommitRepository) VCS() (*VCSBackend, *url.URL, error) {
return GitBackend, &u, nil
}
type ChiselRepository struct {
url *url.URL
}
// URL returns URL of the repository
func (repo *ChiselRepository) URL() *url.URL {
return repo.url
}
// IsValid determine if the repository is valid or not
func (repo *ChiselRepository) IsValid() bool {
return true
}
// VCS returns VCSBackend of the repository
func (repo *ChiselRepository) VCS() (*VCSBackend, *url.URL, error) {
return FossilBackend, repo.URL(), nil
}
// OtherRepository represents other repository
type OtherRepository struct {
url *url.URL
@ -219,6 +238,8 @@ func NewRemoteRepository(u *url.URL) (RemoteRepository, error) {
return &DarksHubRepository{u}
case "nest.pijul.com":
return &NestPijulRepository{u}
case "chiselapp.com":
return &ChiselRepository{u}
default:
return &OtherRepository{u}
}