From b98cdeb28d4831611f25948e0868b05c9018640a Mon Sep 17 00:00:00 2001 From: Rene Pfeuffer Date: Wed, 19 Jun 2024 17:46:42 +0200 Subject: [PATCH] Fix sub repositories in mercurial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sub repositories did not show up in the source view. This fixes python errors for the computation of sub repositories in hg. Pushed-by: Rene Pfeuffer Co-authored-by: René Pfeuffer --- gradle/changelog/sub_repos.yaml | 2 ++ .../src/main/resources/sonia/scm/python/fileview.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 gradle/changelog/sub_repos.yaml diff --git a/gradle/changelog/sub_repos.yaml b/gradle/changelog/sub_repos.yaml new file mode 100644 index 0000000000..b11a16aab3 --- /dev/null +++ b/gradle/changelog/sub_repos.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Sub repositories in the source view for mercurial repositories diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/fileview.py b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/fileview.py index 8eca8bdb68..0bcc1cfe4f 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/fileview.py +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/python/fileview.py @@ -29,6 +29,7 @@ Prints date, size and last message of files. from collections import defaultdict from mercurial import scmutil +from builtins import open, bytes cmdtable = {} @@ -177,7 +178,7 @@ class SubRepository: def collect_sub_repositories(revCtx): subrepos = {} try: - hgsub = revCtx.filectx(b'.hgsub').data().split('\n') + hgsub = revCtx.filectx(b'.hgsub').data().split(b'\n') for line in hgsub: parts = line.split(b'=') if len(parts) > 1: @@ -188,9 +189,9 @@ def collect_sub_repositories(revCtx): pass try: - hgsubstate = revCtx.filectx(b'.hgsubstate').data().split('\n') + hgsubstate = revCtx.filectx(b'.hgsubstate').data().split(b'\n') for line in hgsubstate: - parts = line.split(' ') + parts = line.split(b' ') if len(parts) > 1: subrev = parts[0].strip() subrepo = subrepos[parts[1].strip()]