mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-05-07 11:29:27 +00:00
manifest: Add sync-strategy attribute to project elements
The only supported sync-strategy is "stateless". The intent is to keep the local workspace as small as possible by not keeping history during syncs. This prevents disk space waste for projects with large binaries where we only care about the current version. A follow up change will implement the logic. Bug: 498730431 Change-Id: I84a436a9ca2492893163c6cfda6c28dc62a568f0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/568462 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
@@ -732,6 +732,29 @@ class TestProjectElement:
|
||||
"</manifest>"
|
||||
)
|
||||
|
||||
def test_sync_strategy(self, repo_client: RepoClient) -> None:
|
||||
"""Check setting of project's sync_strategy."""
|
||||
manifest = repo_client.get_xml_manifest(
|
||||
"""
|
||||
<manifest>
|
||||
<remote name="default-remote" fetch="http://localhost" />
|
||||
<default remote="default-remote" revision="refs/heads/main" />
|
||||
<project name="test-name" sync-strategy="stateless"/>
|
||||
</manifest>
|
||||
"""
|
||||
)
|
||||
assert len(manifest.projects) == 1
|
||||
project = manifest.projects[0]
|
||||
assert project.sync_strategy == "stateless"
|
||||
assert (
|
||||
sort_attributes(manifest.ToXml().toxml())
|
||||
== '<?xml version="1.0" ?><manifest>'
|
||||
'<remote fetch="http://localhost" name="default-remote"/>'
|
||||
'<default remote="default-remote" revision="refs/heads/main"/>'
|
||||
'<project name="test-name" sync-strategy="stateless"/>'
|
||||
"</manifest>"
|
||||
)
|
||||
|
||||
def test_trailing_slash(self, repo_client: RepoClient) -> None:
|
||||
"""Check handling of trailing slashes in attributes."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user