Skip to content
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

Adding GitImplementation of Ground and tests #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ground Git

This folder contains the git implementation for the Ground API, where are the Ground objects are stored in a git repository named 'ground_git_dir', which is automatically created when you initialize a GitImplementation Object. This directory will persist with multiple executions of a program that uses the GitImplementation Object, given you run the program from the same directory every time. However, in order to use the GitImplementation Object, you must call the .init() method every time before perfoming any operation. The .init() method will automatically check for previous initialization and will call init again which is safe but will not replace the repo and your existing work. The ids will carry on with the highest id and continue, not replacing older files. However, this implementation does not handle the case where the folder has been previously manually created, then initialized to some other repo with previous commits that have no relation to the ground objects, it will just continue to commit to that initial repo.
6 changes: 5 additions & 1 deletion python/ground/common/model/core/rich_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ground.common.model.version.version import Version

from ground.common.model.version.tag import Tag

class RichVersion(Version):

Expand All @@ -8,6 +8,10 @@ def __init__(self, json_payload):

self._tags = json_payload.get('tags', {}) or {}

for key, value in list(self._tags.items()):
if not isinstance(value, Tag):
self._tags[key] = Tag(value)

svid = json_payload.get('structureVersionId')
if svid is None or svid <= 0:
self._structure_version_id = -1
Expand Down
Loading