Project Export fails if wiki Mercurial and Git repos are out of sync
I'm currently trying to export a Mercurial project created way before Heptapod did support wikis (version 0.13).
The Wiki Git repository has a single commit, but the Mercurial repository is empty.
The export code has safeguards against missing or empty repositories, but they are checked just once, using repository.empty?
. The end result is the error due to hg bundle
exitin 1 on empty repos.
Email report:
Command failed (status code 1): 'no changes found ' command was: [FILTERED] "bundle", "--all", [FILTERED] "--config", "ui.username=Heptapod system"]
Traceback:
class: Gitlab::Mercurial::HgGitRepository::HgError
message: Command failed (status code 1): 'no changes found
' command was: ["/opt/gitlab/embedded/bin/hg", "bundle", "--all", "/var/opt/gitlab/gitlab-rails/shared/tmp/gitlab_exports/@hashed/(...)/project.wiki.hg.bundle", "--config", "ui.username=Heptapod system"]
backtrace:
lib/gitlab/mercurial/hg_git_repository.rb:554:in `hg_call'
lib/gitlab/mercurial/hg_git_repository.rb:998:in `bundle_to_disk'
lib/gitlab/import_export/repo_saver.rb:42:in `bundle_to_disk'
lib/gitlab/import_export/repo_saver.rb:18:in `save'
app/services/projects/import_export/export_service.rb:58:in `all?'
app/services/projects/import_export/export_service.rb:58:in `save_exporters'
app/services/projects/import_export/export_service.rb:49:in `save_all!'
app/services/projects/import_export/export_service.rb:20:in `execute'