-
Notifications
You must be signed in to change notification settings - Fork 136
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
implement HTTPS support for cloning (#225) #283
Conversation
@jcpetruzza @aschmolck, @jasontrost I fixed some linting issues. Now the PR is ready to review. |
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.
Looks great from me, but I'm no python expert 😅 A readme update would be nice as well! Thanks for taking the time on this
@tclh123 this PR makes a lot of sense to avoid providing duplicate credentials. Most bots work with access tokens these days and they can be easier to rotate/provision. I'm looking at using this on our CE instance and would love to see it merged. Do you need some help with this repo to catch up on some of the PRs? I see some have been open for a while (#254 looks very useful too). My only comment @matthiasbalke is some of the copied code in class RepoMixin:
def forget_repo(self, project):
self._repos.pop(project.id, None)
@property
def user(self):
return self._user
@property
def root_dir(self):
return self._root_dir
class SshRepoManager(RepoMixin):
# ...
class HttpsRepoManager(RepoMixin):
# ... |
Thanks for your feedback @nejch. I wasn't sure how to extract the common parts into a base class, as I'm new to class hierarchies in python. I'm happy to refactor this part as you suggested. I'm also wondering if the maintainers need some help, as it seems to be a bit quite in here and the project is really usefull to us and probably to a lot more people. |
Maybe a base class makes sense as well with a shared init. Or also just one manager with |
@nejch I'm not sure how to share the class RepoManager:
def __init__(self, user, root_dir, timeout=None, reference=None):
self._root_dir = root_dir
self._user = user
self._repos = {}
self._timeout = timeout
self._reference = reference
class SshRepoManager(RepoManager):
def __init__(self, user, root_dir, ssh_key_file=None, timeout=None, reference=None):
super(RepoManager, self).__init__(self, user, root_dir, timeout, reference)
self._ssh_key_file = ssh_key_file
class HttpsRepoManager(RepoManager):
def __init__(self, user, root_dir, auth_token=None, timeout=None, reference=None):
super(RepoManager, self).__init__(self, user, root_dir, timeout, reference)
self._auth_token = auth_token |
@matthiasbalke I think your exact example is described here in this answer: https://stackoverflow.com/a/39887759 |
Hi @matthiasbalke , thank you for the contribution! I believe this feature shall be able to give developers more flexibility to handle different access methods to repositories and managing their credentials. I'm very happy to see this merged. Would you mind resolving the conflicts and squashing them into a single commit? Thanks. |
@qqshfox do you have any idea, why my PR branch is not building on CI? The request log states |
unsure why CI doesn't build. will investigate. suspecting
|
Looks like you should be able to run this now if you rebase @matthiasbalke :) |
cee7667
to
134c47f
Compare
@qqshfox I squashed the commits. I hope everything is now ready to be merged. |
LGTM. thank you @matthiasbalke ! |
Thanks for merging it! |
I finally found some time to implement this. I took @flaviouk idea and added a compatible argument parsing around it.
This is my first python project so I would love to get honest feedback, about parts that can be improved.
How do you like the idea of the mutally exclusive argument group of https vs. ssh?
Changes
--help
output