Conversation
|
feat(bitbucket): support bitbucket.org via |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #113 +/- ##
==========================================
- Coverage 81.46% 79.86% -1.61%
==========================================
Files 12 12
Lines 696 715 +19
==========================================
+ Hits 567 571 +4
- Misses 129 144 +15 ☔ View full report in Codecov by Sentry. |
| - `require('gitlinker.routers').blob`: generate the `/blob` url, by default `link` API will use this router. | ||
| - `require('gitlinker.routers').blame` (todo): generate the `/blame` url. | ||
| - `require('gitlinker.routers').blame`: generate the `/blame` url. | ||
| - `require('gitlinker.routers').src`: generate the `/src` url (for [BitBucket.org](https://bitbucket.org/)). |
There was a problem hiding this comment.
I think /src should not be considered as a separate router. We should have two main routers blob and blame.
In blob router we should decide the url keyword like blob, src or tree based on host pattern. Similar to vim-gh-line.vim
Same behaviour can be achieved for the blame router. Here we can decide the keyword blame or annotate as per host type.
I am suggesting this because current implementation will enforce user to created separate binding for each host type with different router config. In my opinion user should be creating the mapping based on action and router irrespective of the git host.
There was a problem hiding this comment.
Would recommend to rename the blob router to browse, that would make more sense if backward compatibility is not a concern.
There was a problem hiding this comment.
Hi, @G0V1NDS, your point makes sense.
for now I am using the router_binding option to auto bind different routers to different host.
but just like you said, the blame is still need to be manually configured for different hosts.
I will refactor this part.
again thanks for your contribution!
There was a problem hiding this comment.
hi @G0V1NDS , I submit PR: #118, would you please help review?
There was a problem hiding this comment.
Added comment on router_binding implementation, see if that makes sense.
| - `require('gitlinker.routers').blob`: generate the `/blob` url, by default `link` API will use this router. | ||
| - `require('gitlinker.routers').blame` (todo): generate the `/blame` url. | ||
| - `require('gitlinker.routers').blame`: generate the `/blame` url. | ||
| - `require('gitlinker.routers').src`: generate the `/src` url (for [BitBucket.org](https://bitbucket.org/)). |
There was a problem hiding this comment.
Would recommend to rename the blob router to browse, that would make more sense if backward compatibility is not a concern.
| router_binding = { | ||
| ["^github"] = require("gitlinker.routers").blob, | ||
| ["^gitlab"] = require("gitlinker.routers").blob, | ||
| ["^bitbucket"] = require("gitlinker.routers").src, |
There was a problem hiding this comment.
As an initial implementation this pattern match will work. Please consider the self hosted setup for gitlab and bitbucket where these patterns won't match. Consider this as a feature request, people might be interested in.
We can ask user to define the custom pattern for their host similar to this fubitive.vim
There was a problem hiding this comment.
hi @G0V1NDS , I submit PR: #118, would you please help review?
Regression Test
Platforms
Tasks
<leader>glto copy git link.<leader>gLto open git link in browser.