view tests/test-topic-stack.t @ 1900:27ea12c05e99

destination: fix 'hg pull --rebase' I'm not sure why sometime functions does not have func_default but this is easy to fix. I've added a test to catch such stuff it in the future.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 16 Mar 2016 12:14:20 -0700
parents 2b65c5a6591c
children f52c02bf47b7
line wrap: on
line source

  $ . "$TESTDIR/testlib"

Initial setup


  $ cat << EOF >> $HGRCPATH
  > [ui]
  > logtemplate = {rev} {branch} \{{get(namespaces, "topics")}} {phase} {desc|firstline}\n
  > [experimental]
  > evolution=createmarkers,exchange,allowunstable
  > EOF

(new head warning seems buggy)
  $ hg init main
  $ cd main
  $ echo aaa > aaa
  $ hg add aaa
  $ hg commit -m c_a
  $ echo aaa > bbb
  $ hg add bbb
  $ hg commit -m c_b
  $ hg topic foo
  $ echo aaa > ccc
  $ hg add ccc
  $ hg commit -m c_c
  $ echo aaa > ddd
  $ hg add ddd
  $ hg commit -m c_d
  created new head
  $ echo aaa > eee
  $ hg add eee
  $ hg commit -m c_e
  created new head
  $ echo aaa > fff
  $ hg add fff
  $ hg commit -m c_f
  created new head
  $ hg log -G
  @  5 default {foo} draft c_f
  |
  o  4 default {foo} draft c_e
  |
  o  3 default {foo} draft c_d
  |
  o  2 default {foo} draft c_c
  |
  o  1 default {} draft c_b
  |
  o  0 default {} draft c_a
  

Simple test
-----------

hg topic -l list all changeset in the topic

  $ hg topic
   * foo
  $ hg topic --list
  0: c_c
  1: c_d
  2: c_e
  3: c_f

error case, nothing to list

  $ hg topic --clear
  $ hg topic --list
  abort: no active topic to list
  [255]

Case with some of the topic unstable
------------------------------------

  $ hg up 'desc(c_d)'
  switching to topic foo
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ echo bbb > ddd
  $ hg commit --amend
  $ hg log -G
  @  7 default {foo} draft c_d
  |
  | o  5 default {foo} draft c_f
  | |
  | o  4 default {foo} draft c_e
  | |
  | x  3 default {foo} draft c_d
  |/
  o  2 default {foo} draft c_c
  |
  o  1 default {} draft c_b
  |
  o  0 default {} draft c_a
  
  $ hg topic --list
  0: c_c
  1: c_d
  2: c_e
  3: c_f