diff --git a/pyenliven/deprecated.py b/pyenliven/deprecated.py new file mode 100644 index 0000000..cfeed42 --- /dev/null +++ b/pyenliven/deprecated.py @@ -0,0 +1,47 @@ +#!/usr/bin/env +class Repo: + ''' + The real one is in enliven.py + ''' + pass + +class GiteaRepo(Repo): + ''' + This class is deprecated since the "options" sequential argument + replaces all of the keyword arguments, and the API and its defaults + are detected from the URL (See enissue.py). + ''' + def __init__( + self, + repo_url, + # instance_url="https://api.github.com", + # repository_id="80873867", + # api_repo_url_fmt="{instance_url}/repos/{ru}/{rn}", + # api_issue_url_fmt="{instance_url}/repos/{ru}/{rn}/issues/{issue_no}", + # search_issues_url_fmt="{instance_url}/search/issues?q=repo%3A{ru}/{rn}+", + # search_results_key="items", + # page_size=30, + # c_issues_name_fmt="issues_page={p}{q}.json", + # c_issue_name_fmt="{issue_no}.json", + # default_query={'state':'open'}, + # hide_events=['renamed', 'assigned'], + caches_path=None, + # api_comments_url_fmt="{instance_url}/repos/{ru}/{rn}/issues/comments", + ): + print(GiteaRepo.__doc__) + if repo_url.endswith(".git"): + repo_url = repo_url[:-4] + urlParts = repo_url.split("/") + remote_user = urlParts[-2] + repo_name = urlParts[-1] + debug("* constructing GiteaRepo") + debug(" * detected remote_user \"{}\" in url" + "".format(remote_user)) + debug(" * detected repo_name \"{}\" in url" + "".format(repo_name)) + instance_url = "/".join(urlParts[:-2]) + debug(" * detected Gitea url " + instance_url) + # NOTE: self.instance_url is set by super __init__ below. + # base_query_fmt = "?q=repo%3A{ru}/{rn}+" + # search_issues_url_fmt = \ + # "{instance_url}/api/v1/repos/issues/search"+base_query_fmt diff --git a/utilities/enissue.py b/utilities/enissue.py index 9dd61f3..d6f5c3e 100755 --- a/utilities/enissue.py +++ b/utilities/enissue.py @@ -315,9 +315,13 @@ class Repo: remote_user = urlParts[-2] self.api_id = options.get('api_id') if urlParts[-2] == "repo.or.cz": - # Such as https://repo.or.cz/minetest_treasurer.git remote_user = "almikes@aol.com" # Wuzzy2 self.api_id = "git_instaweb" + # Such as https://repo.or.cz/minetest_treasurer.git + # - locally, git instaweb is controlled via: + # git instaweb --httpd=webrick --start + # git instaweb --httpd=webrick --stop + repo_name = urlParts[-1] if self.api_id is None: