convertbookmark: add logic to skip revisions with multiple bookmarks
When a user tries to converts a bookmark to topic which is on a changeset with
more bookmarks we skip that.
Test for `hg debugconvertbookmark` added by topics
==================================================
$ . "$TESTDIR/testlib/topic_setup.sh"
$ cat << EOF >> $HGRCPATH
> [ui]
> logtemplate = [{rev}:{node|short}] {desc|firstline}\n\
> {if(bookmarks, " bookmark: {join(bookmarks,"\n bookmark:")}\n")}\
> {if(topics, " topic: {topics}\n")}
> EOF
$ hg init repo
$ cd repo
$ echo "Hello" > a
$ hg commit -Aqm "First commit"
$ echo "Hello" > b
$ hg commit -Aqm "Second commit"
$ hg bookmark "hellos"
$ hg up 0 -q
$ echo "Fix 1" > l
$ hg commit -Aqm "Fixing first"
$ echo "Fix 2" > m
$ hg commit -Aqm "Fixing second"
$ hg bookmark "secondfix"
$ hg log -G
@ [3:b985e4fea4a4] Fixing second
| bookmark: secondfix
o [2:8e79b09248c2] Fixing first
|
| o [1:50634233706a] Second commit
|/ bookmark: hellos
o [0:3caf92e45cfb] First commit
Help for the command
====================
$ hg help debugconvertbookmark
hg debugcb [-b BOOKMARK] [--all]
aliases: debugconvertbookmark
Converts a bookmark to a topic with the same name.
options:
-b --bookmark VALUE bookmark to convert to topic
--all convert all bookmarks to topics
(some details hidden, use --verbose to show complete help)
Running without any argument
============================
$ hg debugconvertbookmark
abort: you must specify either '--all' or '-b'
[255]
Changing a particular bookmark to topic
=======================================
$ hg debugconvertbookmark -b hellos
changed topic to "hellos" on 1 revisions
$ hg log -G
o [4:ca8825a7eb18] Second commit
| topic: hellos
| @ [3:b985e4fea4a4] Fixing second
| | bookmark: secondfix
| o [2:8e79b09248c2] Fixing first
|/
o [0:3caf92e45cfb] First commit
Changing all bookmarks to topic
===============================
$ hg debugconvertbookmark --all
switching to topic secondfix
changed topic to "secondfix" on 2 revisions
$ hg log -G
@ [6:6efc0524f97a] Fixing second
| topic: secondfix
o [5:0a4244c62a16] Fixing first
| topic: secondfix
| o [4:ca8825a7eb18] Second commit
|/ topic: hellos
o [0:3caf92e45cfb] First commit
Trying with multiple bookmarks on a single changeset
====================================================
$ echo "multiple bookmarks" >> m
$ hg commit -Aqm "Trying multiple bookmarks"
$ hg bookmark book1
$ hg bookmark book2
$ hg log -G
@ [7:7c46b4bbdda3] Trying multiple bookmarks
| bookmark: book1
| bookmark:book2
| topic: secondfix
o [6:6efc0524f97a] Fixing second
| topic: secondfix
o [5:0a4244c62a16] Fixing first
| topic: secondfix
| o [4:ca8825a7eb18] Second commit
|/ topic: hellos
o [0:3caf92e45cfb] First commit
$ hg debugconvertbookmark --all
skipping '7' as it has multiple bookmarks on it
$ hg log -G
@ [7:7c46b4bbdda3] Trying multiple bookmarks
| bookmark: book1
| bookmark:book2
| topic: secondfix
o [6:6efc0524f97a] Fixing second
| topic: secondfix
o [5:0a4244c62a16] Fixing first
| topic: secondfix
| o [4:ca8825a7eb18] Second commit
|/ topic: hellos
o [0:3caf92e45cfb] First commit