Skip to content

Commit 9427e11

Browse files
authored
Merge branch 'master' into testcov/889
2 parents cf01f79 + 2fb1fcd commit 9427e11

23 files changed

Lines changed: 147 additions & 63 deletions

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Errors now report the repository causing the error, if possible.
12+
- Now non rooted siva files support old siva rooted repositories.
13+
14+
## [0.22.0] - 2019-07-03
15+
16+
### Added
17+
18+
- Now gitbase uses [go-borges](https://github.com/src-d/go-borges) to access repositories
19+
- The type of files in each directory has to be specified ([#867](https://github.com/src-d/gitbase/pull/867))
20+
- Supports new rooted repository format and separates references and objects from each repo (https://github.com/src-d/borges/issues/389)
21+
22+
### Changed
23+
24+
- Changed cli to be able to specify different formats ([#866](https://github.com/src-d/gitbase/issues/866))
25+
26+
### Fixed
27+
28+
- function: correctly transform up explode nodes ([#757](https://github.com/src-d/go-mysql-server/pull/757))
29+
- git libraries bare or non bare format is automatically detected ([#897](https://github.com/src-d/gitbase/pull/897))
30+
- Fix bug that created multiple object cache with incorrect size ([#898](https://github.com/src-d/gitbase/pull/898))
31+
- sql/expression: handle null values in arithmetic expressions ([#760](https://github.com/src-d/go-mysql-server/pull/760))
32+
- Panic on query using EXPLODE ([#755](https://github.com/src-d/go-mysql-server/issues/755))
33+
- Fixed error iterating over non ready repositories ([src-d/go-borges#54](https://github.com/src-d/go-borges/pull/54))
34+
- Error saying value could not be converted to bool.
35+
- function: make array_length not fail with literal null ([#767](https://github.com/src-d/go-mysql-server/pull/767))
36+
- server: kill queries on connection closed (([#769](https://github.com/src-d/go-mysql-server/pull/769)))
37+
938
## [0.22.0-rc2] - 2019-06-24
1039

1140
### Fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
**gitbase**, is a SQL database interface to Git repositories.
44

5-
This project is now part of [source{d} Engine](https://sourced.tech/engine),
5+
This project is now part of [source{d} Community Edition](https://sourced.tech/products/community-edition/),
66
which provides the simplest way to get started with a single command.
7-
Visit [sourced.tech/engine](https://sourced.tech/engine) for more information.
7+
Visit [https://docs.sourced.tech/community-edition](https://docs.sourced.tech/community-edition) for more information.
88

99
It can be used to perform SQL queries about the Git history and
1010
about the [Universal AST](https://doc.bblf.sh/) of the code itself. gitbase is being built to work on top of any number of git repositories.

blobs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ func (r *blobsTable) PartitionRows(
143143

144144
if err != nil {
145145
span.Finish()
146-
return nil, err
146+
return nil, errorWithRepo(repo, err)
147147
}
148148

149-
return sql.NewSpanIter(span, iter), nil
149+
return sql.NewSpanIter(span, newRepoRowIter(repo, iter)), nil
150150
}
151151

152152
func (blobsTable) HandledFilters(filters []sql.Expression) []sql.Expression {

cmd/gitbase/command/server.go

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/sirupsen/logrus"
2121
"github.com/src-d/go-borges"
2222
"github.com/src-d/go-borges/libraries"
23+
"github.com/src-d/go-borges/oldsiva"
2324
"github.com/src-d/go-borges/plain"
2425
"github.com/src-d/go-borges/siva"
2526
sqle "github.com/src-d/go-mysql-server"
@@ -227,7 +228,7 @@ func (c *Server) buildDatabase() error {
227228

228229
c.sharedCache = cache.NewObjectLRU(c.CacheSize * cache.MiByte)
229230

230-
c.rootLibrary = libraries.New(libraries.Options{})
231+
c.rootLibrary = libraries.New(nil)
231232
c.pool = gitbase.NewRepositoryPool(c.sharedCache, c.rootLibrary)
232233

233234
if err := c.addDirectories(); err != nil {
@@ -318,18 +319,34 @@ func (c *Server) addDirectories() error {
318319

319320
func (c *Server) addDirectory(d directory) error {
320321
if d.Format == "siva" {
321-
sivaOpts := siva.LibraryOptions{
322-
Transactional: true,
323-
RootedRepo: d.Rooted,
324-
Cache: c.sharedCache,
325-
Bucket: d.Bucket,
326-
Performance: true,
327-
RegistryCache: 100000,
328-
}
322+
var lib borges.Library
323+
var err error
324+
325+
if d.Rooted {
326+
sivaOpts := &siva.LibraryOptions{
327+
Transactional: true,
328+
RootedRepo: d.Rooted,
329+
Cache: c.sharedCache,
330+
Bucket: d.Bucket,
331+
Performance: true,
332+
RegistryCache: 100000,
333+
}
329334

330-
lib, err := siva.NewLibrary(d.Path, osfs.New(d.Path), sivaOpts)
331-
if err != nil {
332-
return err
335+
lib, err = siva.NewLibrary(d.Path, osfs.New(d.Path), sivaOpts)
336+
if err != nil {
337+
return err
338+
}
339+
} else {
340+
sivaOpts := &oldsiva.LibraryOptions{
341+
Cache: c.sharedCache,
342+
Bucket: d.Bucket,
343+
RegistryCache: 100000,
344+
}
345+
346+
lib, err = oldsiva.NewLibrary(d.Path, osfs.New(d.Path), sivaOpts)
347+
if err != nil {
348+
return err
349+
}
333350
}
334351

335352
err = c.rootLibrary.Add(lib)

commit_blobs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"bytes"
55
"io"
66

7+
"github.com/src-d/go-mysql-server/sql"
78
"gopkg.in/src-d/go-git.v4/plumbing"
89
"gopkg.in/src-d/go-git.v4/plumbing/object"
9-
"github.com/src-d/go-mysql-server/sql"
1010
)
1111

1212
type commitBlobsTable struct {
@@ -113,10 +113,10 @@ func (t *commitBlobsTable) PartitionRows(
113113

114114
if err != nil {
115115
span.Finish()
116-
return nil, err
116+
return nil, errorWithRepo(repo, err)
117117
}
118118

119-
return sql.NewSpanIter(span, iter), nil
119+
return sql.NewSpanIter(span, newRepoRowIter(repo, iter)), nil
120120
}
121121

122122
func (commitBlobsTable) HandledFilters(filters []sql.Expression) []sql.Expression {

commit_files.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"io"
66

77
"github.com/sirupsen/logrus"
8+
"github.com/src-d/go-mysql-server/sql"
9+
"github.com/src-d/go-mysql-server/sql/expression"
10+
"github.com/src-d/go-mysql-server/sql/plan"
811
git "gopkg.in/src-d/go-git.v4"
912
"gopkg.in/src-d/go-git.v4/plumbing"
1013
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
1114
"gopkg.in/src-d/go-git.v4/plumbing/object"
12-
"github.com/src-d/go-mysql-server/sql"
13-
"github.com/src-d/go-mysql-server/sql/expression"
14-
"github.com/src-d/go-mysql-server/sql/plan"
1515
)
1616

1717
type commitFilesTable struct {
@@ -125,10 +125,10 @@ func (t *commitFilesTable) PartitionRows(
125125

126126
if err != nil {
127127
span.Finish()
128-
return nil, err
128+
return nil, errorWithRepo(repo, err)
129129
}
130130

131-
return sql.NewSpanIter(span, iter), nil
131+
return sql.NewSpanIter(span, newRepoRowIter(repo, iter)), nil
132132
}
133133

134134
func (commitFilesTable) HandledFilters(filters []sql.Expression) []sql.Expression {

commit_trees.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66

77
"gopkg.in/src-d/go-git.v4/plumbing"
88

9+
"github.com/src-d/go-mysql-server/sql"
910
"gopkg.in/src-d/go-git.v4/plumbing/filemode"
1011
"gopkg.in/src-d/go-git.v4/plumbing/object"
11-
"github.com/src-d/go-mysql-server/sql"
1212
)
1313

1414
type commitTreesTable struct {
@@ -106,10 +106,10 @@ func (t *commitTreesTable) PartitionRows(
106106

107107
if err != nil {
108108
span.Finish()
109-
return nil, err
109+
return nil, errorWithRepo(repo, err)
110110
}
111111

112-
return sql.NewSpanIter(span, iter), nil
112+
return sql.NewSpanIter(span, newRepoRowIter(repo, iter)), nil
113113
}
114114

115115
// IndexKeyValues implements the sql.IndexableTable interface.

commits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ func (r *commitsTable) PartitionRows(
133133

134134
if err != nil {
135135
span.Finish()
136-
return nil, err
136+
return nil, errorWithRepo(repo, err)
137137
}
138138

139-
return sql.NewSpanIter(span, iter), nil
139+
return sql.NewSpanIter(span, newRepoRowIter(repo, iter)), nil
140140
}
141141

142142
func (commitsTable) HandledFilters(filters []sql.Expression) []sql.Expression {

common_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,14 @@ func newMultiLibrary() (*multiLibrary, error) {
314314
plainLib.AddLocation(plainLoc)
315315

316316
sivaFS := memfs.New()
317-
sivaLib, err := siva.NewLibrary("siva", sivaFS, siva.LibraryOptions{
317+
sivaLib, err := siva.NewLibrary("siva", sivaFS, &siva.LibraryOptions{
318318
RootedRepo: true,
319319
})
320320
if err != nil {
321321
return nil, err
322322
}
323323

324-
libs := libraries.New(libraries.Options{})
324+
libs := libraries.New(nil)
325325

326326
err = libs.Add(plainLib)
327327
if err != nil {

database_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const testDBName = "foo"
1414
func TestDatabase_Tables(t *testing.T) {
1515
require := require.New(t)
1616

17-
lib := libraries.New(libraries.Options{})
17+
lib := libraries.New(nil)
1818
db := getDB(t, testDBName, NewRepositoryPool(nil, lib))
1919

2020
tables := db.Tables()
@@ -45,7 +45,7 @@ func TestDatabase_Tables(t *testing.T) {
4545
func TestDatabase_Name(t *testing.T) {
4646
require := require.New(t)
4747

48-
lib := libraries.New(libraries.Options{})
48+
lib := libraries.New(nil)
4949
db := getDB(t, testDBName, NewRepositoryPool(nil, lib))
5050
require.Equal(testDBName, db.Name())
5151
}

0 commit comments

Comments
 (0)