-
Notifications
You must be signed in to change notification settings - Fork 154
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
[#1572] Accept different types of URLs besides https github #1644
[#1572] Accept different types of URLs besides https github #1644
Conversation
…d/RepoSense into 1572-experimental-implementation
@dcshzj Requesting follow-up review. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replied to some of the comments, mainly now is about the icon used for the repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Follow-up actions are being tracked in this issue #1726 |
The following links are for previewing this pull request:
|
Resolves #1572
Commit message:
Backend Changes
This change removes direct validation of location based on the URL provided as was done in the previous implementation. This might indirectly fix the issue #1641. This implementation now provides a best guess of the repo name and 'organization' via regex match based on https://git-scm.com/docs/git-clone#_git_urls.
The method of guessing for remote repos is such: Given a URL
https://host.xz[:port]/path/to/repo.git/
, it drops the domain and keeps thepath/to/repo.git
. The last directory becomes therepo-name
and thepath/to
has the/
changed to a-
and becomes theorganization
.Local repositories are sorted similarly. This allows differentiation between two local directories with the same final directory although this can result in some awkward organization names. E.g. the path
../reposense/RepoSense
will haveorganization
..-reposense
. The benefit is that two different paths provided will always provide two unique output directories. This should also fix the issue #1637 but I will investigate it separately.The class
SupportedDomainUrlMap
has also been added to be the 'single source of truth' for which types of remote repository domains we would like to support. Adding a new domain can be easily done by adding a new entry to the map. The map provides template mappings for how things like the file blame URL and file history URL would look like. The information is uploaded viasummary.json
.Related PRs (that are possibly under review but already merged to this PR):
Frontend Changes
The template links are uploaded via
summary.json
and stored inwindow.DOMAIN_URL_MAP
.The way the various types of links are generated (file history, author profile, repo url) have been aggregated in
api.js
. All other files that generated their own links have been edited to use one of the methods fromapi.js
.Currently, the buttons that leads to once-invalid links will not open anything. This is an improvement over the master branch behaviour of opening an invalid link. A follow-up change (not included in this PR) would be to add a message notification if trying to open an unsupported link.
Reviewing this PR
The backend changes relating to the organization and repo-name guessing in
RepoLocation
(up to commit 60f57e3) have mostly been approved.I would like reviews regarding the changes after which are dealing with supporting the frontend link generations.
In particular, I would like the frontend code reviewed as I'm not too familiar with the layers of abstraction and design in the frontend code.
How to test
I used the two repositories below for testing.
GitLab repository: https://gitlab.com/tortoisegit/tortoisegit.git
BitBucket repository: https://bitbucket.org/atlassian/atlassian-scheduler.git
Pull the branch https://github.com/chan-j-d/RepoSense/tree/1572-experimental-implementation, build and run something like
gradlew run -Dargs="--repos https://gitlab.com/tortoisegit/tortoisegit.git https://bitbucket.org/atlassian/atlassian-scheduler.git https://github.com/reposense/RepoSense -i --view -s 10/02/2022"