Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2220abc
Initial dirty version of v2 pull integration + porject info v2
MarcelGeo Dec 8, 2025
001c83d
Separate diff files from merge files + comments @wonder-sk
MarcelGeo Dec 9, 2025
68b84c1
Introduce:
MarcelGeo Dec 16, 2025
ae3e55c
Added return types fo new functions
MarcelGeo Dec 18, 2025
55d9e5a
Fix test test_mergin_project
MarcelGeo Dec 18, 2025
db7be6c
add optional download_path for pattern with diff files
MarcelGeo Dec 18, 2025
8e3f2ec
solve base file missing
MarcelGeo Dec 18, 2025
9552372
Handle unfinished pull
MarcelGeo Dec 18, 2025
fc90173
comments @varmar05
MarcelGeo Jan 16, 2026
411d3e1
fix files to merge renamig
MarcelGeo Jan 16, 2026
5e2eccc
fix download base files + import
MarcelGeo Jan 16, 2026
5891088
fix for is_gpgkg_open results
MarcelGeo Jan 19, 2026
9a18374
update tests for cases where geopackage is modified
MarcelGeo Jan 19, 2026
9c82771
Black 26.1.0 upgrades
MarcelGeo Jan 19, 2026
7a144b1
Merge remote-tracking branch 'origin/v2-pull-integration' into pull-i…
MarcelGeo Jan 19, 2026
ec500a5
fixed imports after merge
MarcelGeo Jan 19, 2026
7fb335f
pull actions tests
MarcelGeo Jan 19, 2026
93995ec
First comments resolving from a reviews
MarcelGeo Feb 12, 2026
3a1f47f
Update mergin/test/test_client_pull.py
MarcelGeo Feb 27, 2026
be1ffed
Update mergin/common.py
MarcelGeo Feb 27, 2026
337757f
Update mergin/merginproject.py
MarcelGeo Feb 27, 2026
d1585fb
Apply suggestions from code review
MarcelGeo Feb 27, 2026
c3dd5ec
Address comments @wonder-sk
MarcelGeo Feb 27, 2026
f6aea66
Fix arguments of pull changes
MarcelGeo Feb 27, 2026
e4afd04
Fix rest of tests
MarcelGeo Feb 27, 2026
a41258a
Fix renamed missing key
MarcelGeo Feb 27, 2026
9f89e3f
Merge remote-tracking branch 'origin/v2-pull-integration' into pull-i…
MarcelGeo Mar 4, 2026
80c371c
Fix tests for new test_case
MarcelGeo Mar 4, 2026
ee87ad9
use username instead of API_USER variable in test
MarcelGeo Mar 4, 2026
37692a8
For server response with update:
MarcelGeo Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ htmlcov
deps
venv
.vscode/settings.json
debug.py
57 changes: 54 additions & 3 deletions mergin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def __init__(
self._user_info = None
self._server_type = None
self._server_version = None
self._server_features = {}
self.client_version = "Python-client/" + __version__
if plugin_version is not None: # this could be e.g. "Plugin/2020.1 QGIS/3.14"
self.client_version += " " + plugin_version
Expand Down Expand Up @@ -309,6 +310,13 @@ def delete(self, path, validate_auth=True):
request = urllib.request.Request(url, method="DELETE")
return self._do_request(request, validate_auth=validate_auth)

def head(self, path, data=None, headers={}, validate_auth=True):
url = urllib.parse.urljoin(self.url, urllib.parse.quote(path))
if data:
url += "?" + urllib.parse.urlencode(data)
request = urllib.request.Request(url, headers=headers, method="HEAD")
return self._do_request(request, validate_auth=validate_auth)

def login(self, login, password):
"""
Authenticate login credentials and store session token
Expand Down Expand Up @@ -412,6 +420,19 @@ def server_version(self):

return self._server_version

def server_features(self):
"""
Returns feature flags of the server.
"""
if self._server_features:
return self._server_features
config = self.server_config()
self._server_features = {
"v2_push_enabled": config.get("v2_push_enabled", False),
"v2_pull_enabled": config.get("v2_pull_enabled", False),
}
return self._server_features

def workspaces_list(self):
"""
Find all available workspaces
Expand Down Expand Up @@ -699,6 +720,36 @@ def project_info(self, project_path_or_id, since=None, version=None):
resp = self.get("/v1/project/{}".format(project_path_or_id), params)
return json.load(resp)

def project_info_v2(self, project_id: str, files_at_version=None):
Comment thread
MarcelGeo marked this conversation as resolved.
Outdated
"""
Fetch info about project.
Comment thread
MarcelGeo marked this conversation as resolved.

:param project_path_or_id: Project's full name (<namespace>/<name>) or id
:type project_path_or_id: String
:param files_at_version: Version to track files at given version
:type files_at_version: String
"""
Comment thread
MarcelGeo marked this conversation as resolved.
# since and version are mutually exclusive
Comment thread
MarcelGeo marked this conversation as resolved.
Outdated
params = {}
if files_at_version:
params = {"files_at_version": files_at_version}
resp = self.get(f"/v2/projects/{project_id}", params)
return json.load(resp)

def get_project_delta(self, project_id: str, since: str):
Comment thread
MarcelGeo marked this conversation as resolved.
Outdated
"""
Fetch info about project delta since given version.

:param project_id: Project's id
:type project_id: String
:param since: Version to track history of geodiff files from
:type since: String
:rtype: Dict
Comment thread
MarcelGeo marked this conversation as resolved.
Outdated
"""
params = {"since": since}
resp = self.get(f"/v2/projects/{project_id}/delta", params)
return json.load(resp)

def paginated_project_versions(self, project_path, page, per_page=100, descending=False):
"""
Get records of project's versions (history) using calculated pagination.
Expand Down Expand Up @@ -789,11 +840,11 @@ def download_project(self, project_path, directory, version=None):
:param project_path: Project's full name (<namespace>/<name>)
:type project_path: String

:param version: Project version to download, e.g. v42
:type version: String

:param directory: Target directory
:type directory: String

:param version: Project version to download, e.g. v42
:type version: String
"""
job = download_project_async(self, project_path, directory, version)
download_project_wait(job)
Expand Down
Loading
Loading