tests/test-topic.t
branchmercurial-4.5
changeset 4075 dc247e648f43
parent 3924 f3713d41b85b
parent 4074 eb4d07a0b19f
child 4076 f9a850018daa
child 4172 35c21ab64420
equal deleted inserted replaced
4031:9a2db13b2e99 4075:dc247e648f43
    38   
    38   
    39   The 'stack' will show you information about the stack of commit belonging to
    39   The 'stack' will show you information about the stack of commit belonging to
    40   your current topic.
    40   your current topic.
    41   
    41   
    42   Topic is offering you aliases reference to changeset in your current topic
    42   Topic is offering you aliases reference to changeset in your current topic
    43   stack as 't#'. For example, 't1' refers to the root of your stack, 't2' to the
    43   stack as 's#'. For example, 's1' refers to the root of your stack, 's2' to the
    44   second commits, etc. The 'hg stack' command show these number.
    44   second commits, etc. The 'hg stack' command show these number. 's0' can be
       
    45   used to refer to the parent of the topic root. Updating using 'hg up s0' will
       
    46   keep the topic active.
    45   
    47   
    46   Push behavior will change a bit with topic. When pushing to a publishing
    48   Push behavior will change a bit with topic. When pushing to a publishing
    47   repository the changesets will turn public and the topic data on them will
    49   repository the changesets will turn public and the topic data on them will
    48   fade away. The logic regarding pushing new heads will behave has before,
    50   fade away. The logic regarding pushing new heads will behave has before,
    49   ignore any topic related data. When pushing to a non-publishing repository
    51   ignore any topic related data. When pushing to a non-publishing repository
   269    * narf (on branch: default, 0 changesets)
   271    * narf (on branch: default, 0 changesets)
   270   $ hg stack
   272   $ hg stack
   271   ### topic: narf
   273   ### topic: narf
   272   ### target: default (branch)
   274   ### target: default (branch)
   273   (stack is empty)
   275   (stack is empty)
   274   t0^ Add file delta (base current)
   276   s0^ Add file delta (base current)
   275 
   277 
   276 Add commits to topic
   278 Add commits to topic
   277 
   279 
   278   $ echo topic work >> alpha
   280   $ echo topic work >> alpha
   279   $ hg ci -m 'start on narf'
   281   $ hg ci -m 'start on narf'
   692      user:        test
   694      user:        test
   693      date:        Thu Jan 01 00:00:00 1970 +0000
   695      date:        Thu Jan 01 00:00:00 1970 +0000
   694      summary:     Add file alpha
   696      summary:     Add file alpha
   695   
   697   
   696 No matches because narf is already closed:
   698 No matches because narf is already closed:
   697   $ hg log -r 'topic(narf)' -G
   699   $ hg log -r 'topic("narf")' -G
   698 This regexp should match the topic `fran`:
   700 This regexp should match the topic `fran`:
   699   $ hg log -r 'topic("re:.ra.")' -G
   701   $ hg log -r 'topic("re:.ra.")' -G
   700   o  changeset:   9:0469d521db49
   702   o  changeset:   9:0469d521db49
   701   |  tag:         tip
   703   |  tag:         tip
   702   |  topic:       fran
   704   |  topic:       fran
   732   user:        test
   734   user:        test
   733   date:        Thu Jan 01 00:00:00 1970 +0000
   735   date:        Thu Jan 01 00:00:00 1970 +0000
   734   summary:     start on fran
   736   summary:     start on fran
   735   
   737   
   736 
   738 
       
   739 Using revsets in topic()
       
   740   $ tlog() {
       
   741   >   hg log -T '{rev}: {topic}\n' -r "$1"
       
   742   > }
       
   743 
       
   744   $ tlog 'topic(9)'
       
   745   9: fran
       
   746   $ tlog 'topic(8)'
       
   747   $ tlog 'topic(head())'
       
   748   9: fran
       
   749   $ tlog 'topic(:)'
       
   750   9: fran
       
   751   $ tlog 'topic(all())'
       
   752   9: fran
       
   753   $ tlog 'topic(topic(fran))'
       
   754   9: fran
       
   755   $ tlog 'topic(wdir())'
       
   756   9: fran
       
   757   $ tlog 'topic(nonsense)'
       
   758   abort: unknown revision 'nonsense'!
       
   759   [255]
       
   760 
       
   761 Pattern matching in topic() revset
       
   762   $ tlog 'topic("re:nonsense")'
       
   763   $ tlog 'topic("literal:nonsense")'
       
   764   abort: topic 'nonsense' does not exist!
       
   765   [255]
       
   766 
   737 Deactivate the topic.
   767 Deactivate the topic.
   738   $ hg topics
   768   $ hg topics
   739    * fran (1 changesets)
   769    * fran (1 changesets)
   740   $ hg topics --clear
   770   $ hg topics --clear
       
   771   $ hg log -r 'topic(wdir())'
   741   $ echo fran? >> beta
   772   $ echo fran? >> beta
   742   $ hg ci -m 'fran?'
   773   $ hg ci -m 'fran?'
   743   created new head
   774   created new head
   744   (consider using topic for lightweight branches. See 'hg help topic')
   775   (consider using topic for lightweight branches. See 'hg help topic')
   745   $ hg log -Gr 'draft()'
   776   $ hg log -Gr 'draft()'
   758   |
   789   |
   759 
   790 
   760   $ hg topics
   791   $ hg topics
   761      fran (1 changesets)
   792      fran (1 changesets)
   762 
   793 
   763 Testing for updating to t0
   794 Testing for updating to s0
   764 ==========================
   795 ==========================
   765 
   796 
   766   $ hg up fran
   797   $ hg up fran
   767   switching to topic fran
   798   switching to topic fran
   768   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   799   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   769   $ hg stack
   800   $ hg stack
   770   ### topic: fran
   801   ### topic: fran
   771   ### target: default (branch), ambiguous rebase destination - branch 'default' has 2 heads
   802   ### target: default (branch), ambiguous rebase destination - branch 'default' has 2 heads
   772   t1@ start on fran (current)
   803   s1@ start on fran (current)
   773   t0^ Add file delta (base)
   804   s0^ Add file delta (base)
   774 
   805 
   775   $ hg up t0
   806   $ hg up s0
   776   preserving the current topic 'fran'
   807   preserving the current topic 'fran'
   777   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   808   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   778 
   809 
   779   $ hg topic
   810   $ hg topic
   780    * fran (1 changesets)
   811    * fran (1 changesets)
   781   $ hg stack
   812   $ hg stack
   782   ### topic: fran
   813   ### topic: fran
   783   ### target: default (branch), ambiguous rebase destination - branch 'default' has 2 heads
   814   ### target: default (branch), ambiguous rebase destination - branch 'default' has 2 heads
   784   t1: start on fran
   815   s1: start on fran
   785   t0^ Add file delta (base current)
   816   s0^ Add file delta (base current)
   786 
   817 
   787   $ hg topics --age
   818   $ hg topics --age
   788    * fran (1970-01-01 by test)
   819    * fran (1970-01-01 by test)
   789 
   820 
   790   $ cd ..
   821   $ cd ..