diff tests/test-topic.t @ 3037:5c8d5f980f49

tests: add a new test for testing changing or clearing topics test-topic.t is getting bigger and bigger. This patch introduces a new test which includes test for clearing and changing topics. Since the tests are moved to a new file, this patch, removes those tests from test-topic.t also.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 05 Oct 2017 18:13:52 +0530
parents b220e2f5ebd5
children f43a310c4338
line wrap: on
line diff
--- a/tests/test-topic.t	Tue Oct 03 11:14:29 2017 -0700
+++ b/tests/test-topic.t	Thu Oct 05 18:13:52 2017 +0530
@@ -502,10 +502,6 @@
   $ hg topics
      fran
 
---clear when we don't have an active topic isn't an error:
-
-  $ hg topics --clear
-
 Topic revset
   $ hg log -r 'topic()' -G
   o  changeset:   9:0469d521db49
@@ -628,284 +624,36 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     start on fran
   |
+
   $ hg topics
      fran
-Changing topic fails if we don't give a topic
-  $ hg topic --rev 9
-  abort: changing topic requires a topic name or --clear
-  [255]
-
-Can't change topic of a public change
-  $ hg topic --rev 1:: --clear
-  abort: can't change topic of a public change
-  [255]
-
-Can clear topics
-  $ hg topic --rev 9 --clear
-  changed topic on 1 changes
-  $ hg log -Gr 'draft() and not obsolete()'
-  o  changeset:   11:0beca5ab56c3
-  |  tag:         tip
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-  | @  changeset:   10:4073470c35e1
-  | |  user:        test
-  | |  date:        Thu Jan 01 00:00:00 1970 +0000
-  | |  instability: orphan
-  | |  summary:     fran?
-  | |
-
-Normally you'd do this with evolve, but we'll use rebase to avoid
-bonus deps in the testsuite.
-
-  $ hg rebase -d tip -s .
-  rebasing 10:4073470c35e1 "fran?"
-
-Can add a topic to an existing change
-  $ hg topic
-  $ hg sum
-  parent: 12:18b70b8de1f0 tip
-   fran?
-  branch: default
-  commit: (clean)
-  update: 5 new changesets, 2 branch heads (merge)
-  phases: 2 draft
-  $ hg topic --rev 11 wat
-  changed topic on 1 changes
-  $ hg log -r .
-  changeset:   12:18b70b8de1f0
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  instability: orphan
-  summary:     fran?
-  
-  $ hg sum
-  parent: 12:18b70b8de1f0  (orphan)
-   fran?
-  branch: default
-  commit: (clean)
-  update: 5 new changesets, 2 branch heads (merge)
-  phases: 3 draft
-  orphan: 1 changesets
-  $ hg topic
-     wat
-  $ hg log -Gr 'draft() and not obsolete()'
-  o  changeset:   13:686a642006db
-  |  tag:         tip
-  |  topic:       wat
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-  | @  changeset:   12:18b70b8de1f0
-  | |  user:        test
-  | |  date:        Thu Jan 01 00:00:00 1970 +0000
-  | |  instability: orphan
-  | |  summary:     fran?
-  | |
-
-Normally you'd do this with evolve, but we'll use rebase to avoid
-bonus deps in the testsuite.
-
-  $ hg topic
-     wat
-  $ hg rebase -d tip -s .
-  rebasing 12:18b70b8de1f0 "fran?"
-  switching to topic wat
-  $ hg topic
-     wat
-
-  $ hg log -Gr 'draft()'
-  @  changeset:   14:45358f7a5892
-  |  tag:         tip
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     fran?
-  |
-  o  changeset:   13:686a642006db
-  |  topic:       wat
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-
-Amend a topic
-
-  $ hg topic watwat
-  marked working directory as topic: watwat
-  $ hg ci --amend
-  active topic 'watwat' grew its first changeset
-  $ hg log -Gr 'draft()'
-  @  changeset:   15:6c40a4c21bbe
-  |  tag:         tip
-  |  topic:       watwat
-  |  parent:      13:686a642006db
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     fran?
-  |
-  o  changeset:   13:686a642006db
-  |  topic:       wat
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-
-Clear and amend:
-
-  $ hg topic --clear
-  $ hg ci --amend
-  $ hg log -r .
-  changeset:   16:0f9cd5070654
-  tag:         tip
-  parent:      13:686a642006db
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     fran?
-  
-Reading the same topic with topic --rev should work:
-  $ hg topic --rev . watwat
-  switching to topic watwat
-  changed topic on 1 changes
-
-Testing issue5441
-  $ hg co 17
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg log -Gr 'draft()'
-  @  changeset:   17:980a0f608481
-  |  tag:         tip
-  |  topic:       watwat
-  |  parent:      13:686a642006db
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     fran?
-  |
-  o  changeset:   13:686a642006db
-  |  topic:       wat
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-
-Using the current flag
-
-  $ hg topic changewat
-  $ hg topics --rev '13::17' --current
-  active topic 'changewat' grew its 2 first changesets
-  changed topic on 2 changes
-
-  $ hg log -Gr 'draft()'
-  @  changeset:   19:56c83be6105f
-  |  tag:         tip
-  |  topic:       changewat
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     fran?
-  |
-  o  changeset:   18:ceba5be9d56f
-  |  topic:       changewat
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-
-Case with branching:
-
-  $ hg up changewat
-  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg up t1
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ echo gamma >> gamma
-  $ hg ci -m gamma
-
-  $ hg log -Gr 'draft()'
-  @  changeset:   20:0d3d805542b4
-  |  tag:         tip
-  |  topic:       changewat
-  |  parent:      18:ceba5be9d56f
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     gamma
-  |
-  | o  changeset:   19:56c83be6105f
-  |/   topic:       changewat
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     fran?
-  |
-  o  changeset:   18:ceba5be9d56f
-  |  topic:       changewat
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
-
-  $ hg topics --rev 't1::' changewut
-  switching to topic changewut
-  active topic 'changewat' is now empty
-  changed topic on 3 changes
-
-  $ hg log -Gr 'draft()'
-  @  changeset:   23:729ed5717393
-  |  tag:         tip
-  |  topic:       changewut
-  |  parent:      21:62e49f09f883
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     gamma
-  |
-  | o  changeset:   22:369c6e2e5474
-  |/   topic:       changewut
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     fran?
-  |
-  o  changeset:   21:62e49f09f883
-  |  topic:       changewut
-  |  parent:      3:a53952faf762
-  |  user:        test
-  |  date:        Thu Jan 01 00:00:00 1970 +0000
-  |  summary:     start on fran
-  |
 
 Testing for updating to t0
 ==========================
 
+  $ hg up fran
+  switching to topic fran
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg stack
-  ### topic: changewut (2 heads)
-  ### target: default (branch), 5 behind
-  t3: fran?
-  t1^ start on fran (base)
-  t2@ gamma (current)
-  t1: start on fran
+  ### topic: fran
+  ### target: default (branch), ambigious rebase destination - branch 'default' has 2 heads
+  t1@ start on fran (current)
   t0^ Add file delta (base)
 
   $ hg up t0
-  preserving the current topic 'changewut'
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  preserving the current topic 'fran'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg topic
-   * changewut
+   * fran
   $ hg stack
-  ### topic: changewut (2 heads)
-  ### target: default (branch), 5 behind
-  t3: fran?
-  t1^ start on fran (base)
-  t2: gamma
+  ### topic: fran
+  ### target: default (branch), ambigious rebase destination - branch 'default' has 2 heads
   t1: start on fran
   t0^ Add file delta (base)
 
   $ hg topics --age
-   * changewut (1970-01-01 by test)
+   * fran (1970-01-01 by test)
 
   $ cd ..