lib/pull: Add status for imported objects

Followup for recent work in commits:

 - 8a7a359709
 - 1a9a473580

Keep track of how many objects we imported, and print that for `ostree
pull-local` (also do this even if noninteractive, like we did for `pull`).

In implementing this at first I used separate variables for import
from repo vs import from localcache, but that broke some of the
tests that checked those values.

It's easier to just merge them; we know from looking at whether or not
`remote_repo_local` is set whether or not we were doing a "HTTP pull with
localcache" versus a true `pull-local` and can use that when rendering status.

Closes: #1219
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-09-27 15:35:11 +00:00
1 parent 2f9f7222a4
commit c6f972406e
4 files changed
+54 -27

No files matched your search

+2 -1
View File
@@ -278,7 +278,8 @@ if ! skip_one_without_user_xattrs; then
opposite_mode=archive
fi
ostree_repo_init repo2 --mode=$opposite_mode
${CMD_PREFIX} ostree --repo=repo2 pull-local repo
${CMD_PREFIX} ostree --repo=repo2 pull-local repo >out.txt
assert_file_has_content out.txt "[1-9][0-9]* metadata, [1-9][0-9]* content objects imported"
test2_commitid=$(${CMD_PREFIX} ostree --repo=repo rev-parse test2)
test2_commit_relpath=/objects/${test2_commitid:0:2}/${test2_commitid:2}.commit
assert_files_hardlinked repo/${test2_commit_relpath} repo2/${test2_commit_relpath}
+1 -1
View File
@@ -42,7 +42,7 @@ repo_init --no-gpg-verify
${CMD_PREFIX} ostree --repo=repo pull origin main >out.txt
assert_file_has_content out.txt "[1-9][0-9]* metadata, [1-9][0-9]* content objects fetched"
${CMD_PREFIX} ostree --repo=repo pull origin:main > out.txt
assert_not_file_has_content out.txt "content objects fetched"
assert_not_file_has_content out.txt "[1-9][0-9]* content objects fetched"
${CMD_PREFIX} ostree --repo=repo fsck
echo "ok pull"