subrepos: prompt on conflicts on update with dirty subrepos
Consider a repository with a single subrepository. The changesets in
the main repository reference the subrepository changesets like this:
m0 -> s0
m1 -> s1
m2 -> s2
Starting from a state (m1, s0), doing 'hg update m2' in the main
repository will yield a conflict: the subrepo is at revision s0 but
the target revision says it should be at revision s2.
Before this change, Mercurial would do (m1, s0) -> (m2, s2) and thus
ignore the conflict between the working copy and the target revision.
With this change, the user is prompted to resolve the conflict by
choosing which revision he wants. This is consistent with 'hg merge',
which also prompts the user when it detects conflicts in the merged
.hgsubstate files.
The prompt looks like this:
$ hg update tip
subrepository sources for my-subrepo differ
use (l)ocal source (
fc627a69481f) or (r)emote source (
12a213df6fa9)?
$ hg clone http://localhost:$HGPORT/ copy
abort: error: Connection refused
[255]
$ test -d copy || echo copy: No such file or directory
copy: No such file or directory
$ cat > dumb.py <<EOF
> import BaseHTTPServer, SimpleHTTPServer, os, signal
> def run(server_class=BaseHTTPServer.HTTPServer,
> handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
> server_address = ('localhost', int(os.environ['HGPORT']))
> httpd = server_class(server_address, handler_class)
> httpd.serve_forever()
> signal.signal(signal.SIGTERM, lambda x: sys.exit(0))
> run()
> EOF
$ python dumb.py 2>/dev/null &
$ echo $! >> $DAEMON_PIDS
give the server some time to start running
$ sleep 1
$ hg clone http://localhost:$HGPORT/foo copy2 2>&1
abort: HTTP Error 404: * (glob)
[255]
$ kill $!