diff --git a/HEPTAPOD_CHANGELOG.md b/HEPTAPOD_CHANGELOG.md index 0d5235e0a4a4e889696fb64582eef1e2911752d1_SEVQVEFQT0RfQ0hBTkdFTE9HLm1k..0b81797de78536bcea4ccce457c476869ff7504d_SEVQVEFQT0RfQ0hBTkdFTE9HLm1k 100644 --- a/HEPTAPOD_CHANGELOG.md +++ b/HEPTAPOD_CHANGELOG.md @@ -8,6 +8,13 @@ Please read migration instructions in the [installation notice](INSTALL_HEPTAPOD.md) +### Heptapod 0.22.1 (2021-06-16) + +- heptapod#492: upstream GitLab update to 13.11.5 (from 13.11.4) +- heptapod#225: using `hg push --pushvars` for [Push Options](https://docs.gitlab.com/ce/user/project/push_options.html) +- heptapod#494: binary uploads in Web IDE and REST API `encoding: "base64"` + option. + ### Heptapod 0.22.0 (2021-06-03) #### Summary of changes compared to 0.21.4 diff --git a/HEPTAPOD_VERSION b/HEPTAPOD_VERSION index 0d5235e0a4a4e889696fb64582eef1e2911752d1_SEVQVEFQT0RfVkVSU0lPTg==..0b81797de78536bcea4ccce457c476869ff7504d_SEVQVEFQT0RfVkVSU0lPTg== 100644 --- a/HEPTAPOD_VERSION +++ b/HEPTAPOD_VERSION @@ -1,1 +1,1 @@ -0.22.0 +0.22.1 diff --git a/heptapod-ci.yml b/heptapod-ci.yml index 0d5235e0a4a4e889696fb64582eef1e2911752d1_aGVwdGFwb2QtY2kueW1s..0b81797de78536bcea4ccce457c476869ff7504d_aGVwdGFwb2QtY2kueW1s 100644 --- a/heptapod-ci.yml +++ b/heptapod-ci.yml @@ -16,7 +16,7 @@ # but it gives us in particular a working # recent Mercurial, proper Ruby versions (of course), # and it should already be present in all runners - image: "registry.heptapod.net/heptapod/ci-images/heptapod-base:default" + image: "registry.heptapod.net/heptapod/ci-images/heptapod-base:stable" workflow: rules: diff --git a/lib/gitlab/import_export/project/vcs_type_restorer.rb b/lib/gitlab/import_export/project/vcs_type_restorer.rb index 0d5235e0a4a4e889696fb64582eef1e2911752d1_bGliL2dpdGxhYi9pbXBvcnRfZXhwb3J0L3Byb2plY3QvdmNzX3R5cGVfcmVzdG9yZXIucmI=..0b81797de78536bcea4ccce457c476869ff7504d_bGliL2dpdGxhYi9pbXBvcnRfZXhwb3J0L3Byb2plY3QvdmNzX3R5cGVfcmVzdG9yZXIucmI= 100644 --- a/lib/gitlab/import_export/project/vcs_type_restorer.rb +++ b/lib/gitlab/import_export/project/vcs_type_restorer.rb @@ -18,7 +18,7 @@ # regular GitLab instance @project.vcs_type = project_attributes.fetch("vcs_type", "git") true - rescue => e + rescue StandardError => e @shared.error(e) false end diff --git a/lib/gitlab/mercurial/hg_git_repository.rb b/lib/gitlab/mercurial/hg_git_repository.rb index 0d5235e0a4a4e889696fb64582eef1e2911752d1_bGliL2dpdGxhYi9tZXJjdXJpYWwvaGdfZ2l0X3JlcG9zaXRvcnkucmI=..0b81797de78536bcea4ccce457c476869ff7504d_bGliL2dpdGxhYi9tZXJjdXJpYWwvaGdfZ2l0X3JlcG9zaXRvcnkucmI= 100644 --- a/lib/gitlab/mercurial/hg_git_repository.rb +++ b/lib/gitlab/mercurial/hg_git_repository.rb @@ -132,7 +132,7 @@ end true - rescue => err + rescue StandardError => err LOGGER.error("Failed to add Mercurial repository "\ "for #{storage}/#{name}: #{err}") false @@ -1316,6 +1316,12 @@ end end + # extract and decode if necessary the content for some file actions (write, create notably) + def file_action_content(action) + raw = action[:content] + action[:encoding] == 'base64' ? Base64.decode64(raw) : raw + end + # TODO: Cyclomatic complexity offense appeared with upstream # 13.9 merge, not the proper time to refactor that. # rubocop:disable Metrics/CyclomaticComplexity @@ -1343,9 +1349,9 @@ end FileUtils.mkdir_p(parent_abspath) - write_file(abspath, action[:content]) + write_file(abspath, file_action_content(action)) when :update unless File.file?(abspath) raise ActionError, "A file with this name doesn't exist" end @@ -1347,9 +1353,9 @@ when :update unless File.file?(abspath) raise ActionError, "A file with this name doesn't exist" end - content = action[:content] + content = file_action_content(action) if action[:hg_preserve_line_endings] content = Gitlab::Utils::LineEndings.replace_as_in( @@ -1646,7 +1652,7 @@ # it's needed for oauth access_token result.user = "*****" unless result.user.nil? result - rescue + rescue StandardError url end end diff --git a/python/common.req b/python/common.req index 0d5235e0a4a4e889696fb64582eef1e2911752d1_cHl0aG9uL2NvbW1vbi5yZXE=..0b81797de78536bcea4ccce457c476869ff7504d_cHl0aG9uL2NvbW1vbi5yZXE= 100644 --- a/python/common.req +++ b/python/common.req @@ -1,7 +1,7 @@ hg-evolve~=10.3.0 gunicorn~=20.0.4 sentry-sdk==0.9.5 -heptapod==2.7.1 +heptapod==2.7.2 hgitaly==0.13.0 hg-git==0.10.1 dulwich~=0.20.0 diff --git a/spec/lib/gitlab/mercurial/hg_git_repository_spec.rb b/spec/lib/gitlab/mercurial/hg_git_repository_spec.rb index 0d5235e0a4a4e889696fb64582eef1e2911752d1_c3BlYy9saWIvZ2l0bGFiL21lcmN1cmlhbC9oZ19naXRfcmVwb3NpdG9yeV9zcGVjLnJi..0b81797de78536bcea4ccce457c476869ff7504d_c3BlYy9saWIvZ2l0bGFiL21lcmN1cmlhbC9oZ19naXRfcmVwb3NpdG9yeV9zcGVjLnJi 100644 --- a/spec/lib/gitlab/mercurial/hg_git_repository_spec.rb +++ b/spec/lib/gitlab/mercurial/hg_git_repository_spec.rb @@ -412,6 +412,42 @@ end end + describe "multi_action writes" do + context "encoding is base64" do + subject { empty_repository } + + after do + subject.remove + end + + it "decodes for create and update" do + subject.multi_action(user, + branch_name: 'branch/default', + message: "Commit 0", + author_email: "jdoe1@heptapod.test", + author_name: "John Doe1", + actions: [{ action: :create, + file_path: 'foo', + encoding: 'base64', + content: "Zm9v\n" }]) + subject.expire_has_local_branches_cache + expect(subject.empty?).to be(false) + + expect(subject.blob_at('branch/default', 'foo').data).to eq('foo') + subject.multi_action(user, + branch_name: 'branch/default', + message: "Commit 1", + author_email: "jdoe1@heptapod.test", + author_name: "John Doe1", + actions: [{ action: :update, + file_path: 'foo', + encoding: 'base64', + content: "YmFy\n" }]) + expect(subject.blob_at('branch/default', 'foo').data).to eq('bar') + end + end + end + describe "#hg_env_for_write" do context "without a project for permissions assessment" do subject { mutable_repository }