Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
dae6e5ab4439
Commit
2585fddc
authored
Jul 17, 2020
by
Georges Racinet
🦑
Browse files
housekeeping: running `hg recover` systematically
It's cheap and it can unblock a repo. --HG-- branch : heptapod-stable
parent
a53cdbad8015
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/workers/git_garbage_collect_worker.rb
View file @
dae6e5ab
...
...
@@ -94,6 +94,7 @@ def flush_ref_caches(project)
## `repository` has to be a Gitlab::Mercurial::(HgGit)Repository
def
hg_housekeeping
(
task
,
repository
)
repository
.
hg_recover
case
task
when
:full_repack
repository
.
hg_optim
...
...
lib/gitlab/mercurial/hg_git_repository.rb
View file @
dae6e5ab
...
...
@@ -181,6 +181,23 @@ def hg_optim
end
end
# Run `hg recover`.
# This is idempotent and reasonably fast if there's nothing to recover
def
hg_recover
hg_env
=
{
'HGUSER'
=>
'Heptapod system'
,
'HEPTAPOD_SKIP_ALL_GITLAB_HOOKS'
=>
'yes'
,
'HGRCPATH'
=>
Gitlab
::
Mercurial
.
hgrc_path
,
}
output
,
status
=
popen
(
[
Gitlab
.
config
.
mercurial
.
bin_path
,
"recover"
,
],
@hgpath
,
hg_env
)
# as usual with hg, code 1 means there's nothing to do
unless
[
0
,
1
].
include?
(
status
)
raise
HgError
,
"`hg recover` failed for
#{
@hgpath
}
: "
+
output
end
end
def
rename
(
new_git_relative_path
)
super
(
new_git_relative_path
)
new_hg_relative_path
=
new_git_relative_path
.
sub
(
/\.git$/
,
'.hg'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment