Commit 440d8a5f authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

wikis: making backups work

Closes #275

We replicate the same logic we've been doing earlier
for the main repos on Heptapod 0.13: conditional for both
the Git and the Mercurial repo.

delegating `vcs_type` and `mercurial?` makes `ProjectWiki` close
enough to `Project` for the inner method to work (as it does on
upstream GitLab)

--HG--
branch : heptapod
parent bfd430d98774
......@@ -31,6 +31,8 @@ def initialize(project, user = nil)
delegate :repository_storage, :hashed_storage?, to: :project
delegate :vcs_type, :mercurial?, to: :project
def path
@project.path + '.wiki'
end
......
......@@ -171,13 +171,17 @@ def restore
wiki = ProjectWiki.new(project)
path_to_wiki_bundle = path_to_bundle(wiki)
if File.exist?(path_to_wiki_bundle)
path_to_hg_wiki_bundle = path_to_hg_bundle(wiki)
if File.exist?(path_to_wiki_bundle) || File.exist?(path_to_hg_wiki_bundle)
progress.print " * #{wiki.full_path} ... "
begin
wiki.repository.create_from_bundle(path_to_wiki_bundle)
restore_custom_hooks(wiki)
if has_git
wiki.repository.create_from_bundle(path_to_wiki_bundle)
restore_custom_hooks(wiki)
end
if project.mercurial?
restore_hg_repo(wiki)
end
progress.puts "[DONE]".color(:green)
rescue => e
progress.puts "[Failed] restoring #{wiki.full_path} wiki".color(:red)
......
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