This instance will be upgraded to Heptapod 0.20.1 on 2020-03-08 at 14:00 UTC+1 (10 minutes of downtime)

Commit 154a1089 authored by Georges Racinet's avatar Georges Racinet 🦑

Merged heptapod-stable into heptapod for latest fixes

We get back what was done for 0.17.3 for the future 0.18.0

--HG--
branch : heptapod
......@@ -4,7 +4,7 @@ Raphael.prototype.commitTooltip = function commitTooltip(x, y, commit) {
const boxWidth = 300;
const icon = this.image(gon.relative_url_root + commit.author.icon, x, y, 20, 20);
const nameText = this.text(x + 25, y + 10, commit.author.name);
const idText = this.text(x, y + 35, commit.id);
const idText = this.text(x, y + 35, commit.hpd_display_id);
const messageText = this.text(x, y + 50, commit.message.replace(/\r?\n/g, ' \n '));
const textSet = this.set(icon, nameText, idText, messageText).attr({
'text-anchor': 'start',
......
......@@ -28,5 +28,9 @@ def space
def parents(map)
map.values_at(*@commit.parent_ids).compact
end
def hpd_display_id
@commit.hpd_display_id
end
end
end
......@@ -14,7 +14,8 @@
time: c.time,
space: c.spaces.first,
refs: refs(@graph.repo, c),
id: c.hpd_display_id,
id: c.id,
hpd_display_id: c.hpd_display_id,
date: c.date,
message: c.message,
}
......
......@@ -274,10 +274,22 @@ def parent_ids
@parent_ids ||= @repository.commit(id).parent_ids
end
def hpd_display_parent_ids
# not yet loaded is probably just nil, but [] would be correct
# as well since parent_ids uses ||=
return parent_ids unless parent_ids
parent_ids.map { |id| @repository.commit_id_to_display_id(id) }
end
def parent_id
parent_ids.first
end
def hpd_display_parent_id
hpd_display_parent_ids.first
end
def parent_hgid
parent_hgids.first
end
......
......@@ -58,6 +58,7 @@
it { expect(@commit.different_committer?).to be_truthy }
it { expect(@commit.parents).to eq(@gitlab_parents) }
it { expect(@commit.parent_id).to eq(@parents.first.oid) }
it { expect(@commit.hpd_display_parent_id).to eq(@parents.first.oid) }
it { expect(@commit.no_commit_message).to eq("No commit message") }
after do
......@@ -86,6 +87,7 @@
it { expect(commit.committer_name).to eq(committer.name) }
it { expect(commit.committer_email).to eq(committer.email) }
it { expect(commit.parent_ids).to eq(gitaly_commit.parent_ids) }
it { expect(commit.hpd_display_parent_ids).to eq(gitaly_commit.parent_ids) }
context 'non-UTC dates' do
let(:seconds) { Time.now.to_i }
......
......@@ -16,12 +16,16 @@
let(:user) { build(:user) }
let(:admin_user) { create(:admin) }
let(:project) { create(:hg_git_project, :hg_repository) }
let(:non_empty_repository) do
let(:empty_repository) do
repo = mutable_repository
status = repo.create_repository(namespace_fs_path: "group",
in_subgroup: false)
expect(status).to be(true)
repo
end
let(:non_empty_repository) do
repo = empty_repository
repo.multi_action(user,
branch_name: 'branch/default',
......@@ -68,6 +72,68 @@
end
end
describe "#set_hgrc" do
subject { empty_repository }
let(:hgrc_main) { Pathname(mutable_repository_path).join('.hg', 'hgrc') }
let(:hgrc_managed) { Pathname(mutable_repository_path).join('.hg', 'hgrc.managed') }
after do
subject.remove
end
it "writes with inherit=true a value correctly" do
subject.set_hgrc(user, true, "group",
{ heptapod: { allow_bookmarks: "yes" } })
expect(strip_hgrc_lines(hgrc_main.readlines))
.to eq(["%include ../../group/hgrc", "%include hgrc.managed"])
expect(strip_hgrc_lines(hgrc_managed.readlines))
.to eq(["[heptapod]", "allow_bookmarks = yes"])
expect(subject.get_hgrc).to eq({ 'inherit' => true,
'content' => hgrc_managed.read })
end
it "writes with inherit=false a value correctly" do
subject.set_hgrc(user, false, "group",
{ heptapod: { allow_bookmarks: "yes" } })
expect(strip_hgrc_lines(hgrc_main.readlines))
.to eq(["%include hgrc.managed"])
expect(strip_hgrc_lines(hgrc_managed.readlines))
.to eq(["[heptapod]", "allow_bookmarks = yes"])
expect(subject.get_hgrc).to eq({ 'inherit' => false,
'content' => hgrc_managed.read })
end
it "respects inheritance with inherit=nil yet enforces inclusion of managed file" do
subject
hgrc_main.write("%include ../../group/hgrc\n")
subject.set_hgrc(user, nil, "group", nil)
expect(strip_hgrc_lines(hgrc_main.readlines))
.to eq(["%include ../../group/hgrc", "%include hgrc.managed"])
end
end
describe "#check_fix_hgrc_inheritance" do
subject { empty_repository }
let(:hgrc_main) { Pathname(mutable_repository_path).join('.hg', 'hgrc') }
let(:hgrc_managed) { Pathname(mutable_repository_path).join('.hg', 'hgrc.managed') }
after do
subject.remove
end
it "fixes the inheritance relative path for a simple change" do
subject
hgrc_main.write("%include ../../group/hgrc\nsome other line\n")
subject.check_fix_hgrc_inheritance("new_group")
expect(strip_hgrc_lines(hgrc_main.readlines))
.to eq(["%include ../../new_group/hgrc", "some other line"])
# we would need the repo farther from repos roots from the
# beginning to test deep paths.
end
end
describe "#rebase" do
subject { non_empty_repository }
......@@ -327,4 +393,10 @@
end
end
end
# Remove hash comments (# example), lead/trailing whitespace
# and remove empty lines
def strip_hgrc_lines(lines)
lines.map { |l| l.split("#", 2).first.strip }.select{ |l| !l.empty? }
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment