topic: take topic in account for all branch head computation
This changeset introduce a "topicmap" that is tracking not just the head of all
branches, but the heads of all branch+topic pair. Including the head of the part
of the branch without any topic. In practice this means that BRANCHNAME now
resolve to the tipmost part for the branch without topic and impact various
other logic like head checking during push and default destination for update and
merge (these aspect will need adjustment in later changesets).
The on-the-fly-temporary-monkey-patching process is pretty horrible, but allow
to move forward without waiting on having core patched.
We use 'branch:topic' as the branchmap key, this is a small and easy hack that
help use a lot for (future) support of heads discovery/checking and on disc
cache. I'm not sure it is worthwhile to improve this until an implementation
into core.
Note that this changeset change the branchmap in all cases, including during
exchange, see next changeset for improved behavior.
We also currently have the on-disk cache disabled because the core branchmap is
lacking phase information in its cache key. This will get done in a later
changesets
$ . "$TESTDIR/testlib"
$ hg init jungle
$ cd jungle
$ cat <<EOF >> .hg/hgrc
> [extensions]
> rebase=
> [phases]
> publish=false
> [ui]
> logtemplate = '{rev} ({topics}) {desc}\n'
> EOF
$ for x in alpha beta gamma delta ; do
> echo file $x >> $x
> hg add $x
> hg ci -m "c_$x"
> done
Test NGTip feature
==================
Simple linear case
$ echo babar >> jungle
$ hg add jungle
$ hg ci -t elephant -m babar
$ hg log -G
@ 4 (elephant) babar
|
o 3 () c_delta
|
o 2 () c_gamma
|
o 1 () c_beta
|
o 0 () c_alpha
$ hg log -r 'ngtip(.)'
3 () c_delta
$ hg log -r 'default'
3 () c_delta
multiple heads with topic
$ hg up "desc('c_beta')"
0 files updated, 0 files merged, 3 files removed, 0 files unresolved
$ echo zephir >> jungle
$ hg add jungle
$ hg ci -t monkey -m zephir
created new head
$ hg log -G
@ 5 (monkey) zephir
|
| o 4 (elephant) babar
| |
| o 3 () c_delta
| |
| o 2 () c_gamma
|/
o 1 () c_beta
|
o 0 () c_alpha
$ hg log -r 'ngtip(.)'
3 () c_delta
$ hg log -r 'default'
3 () c_delta
one of the head is a valid tip
$ hg up "desc('c_delta')"
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo epsilon >> epsilon
$ hg add epsilon
$ hg ci -m "c_epsilon"
$ hg log -G
@ 6 () c_epsilon
|
| o 5 (monkey) zephir
| |
+---o 4 (elephant) babar
| |
o | 3 () c_delta
| |
o | 2 () c_gamma
|/
o 1 () c_beta
|
o 0 () c_alpha
$ hg log -r 'ngtip(.)'
6 () c_epsilon
$ hg log -r 'default'
6 () c_epsilon
merge destination
=================
$ hg up 'ngtip(default)'
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg up default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo zeta >> zeta
$ hg add zeta
$ hg ci -m "c_zeta"
$ hg log -G
@ 7 () c_zeta
|
o 6 () c_epsilon
|
| o 5 (monkey) zephir
| |
+---o 4 (elephant) babar
| |
o | 3 () c_delta
| |
o | 2 () c_gamma
|/
o 1 () c_beta
|
o 0 () c_alpha
$ hg up elephant
switching to topic elephant
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ hg rebase -d 7 # make sure tip is elsewhere
rebasing 4:cb7ae72f4a80 "babar"
$ hg up monkey
switching to topic monkey
1 files updated, 0 files merged, 4 files removed, 0 files unresolved
$ hg merge
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg topic
elephant
* monkey
$ hg ci -m 'merge with default'
$ hg topic
elephant
* monkey
$ hg log -G
@ 9 (monkey) merge with default
|\
| | o 8 (elephant) babar
| |/
| o 7 () c_zeta
| |
| o 6 () c_epsilon
| |
o | 5 (monkey) zephir
| |
| o 3 () c_delta
| |
| o 2 () c_gamma
|/
o 1 () c_beta
|
o 0 () c_alpha