Skip to content

Commit

Permalink
server revisions fix search (#13070)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Feb 8, 2023
1 parent 3d75e82 commit e0a8ee0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conans/server/service/common/search.py
Expand Up @@ -61,7 +61,10 @@ def search_packages(server_store, ref, query, look_in_all_rrevs):
param ref: ConanFileReference object
"""
if not look_in_all_rrevs and ref.revision is None:
latest_rev = server_store.get_last_revision(ref).revision
found_ref = server_store.get_last_revision(ref)
if found_ref is None:
raise RecipeNotFoundException(ref)
latest_rev = found_ref.revision
ref = ref.copy_with_rev(latest_rev)

if not os.path.exists(server_store.conan_revisions_root(ref.copy_clear_rev())):
Expand Down
7 changes: 7 additions & 0 deletions conans/test/integration/command/search_test.py
Expand Up @@ -1639,3 +1639,10 @@ def create_binary(package_id, conaninfo):
c.run("search pkg/0.1@ -r=default")
assert "Package_ID: package_id_1X" in c.out
assert "package_id_20" not in c.out


def test_error_revision_search():
c = TestClient(default_server_user=True)
c.run("config set general.revisions_enabled=1")
c.run("search mozilla/1.0.0@ -r=default", assert_error=True)
assert "ERROR: Recipe not found: 'mozilla/1.0.0'. [Remote: default]" in c.out

0 comments on commit e0a8ee0

Please sign in to comment.