Skip to content

gitbase: add support for siva files #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2018
Merged

gitbase: add support for siva files #224

merged 2 commits into from
Apr 13, 2018

Conversation

erizocosmico
Copy link
Contributor

@erizocosmico erizocosmico commented Apr 12, 2018

Closes #216

Depends on #223 (will probably rebase and remove the dependency tomorrow)

Add support in RepositoryPool for handling siva files as repositories.

Added a new AddSivaDir method to RepositoryPool, which adds all the siva files inside that directory (a siva file is considered to be any file whose extension is .siva) and the direct child directories to allow bucketing.

Also some minor changes related to the RepositoryPool:

  • NewRepositoryFromPath returns now *Repository for convenience.
  • NewRepositoryPool returns now *RepositoryPool, as it always needs to be used with a pointer.
  • Fixed golint warning about returning an unexported type in an exported method, which may be annoying by replacing the type with sql.RowIter.

cmd

Git string `short:"g" long:"git" description:"Path where the git repositories are located, one per dir"`
Git string `short:"g" long:"git" description:"Path where the git repositories are located"`
Siva string `long:"siva" description:"PAth where the siva repositories are located"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/PAth/Path/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Add support in RepositoryPool for handling siva files as repositories.

Added a new `AddSivaDir` method to `RepositoryPool`, which adds all the siva files inside that directory (a siva file is considered to be any file whose extension is `.siva`) and the direct child directories to allow bucketing.

Also some minor changes related to the RepositoryPool:
- NewRepositoryFromPath returns now *Repository for convenience.
- NewRepositoryPool returns now *RepositoryPool, as it always needs to be used with a pointer.
- Fixed golint warning about returning an unexported type in an exported method, which may be annoying by replacing the type with `sql.RowIter`.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
@@ -44,12 +45,12 @@ func (c *cmdServer) buildDatabase() error {
logrus.WithField("dir", c.Git).Debug("added folder containing git repositories")
}

var err error
c.pool = gitbase.NewRepositoryPool()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, now you can have mixed repositories on the same execution, standard ones and siva ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. I can restrict that if we want to only have one type

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ok, LGTM!

@erizocosmico erizocosmico merged commit e6ad89b into src-d:master Apr 13, 2018
@erizocosmico erizocosmico deleted the feature/siva branch April 13, 2018 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants