evolve: protect call to rebase within a wlock (#42, #35, #16)
Without a wlock, repo.commit would blow away the dirstate's parents on OSes
that have no 'os.symlink' support in python, leading evolve to produce a merge
instead of a rebase. If a user ran the rebase command instead of evolve, then
things would work because rebase is wrapped in a giant wlock.
Unfortunately, we can't use the same idea of wrapping the evolve command in one
giant wlock because that's too early in the process. If the lock did wrap the
entire evolve command, then the working directory would save its current
parents which, since rebase hasn't been called yet, would be just
p1.
Therefore, we need to obtain the lock *after* the dirstate's parents are
changed but *before* the call to rebase. This way ensures that when a conflict
happens the working directory correctly shows both parent changeset.
$ cat >> $HGRCPATH <<EOF
> [extensions]
> hgext.rebase=
> hgext.graphlog=
> EOF
$ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
hg prev should move active bookmark
$ hg init
$ touch a
$ hg add a
$ hg commit -m 'added a'
$ touch b
$ hg add b
$ hg commit -m 'added b'
$ hg bookmark mark
$ hg bookmarks
* mark 1:6e742c9127b3
$ hg prev
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
[0] added a
$ hg bookmarks
* mark 0:a154386e50d1
hg next should move active bookmark
$ hg next
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
[1] added b
$ hg bookmarks
* mark 1:6e742c9127b3
hg next/prev should not interfere with inactive bookmarks
$ touch c
$ hg add c
$ hg commit -m 'added c'
$ hg bookmark -r2 no-move
$ hg prev
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
[1] added b
$ hg bookmarks
* mark 1:6e742c9127b3
no-move 2:4e26ef31f919
$ hg next
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
[2] added c
$ hg bookmarks
* mark 2:4e26ef31f919
no-move 2:4e26ef31f919
$ hg up 1
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg next
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
[2] added c
$ hg bookmarks
mark 2:4e26ef31f919
no-move 2:4e26ef31f919
$ hg prev
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
[1] added b
$ hg bookmarks
mark 2:4e26ef31f919
no-move 2:4e26ef31f919