builtin-am: support and auto-detect mercurial patches