Skip to content
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

Support linking to bitbucket style URLs #85

Merged
merged 1 commit into from
Mar 8, 2015

Conversation

kppullin
Copy link
Contributor

@kppullin kppullin commented Mar 8, 2015

Bitbucket style URLs differ from github style URLs in two ways:

  1. Bitbucket SSH repository URLs takes the form of:
    ssh://hg@bitbucket.org/username/Foo (vs
    git@github.com:username/Foo.git)
  2. Direct links to source file lines require the commit hash/revision
    id, following this pattern: {url}/src/{rev}/{path}{anchor}.

This patch addresses both these concerns to allow for direct file
linking to bitbucket.

This required a change to bubble up the revision to the UI layer, which
can be then fed in to the UrlToRepo function for final formatting via
a custom url-pattern (as defined above).

Server side, the revision value is bound to each index upon
opening. The index.Search function returns this value in the
SearchResults struct.

Bitbucket style URLs differ from github style URLs in two ways:

1) The bitbucket SSH repository URL takes the form of:
`ssh://hg@bitbucket.org/username/Foo` (vs
`git@github.com:username/Foo.git`)
2) Direct links to source file lines require the commit hash/revision
id, following this pattern: `{url}/src/{rev}/{path}{anchor}`.

The patch addresses both these concerns to allow for direct file
linking to bitbucket.

This required a change to bubble up the revision to the UI layer, which
can be then fed in to the `UrlToRepo` function for final formatting via
a custom `url-pattern` (as defined above).

Server side, the `revision` value is bound to each `index` upon
opening. The `index.Search` function returns this value in the
`SearchResults` struct.
@@ -57,7 +59,7 @@ type ExcludedFile struct {
}

func (s Snapshot) Open() (*Index, error) {
return Open(string(s))
return Open(string(s), "")
Copy link
Member

Choose a reason for hiding this comment

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

This would be problematic if we still used this notion of a Snapshot, but we don't. So I'm going to merge your change and then fix this in a separate change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes, thanks for spotting that. I had originally ripped it out, but put it back in just in case I was missing something... and forgot to follow up on it.

@kellegous
Copy link
Member

Thanks for fixing this.

kellegous added a commit that referenced this pull request Mar 8, 2015
Support linking to bitbucket style URLs
@kellegous kellegous merged commit c30e4ae into hound-search:master Mar 8, 2015
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.

2 participants