diff options
-rw-r--r-- | ganarchy/cli/debug.py | 6 | ||||
-rw-r--r-- | ganarchy/core.py | 4 | ||||
-rw-r--r-- | ganarchy/data.py | 6 | ||||
-rw-r--r-- | ganarchy/git.py | 13 | ||||
-rw-r--r-- | requirements.txt | 5 |
5 files changed, 19 insertions, 15 deletions
diff --git a/ganarchy/cli/debug.py b/ganarchy/cli/debug.py index e44d235..1d63c62 100644 --- a/ganarchy/cli/debug.py +++ b/ganarchy/cli/debug.py @@ -40,12 +40,12 @@ def print_data_source(data_source): title = None click.echo("\tTitle: {}".format(title)) - if ganarchy.data.DataProperty.INSTANCE_BASE_URL in data_source.get_supported_properties(): + if ganarchy.data.DataProperty.INSTANCE_BASE_URI in data_source.get_supported_properties(): try: - base_url = data_source.get_property_value(ganarchy.data.DataProperty.INSTANCE_BASE_URL) + base_url = data_source.get_property_value(ganarchy.data.DataProperty.INSTANCE_BASE_URI) except LookupError: base_url = None - click.echo("\tBase URL: {}".format(base_url)) + click.echo("\tBase URI: {}".format(base_url)) if ganarchy.data.DataProperty.REPO_LIST_SOURCES in data_source.get_supported_properties(): click.echo("\tRepo list sources:") diff --git a/ganarchy/core.py b/ganarchy/core.py index d882a57..6503b8c 100644 --- a/ganarchy/core.py +++ b/ganarchy/core.py @@ -192,7 +192,7 @@ class Project: """ try: project = work_repo.get_commit_message(self.commit) - project_title, project_desc = (lambda x: x.groups() if x is not None else ('', None))(re.fullmatch('^\\[Project\\]\s+(.+?)(?:\n\n(.+))?$', project, flags=re.ASCII|re.DOTALL|re.IGNORECASE)) + project_title, project_desc = (lambda x: x.groups() if x is not None else ('', None))(re.fullmatch('^\\[Project\\]\\s+(.+?)(?:\n\n(.+))?$', project, flags=re.ASCII|re.DOTALL|re.IGNORECASE)) if not project_title.strip(): # FIXME project_title, project_desc = ("Error parsing project commit",)*2 # if project_desc: # FIXME @@ -262,7 +262,7 @@ class GAnarchy: """ try: base_url = self._config.get_property_value( - ganarchy.data.DataProperty.INSTANCE_BASE_URL + ganarchy.data.DataProperty.INSTANCE_BASE_URI ) except LookupError: # FIXME use a more appropriate error type diff --git a/ganarchy/data.py b/ganarchy/data.py index c803b9b..4d675cb 100644 --- a/ganarchy/data.py +++ b/ganarchy/data.py @@ -53,7 +53,7 @@ def _is_uri(obj, ports=range(1,65536), schemes=('https',)): # also raises for invalid ports, see # https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse # "Reading the port attribute will raise a ValueError if an - # invalid port is specified in the URL. [...]" + # invalid port is specified in the URI. [...]" if u.port is not None and u.port not in ports: return False if u.scheme not in schemes: @@ -164,7 +164,7 @@ class DataProperty(Enum): DataSource get_property_values for more details. """ INSTANCE_TITLE = (1, str) - INSTANCE_BASE_URL = (2, str) + INSTANCE_BASE_URI = (2, str) VCS_REPOS = (3, PCTP) REPO_LIST_SOURCES = (4, RepoListSource) INSTANCE_FEDITO = (5, int) @@ -325,7 +325,7 @@ class ObjectDataSource(DataSource): _SUPPORTED_PROPERTIES = { DataProperty.INSTANCE_TITLE: _get_instance_title, - DataProperty.INSTANCE_BASE_URL: _get_instance_base_uri, + DataProperty.INSTANCE_BASE_URI: _get_instance_base_uri, DataProperty.INSTANCE_FEDITO: _get_instance_fedito, DataProperty.VCS_REPOS: _get_vcs_repos, DataProperty.REPO_LIST_SOURCES: _get_repo_list_sources, diff --git a/ganarchy/git.py b/ganarchy/git.py index a88a979..ccee0bf 100644 --- a/ganarchy/git.py +++ b/ganarchy/git.py @@ -358,15 +358,20 @@ class _WithWorkRepos: del work del branch + collected_branches = [] for i, repo in enumerate(self.work_repos): for branch in repo.pending_branches: fetch_head = "{}-{}".format(branch, i) # First collect the work branch into a fetch head self.cache_repo._fetch_work(repo, fetch_head, branch) # If that succeeds, delete the work branch to free up disk + # (this doesn't really free up disk unless we run git gc) repo._rm_branch(branch) - # We have all the objects in the main repo and we probably - # have enough disk, so just replace the fetch head into - # the main branch and hope nothing errors. - self.cache_repo._replace(fetch_head, branch) + # We now have all the branch's objects in the main repo, + # save it to update the refs later + collected_branches.append((fetch_head, branch)) repo._delete() + for fetch_head, branch in collected_branches: + # Once every work branch is referenced in the main repo, update + # the original refs so objects can be safely GCed + self.cache_repo._replace(fetch_head, branch) diff --git a/requirements.txt b/requirements.txt index e46aafc..37db1a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,10 @@ --e git+https://soniex2.autistic.space/git-repos/abdl.git@ff3628c36eab5ec19ab850e9126a951f5c203568#egg=gan0f74bd87a23b515b45da7e6f5d9cc82380443dab Click==7.0 Jinja2==2.11.1 -requests==2.22.0 +requests==2.32.3 certifi==2019.11.28 chardet==3.0.4 idna==2.8 MarkupSafe==1.1.1 pyparsing==2.4.2 -urllib3==1.25.7 +urllib3==2.3.0 |