mergestate: extract overridable methods for making/restoring file backups
In-memory merge currently still uses on-disk mergestate. That's mostly
harmless (I don't think I've seen any problem it's actually
caused). It's still a little weird. I'm planning to add an in-memory
mergestate, which will be used with `overlayworkingctx`. This patch
prepares for that by extracting that logic, so it's easier to change
per subclass.
Differential Revision: https://phab.mercurial-scm.org/D9038
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: ForIndentation
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
IncludeCategories:
- Regex: '^<'
Priority: 1
- Regex: '^"'
Priority: 2