evolve: fix divergence resolution when not merging a descendant
In divergence resolution, when we merge other cset with divergent one
we pass a `mergeancestor` arg to merge.update() and before this patch
we were passing `mergeancestor` as True in every case.
But it should be True only when we are merging a descendant onto an
ancestor.
When mergeancestor is True it does two things:
1) allows the merge if the destination is the same as the parent
of the ctx (so we can use graft to copy commits)
2) informs update that the incoming changes are newer than the
destination so it doesn't prompt about "remote changed foo
which local deleted".
So this patch change it to pass `mergeancestor` as True only when
it is required.
And changes in test file shows that it wasn't prompting either in
those cases when it should (acc. to 2nd point)
Test written by Pierre-Yves David, based the one updated in 5dbaabfe2c59.
#!/usr/bin/env python
import os
import sys
import subprocess
if len(sys.argv) < 2:
execname = os.path.basename(sys.argv[0])
print >> sys.stderr, "usage: %s CLIENT_ID" % execname
client_id = sys.argv[1]
subprocess.check_call(['hg', 'branch', "--force", "hammer-branch-%s" % client_id])
while True:
subprocess.check_call([
'hg', 'commit',
"--config", "ui.allowemptycommit=yes",
"--message", "hammer-%s" % client_id,
])
nodeid = subprocess.check_output([
'hg', 'log', '--rev', '.', '--template', '{node}'
])
subprocess.check_call([
'hg', 'debugobsolete', ''.join(reversed(nodeid)), nodeid
])
subprocess.check_call(['hg', 'pull'])
subprocess.check_call(['hg', 'push', '--force'])