feature(scm): added multibranch support for git and mercurial

This commit is contained in:
RhodeCode Admin 2025-12-21 08:27:11 +01:00
parent 4c45b5eb14
commit 102205ec73
51 changed files with 446 additions and 217 deletions

View file

@ -41,8 +41,7 @@ class TestGetRepoChangeset(object):
if details == "full":
assert result["refs"]["bookmarks"] == getattr(commit, "bookmarks", [])
branches = [commit.branch] if commit.branch else []
assert result["refs"]["branches"] == branches
assert result["refs"]["branches"] == commit.branches
assert result["refs"]["tags"] == commit.tags
@pytest.mark.parametrize("details", ["basic", "extended", "full"])

View file

@ -324,7 +324,7 @@ def get_repo_changeset(request, apiuser, repoid, revision, details=Optional("bas
raise JSONRPCError("ret_type must be one of %s" % (",".join(_changes_details_types)))
vcs_repo = repo.scm_instance()
pre_load = ["author", "branch", "date", "message", "parents", "status", "_commit"]
pre_load = ["author", "branches", "date", "message", "parents", "status", "_commit"]
try:
commit = repo.get_commit(commit_id=revision, pre_load=pre_load)
@ -383,7 +383,7 @@ def get_repo_changesets(request, apiuser, repoid, start_rev, limit, details=Opti
raise JSONRPCError("ret_type must be one of %s" % (",".join(_changes_details_types)))
limit = int(limit)
pre_load = ["author", "branch", "date", "message", "parents", "status", "_commit"]
pre_load = ["author", "branches", "date", "message", "parents", "status", "_commit"]
vcs_repo = repo.scm_instance()
# SVN needs a special case to distinguish its index and commit id
@ -408,7 +408,7 @@ def get_repo_changesets(request, apiuser, repoid, start_rev, limit, details=Opti
_cs_json["diff"] = build_commit_data(vcs_repo, commit, changes_details)
if changes_details == "full":
_cs_json["refs"] = {
"branches": [commit.branch],
"branches": commit.branches,
"bookmarks": getattr(commit, "bookmarks", []),
"tags": commit.tags,
}