evolve: properly evolve stacked unstable with --rev
Before this patch, _singlesuccessor was not returning a revision number for
the case where the parent of the argument was not obsolete. This resulted in
bug when testing membership with the set of revisions. This patch fixes it and
adds a test.
evolve --rev reordering
-----------------------
$ cat >> $HGRCPATH <<EOF
> [defaults]
> amend=-d "0 0"
> fold=-d "0 0"
> [web]
> push_ssl = false
> allow_push = *
> [phases]
> publish = False
> [diff]
> git = 1
> unified = 0
> [ui]
> logtemplate = {rev}:{node|short}@{branch}({phase}) {desc|firstline}\n
> [extensions]
> hgext.graphlog=
> EOF
$ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
$ mkcommit() {
> echo "$1" > "$1"
> hg add "$1"
> hg ci -m "add $1"
> }
$ mkstack() {
> # Creates a stack of commit based on $1 with messages from $2, $3 ..
> hg update $1 -C
> shift
> mkcommits $*
> }
$ shaof() {
> hg log -T {node} -r "first(desc($1))"
> }
$ mkcommits() {
> for i in $@; do mkcommit $i ; done
> }
Initial setup
$ hg init testrevorder
$ cd testrevorder
$ mkcommits p _a _b _c
$ hg phase --public 0
$ hg up 'desc(_a)'
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ echo "aaa" > _a
$ hg amend
2 new unstable changesets
$ hg log -G
@ 5:12d519679175@default(draft) add _a
|
| o 3:4d156641b718@default(draft) add _c
| |
| o 2:4d7242ebb004@default(draft) add _b
| |
| x 1:2d73fcd7f07d@default(draft) add _a
|/
o 0:f92638be10c7@default(public) add p
evolve --rev reorders the rev to solve instability, trivial case 2 revs wrong order
$ hg evolve --rev 'desc(_c) + desc(_b)'
move:[2] add _b
atop:[5] add _a
move:[3] add _c
atop:[6] add _b
working directory is now at 52b8f9b04f83
evolve --rev reorders the rev to solve instability. Harder case, obsolescence
accross three stacks in growing rev numbers.
$ hg up "desc(_c)"
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ mkcommit d
$ hg up "desc(_a)"
0 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ hg amend -m "aprime"
3 new unstable changesets
$ hg evolve --rev "desc(_b)"
move:[6] add _b
atop:[9] aprime
working directory is now at 476c9c052aae
$ hg up "desc(_b) - obsolete()"
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg amend -m "bprime"
$ hg up "desc(aprime)"
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg amend -m "asecond"
1 new unstable changesets
$ hg log -G
@ 12:9a584314f3f3@default(draft) asecond
|
| o 11:a59c79776f7c@default(draft) bprime
| |
| x 9:81a687b96d4d@default(draft) aprime
|/
| o 8:2d86cc7ec3a9@default(draft) add d
| |
| o 7:52b8f9b04f83@default(draft) add _c
| |
| x 6:59476c3836ef@default(draft) add _b
| |
| x 5:12d519679175@default(draft) add _a
|/
o 0:f92638be10c7@default(public) add p
$ hg evolve --rev "unstable()"
move:[11] bprime
atop:[12] asecond
move:[7] add _c
atop:[13] bprime
move:[8] add d
atop:[14] add _c
working directory is now at fd447ba1b20b
$ hg log -G
@ 15:fd447ba1b20b@default(draft) add d
|
o 14:0fc229278e4d@default(draft) add _c
|
o 13:c3741b9eafae@default(draft) bprime
|
o 12:9a584314f3f3@default(draft) asecond
|
o 0:f92638be10c7@default(public) add p