Skip to content

Commit ea429f5

Browse files
author
Juanjo Alvarez
committed
Integration tests and docs fixes.
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent cf4f34d commit ea429f5

File tree

6 files changed

+19
-163
lines changed

6 files changed

+19
-163
lines changed

CHANGELOG.md

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

77
## [Unreleased]
88

9+
- Added BLAME function.
10+
911
## [0.24.0-rc2] - 2019-10-02
1012

1113
## Fixed
@@ -263,7 +265,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
263265
- COUNT expression now returns an int64 number instead of int32 https://github.com/src-d/go-mysql-server/issues/642
264266
- Dockerfile: include zero-config MySQL client https://github.com/src-d/gitbase/pull/737
265267
- uast_extract function now returns a JSON for `pos` instead of a custom format https://github.com/src-d/gitbase/pull/715
266-
- Added BLAME function.
267268

268269
#### Documentation
269270
- docs: expand optimization guide on early filtering (#837)

Gopkg.toml

Lines changed: 0 additions & 110 deletions
This file was deleted.

docs/using-gitbase/functions.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ To make some common tasks easier for the user, there are some functions to inter
88
|:-------------|:-------------------------------------------------------------------------------------------------------------------------------|
99
|`commit_stats(repository_id, [from_commit_hash], to_commit_hash) json`|returns the stats between two commits for a repository. If `from_commit_hash` is empty, it will compare the given `to_commit_hash` with its parent commit. Vendored files stats are not included in the result of this function. This function is more thoroughly explained later in this document.|
1010
|`commit_file_stats(repository_id, [from_commit_hash], to_commit_hash) json array`|returns an array with the stats of each file in `to_commit_hash` since the given `from_commit_hash`. If `from_commit_hash` is not given, the parent commit will be used. Vendored files stats are not included in the result of this function. This function is more thoroughly explained later in this document.|
11-
|`is_remote(reference_name)bool`| checks if the given reference name is from a remote one. |
1211
|`is_tag(reference_name)bool`| checks if the given reference name is a tag. |
1312
|`is_vendor(file_path)bool`| checks if the given file name is a vendored file. |
1413
|`language(path, [blob])text`| gets the language of a file given its path and the optional content of the file. |
@@ -19,16 +18,15 @@ To make some common tasks easier for the user, there are some functions to inter
1918
|`uast_children(blob) blob`| returns a flattened array of the children UAST nodes from each one of the UAST nodes in the given array. |
2019
|`loc(path, blob) json`| returns a JSON map, containing the lines of code of a file, separated in three categories: Code, Blank and Comment lines. |
2120
|`version() text`| returns the gitbase version in the following format `8.0.11-{GITBASE_VERSION}` for compatibility with MySQL versioning. |
22-
||||||| merged common ancestors
23-
|`is_remote(reference_name)bool`| check if the given reference name is from a remote one |
24-
|`is_tag(reference_name)bool`| check if the given reference name is a tag |
25-
|`language(path, [blob])text`| gets the language of a file given its path and the optional content of the file |
26-
|`uast(blob, [lang, [xpath]]) blob`| returns a node array of UAST nodes in semantic mode |
27-
|`uast_mode(mode, blob, lang) blob`| returns a node array of UAST nodes specifying its language and mode (semantic, annotated or native) |
28-
|`uast_xpath(blob, xpath) blob`| performs an XPath query over the given UAST nodes |
29-
|`uast_extract(blob, key) text array`| extracts information identified by the given key from the uast nodes |
30-
|`uast_children(blob) blob`| returns a flattened array of the children UAST nodes from each one of the UAST nodes in the given array |
31-
|`loc(path, blob) json`| returns a JSON map, containing the lines of code of a file, separated in three categories: Code, Blank and Comment lines |
21+
|`is_remote(reference_name)bool`| checks if the given reference name is from a remote one. |
22+
|`is_tag(reference_name)bool`| check if the given reference name is a tag. |
23+
|`language(path, [blob])text`| gets the language of a file given its path and the optional content of the file. |
24+
|`uast(blob, [lang, [xpath]]) blob`| returns a node array of UAST nodes in semantic mode. |
25+
|`uast_mode(mode, blob, lang) blob`| returns a node array of UAST nodes specifying its language and mode (semantic, annotated or native). |
26+
|`uast_xpath(blob, xpath) blob`| performs an XPath query over the given UAST nodes. |
27+
|`uast_extract(blob, key) text array`| extracts information identified by the given key from the uast nodes. |
28+
|`uast_children(blob) blob`| returns a flattened array of the children UAST nodes from each one of the UAST nodes in the given array. |
29+
|`loc(path, blob) json`| returns a JSON map, containing the lines of code of a file, separated in three categories: Code, Blank and Comment lines. |
3230

3331
## Standard functions
3432

@@ -39,7 +37,7 @@ These are all functions that are available because they are implemented in `go-m
3937
|:-------------|:-------------------------------------------------------------------------------------------------------------------------------|
4038
|`ARRAY_LENGTH(json)`|if the json representation is an array, this function returns its size.|
4139
|`AVG(expr)`| returns the average value of expr in all rows.|
42-
|`BLAME(expr)`|Returns a list, as a json array, of lines changes and authorship.|
40+
|`BLAME(repository, commit)`|Returns an array, of lines changes and authorship.|
4341
|`CEIL(number)`| returns the smallest integer value that is greater than or equal to `number`.|
4442
|`CEILING(number)`| returns the smallest integer value that is greater than or equal to `number`.|
4543
|`CHAR_LENGTH(str)`| returns the length of the string in characters.|

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ require (
88
github.com/gliderlabs/ssh v0.2.0 // indirect
99
github.com/go-kit/kit v0.8.0
1010
github.com/go-sql-driver/mysql v1.4.1
11-
github.com/hashicorp/golang-lru v0.5.3
11+
github.com/gorilla/handlers v1.4.0 // indirect
1212
github.com/hhatto/gocloc v0.3.0
1313
github.com/jessevdk/go-flags v1.4.0
14+
github.com/miekg/dns v1.1.1 // indirect
1415
github.com/opentracing/opentracing-go v1.1.0
1516
github.com/prometheus/client_golang v1.0.0
1617
github.com/sirupsen/logrus v1.4.2
@@ -22,6 +23,7 @@ require (
2223
github.com/stretchr/testify v1.3.0
2324
github.com/uber-go/atomic v1.4.0 // indirect
2425
github.com/uber/jaeger-client-go v2.16.0+incompatible
26+
github.com/uber/jaeger-lib v2.0.0+incompatible // indirect
2527
go.uber.org/atomic v1.4.0 // indirect
2628
golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b // indirect
2729
golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect
@@ -32,7 +34,6 @@ require (
3234
gopkg.in/src-d/go-errors.v1 v1.0.0
3335
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0
3436
gopkg.in/src-d/go-git.v4 v4.12.0
35-
gopkg.in/src-d/go-mysql-server.v0 v0.5.1
3637
gopkg.in/yaml.v2 v2.2.2
3738
vitess.io/vitess v3.0.0-rc.3.0.20190602171040-12bfde34629c+incompatible
3839
)

0 commit comments

Comments
 (0)