Commit.find_commit: fallback for Git SHAs on native Mercurial
Closes #421 (closed)
After migration from hg_git
VCS type to hg
(native), there
could still be lingering references to Git SHAs, in particular
because of links stored in external systems.
In that case we'll take advantage of the old hg-git map file to resolve to Mercurial on the fly.
As expected, it turns out that it does not seem to be a problem for the Rails app if the resulting ID differs from the requested one (was expected because the latter can be any resolvable revision). Manual testing shows that this is enough to make the commit page URI work again with a Git SHA. Of course we'll need to ensure that with functional tests.
If fallbacking happens, it is logged at WARN
level, which will help
us improve the migration tasks. We were about to implement directly some
filtering for the backtrace, to avoid flooding the disk and for readability,
but found about BacktraceCleaner
instead, which seems to do exactly what
we had in mind.
Finally, this is perhaps not the only method where such a fallback can be useful, but it is the most obvious and probably the main one.
--HG-- branch : heptapod