Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 44414:218feb1a7e00
graft: always allow hg graft --base . (issue6248)
`hg graft --base . -r abc` is rejected before this change with a
"nothing to merge" error, if `abc` does not descend from `.`.
This looks like an artifact of the implementation rather than intended
behavior. It makes perfect sense to apply the diff between `.` and
`abc` to the working copy (i.e. degenerate into `hg revert`),
regardless of what `abc` is.
Differential Revision: https://phab.mercurial-scm.org/D8127
author | Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> |
---|---|
date | Mon, 17 Feb 2020 20:30:03 -0500 |
parents | 9f8eddd2723f |
children | 5e3402a0b868 |
line wrap: on
line diff
--- a/mercurial/merge.py Wed Feb 19 17:30:04 2020 +0100 +++ b/mercurial/merge.py Mon Feb 17 20:30:03 2020 -0500 @@ -2654,10 +2654,15 @@ # to copy commits), and 2) informs update that the incoming changes are # newer than the destination so it doesn't prompt about "remote changed foo # which local deleted". + # We also pass mergeancestor=True when base is the same revision as p1. 2) + # doesn't matter as there can't possibly be conflicts, but 1) is necessary. wctx = wctx or repo[None] pctx = wctx.p1() base = base or ctx.p1() - mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node()) + mergeancestor = ( + repo.changelog.isancestor(pctx.node(), ctx.node()) + or pctx.rev() == base.rev() + ) stats = update( repo,