--- a/tests/test-split.t Tue Jun 27 09:49:35 2017 +0200
+++ b/tests/test-split.t Tue Jun 27 15:21:38 2017 +0200
@@ -385,3 +385,84 @@
$ hg commit -m "empty"
$ hg split
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Check that split keeps the right topic
+
+ $ hg up -r tip
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Add topic to the hgrc
+
+ $ echo "[extensions]" >> $HGRCPATH
+ $ echo "topic=$(echo $(dirname $TESTDIR))/hgext3rd/topic/" >> $HGRCPATH
+ $ hg topic mytopic
+ $ echo babar > babar
+ $ echo celeste > celeste
+ $ hg add babar celeste
+ $ hg commit -m "Works on mytopic" babar celeste
+ $ hg summary
+ parent: 21:615c369f47f0 tip
+ Works on mytopic
+ branch: new-branch
+ commit: 2 unknown (clean)
+ update: (current)
+ phases: 9 draft
+ topic: mytopic
+
+Split it
+
+ $ hg split << EOF
+ > Y
+ > Y
+ > N
+ > Y
+ > Y
+ > Y
+ > EOF
+ 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+ adding babar
+ adding celeste
+ diff --git a/babar b/babar
+ new file mode 100644
+ examine changes to 'babar'? [Ynesfdaq?] Y
+
+ @@ -0,0 +1,1 @@
+ +babar
+ record change 1/2 to 'babar'? [Ynesfdaq?] Y
+
+ diff --git a/celeste b/celeste
+ new file mode 100644
+ examine changes to 'celeste'? [Ynesfdaq?] N
+
+ Done splitting? [yN] Y
+ diff --git a/celeste b/celeste
+ new file mode 100644
+ examine changes to 'celeste'? [Ynesfdaq?] Y
+
+ @@ -0,0 +1,1 @@
+ +celeste
+ record this change to 'celeste'? [Ynesfdaq?] Y
+
+ no more change to split
+
+Check that the topic is still here
+
+ $ hg log -r "tip~1::"
+ changeset: 22:f879ab83f991
+ branch: new-branch
+ topic: mytopic
+ parent: 20:89e64a2c68b3
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: split7
+
+ changeset: 23:db75dbc1a3a6
+ branch: new-branch
+ tag: tip
+ topic: mytopic
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: split8
+
+ $ hg topic
+ * mytopic