tests/test-topic-stack.t
branchmercurial-4.3
changeset 4077 9c025ec4af88
parent 3936 537fd9a86c06
parent 4076 f9a850018daa
child 4309 ef49e48da074
equal deleted inserted replaced
4033:b609412b42b0 4077:9c025ec4af88
    58   switching to topic other
    58   switching to topic other
    59   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
    59   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
    60   $ hg topic --list
    60   $ hg topic --list
    61   ### topic: other
    61   ### topic: other
    62   ### target: default (branch)
    62   ### target: default (branch)
    63   t2@ c_b (current)
    63   s2@ c_b (current)
    64   t1: c_a
    64   s1: c_a
    65   $ hg phase --public 'topic("other")'
    65   $ hg phase --public 'topic("other")'
    66   active topic 'other' is now empty
    66   active topic 'other' is now empty
    67 
    67 
    68 After changing the phase of all the changesets in "other" to public, the topic should still be active, but is empty. We should be better at informating the user about it and displaying good data in this case.
    68 After changing the phase of all the changesets in "other" to public, the topic should still be active, but is empty. We should be better at informating the user about it and displaying good data in this case.
    69 
    69 
    72    * other (0 changesets)
    72    * other (0 changesets)
    73   $ hg stack
    73   $ hg stack
    74   ### topic: other
    74   ### topic: other
    75   ### target: default (branch)
    75   ### target: default (branch)
    76   (stack is empty)
    76   (stack is empty)
    77   t0^ c_b (base current)
    77   s0^ c_b (base current)
    78 
    78 
    79   $ hg up foo
    79   $ hg up foo
    80   switching to topic foo
    80   switching to topic foo
    81   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
    81   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
    82 
    82 
    88   $ hg topic
    88   $ hg topic
    89    * foo (4 changesets)
    89    * foo (4 changesets)
    90   $ hg stack
    90   $ hg stack
    91   ### topic: foo
    91   ### topic: foo
    92   ### target: default (branch)
    92   ### target: default (branch)
    93   t4@ c_f (current)
    93   s4@ c_f (current)
    94   t3: c_e
    94   s3: c_e
    95   t2: c_d
    95   s2: c_d
    96   t1: c_c
    96   s1: c_c
    97   t0^ c_b (base)
    97   s0^ c_b (base)
    98   $ hg stack -v
    98   $ hg stack -v
    99   ### topic: foo
    99   ### topic: foo
   100   ### target: default (branch)
   100   ### target: default (branch)
   101   t4(6559e6d93aea)@ c_f (current)
   101   s4(6559e6d93aea)@ c_f (current)
   102   t3(0f9ac936c87d): c_e
   102   s3(0f9ac936c87d): c_e
   103   t2(e629654d7050): c_d
   103   s2(e629654d7050): c_d
   104   t1(8522f9e3fee9): c_c
   104   s1(8522f9e3fee9): c_c
   105   t0(ea705abc4f51)^ c_b (base)
   105   s0(ea705abc4f51)^ c_b (base)
   106   $ hg stack -Tjson | python -m json.tool
   106   $ hg stack -Tjson | python -m json.tool
   107   [
   107   [
   108       {
   108       {
   109           "isentry": true,
   109           "isentry": true,
   110           "topic.stack.desc": "c_f",
   110           "topic.stack.desc": "c_f",
   210   $ hg topics
   210   $ hg topics
   211    * foo (4 changesets)
   211    * foo (4 changesets)
   212   $ hg stack
   212   $ hg stack
   213   ### topic: foo
   213   ### topic: foo
   214   ### target: default (branch)
   214   ### target: default (branch)
   215   t4@ c_f (current)
   215   s4@ c_f (current)
   216   t3: c_e
   216   s3: c_e
   217   t2: c_d
   217   s2: c_d
   218   t1: c_c
   218   s1: c_c
   219   t0^ c_b (base)
   219   s0^ c_b (base)
   220   $ hg topics --config ui.strict=true
   220   $ hg topics --config ui.strict=true
   221    * foo (4 changesets)
   221    * foo (4 changesets)
   222   $ hg stack --config ui.strict=true
   222   $ hg stack --config ui.strict=true
   223   ### topic: foo
   223   ### topic: foo
   224   ### target: default (branch)
   224   ### target: default (branch)
   225   t4@ c_f (current)
   225   s4@ c_f (current)
   226   t3: c_e
   226   s3: c_e
   227   t2: c_d
   227   s2: c_d
   228   t1: c_c
   228   s1: c_c
   229   t0^ c_b (base)
   229   s0^ c_b (base)
   230 
   230 
   231 error case, nothing to list
   231 error case, nothing to list
   232 
   232 
   233   $ hg topic --clear
   233   $ hg topic --clear
   234   $ hg stack
   234   $ hg stack
   235   ### target: default (branch)
   235   ### target: default (branch)
   236   (stack is empty)
   236   (stack is empty)
   237   b0^ c_f (base current)
   237   s0^ c_f (base current)
   238 
   238 
   239 Test "t#" reference
   239 Test "t#" reference
   240 -------------------
   240 -------------------
   241 
   241 
   242 
   242 
   243   $ hg up t2
   243   $ hg up s2
   244   abort: cannot resolve "t2": no active topic
   244   abort: cannot resolve "s2": branch "default" has only 0 non-public changesets
   245   [255]
   245   [255]
   246   $ hg topic foo
   246   $ hg topic foo
   247   marked working directory as topic: foo
   247   marked working directory as topic: foo
   248   $ hg up t42
   248   $ hg up t42
   249   abort: cannot resolve "t42": topic "foo" has only 4 changesets
   249   abort: cannot resolve "t42": topic "foo" has only 4 changesets
   250   [255]
   250   [255]
   251   $ hg up t2
   251   $ hg up s42
       
   252   abort: cannot resolve "s42": topic "foo" has only 4 changesets
       
   253   [255]
       
   254   $ hg up s2
   252   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   255   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   253   $ hg summary
   256   $ hg summary
   254   parent: 3:e629654d7050 
   257   parent: 3:e629654d7050 
   255    c_d
   258    c_d
   256   branch: default
   259   branch: default
   280   o  0 default {} public c_a
   283   o  0 default {} public c_a
   281   
   284   
   282   $ hg topic --list
   285   $ hg topic --list
   283   ### topic: foo
   286   ### topic: foo
   284   ### target: default (branch)
   287   ### target: default (branch)
   285   t4$ c_f (unstable)
   288   s4$ c_f (unstable)
   286   t3$ c_e (unstable)
   289   s3$ c_e (unstable)
   287   t2@ c_d (current)
   290   s2@ c_d (current)
   288   t1: c_c
   291   s1: c_c
   289   t0^ c_b (base)
   292   s0^ c_b (base)
   290   $ hg up t3
   293   $ hg up s3
   291   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   294   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   292   $ hg topic --list
   295   $ hg topic --list
   293   ### topic: foo
   296   ### topic: foo
   294   ### target: default (branch)
   297   ### target: default (branch)
   295   t4$ c_f (unstable)
   298   s4$ c_f (unstable)
   296   t3$ c_e (current unstable)
   299   s3$ c_e (current unstable)
   297   t2: c_d
   300   s2: c_d
   298   t1: c_c
   301   s1: c_c
   299   t0^ c_b (base)
   302   s0^ c_b (base)
   300   $ hg topic --list --color=debug
   303   $ hg topic --list --color=debug
   301   [topic.stack.summary.topic|### topic: [topic.active|foo]]
   304   [topic.stack.summary.topic|### topic: [topic.active|foo]]
   302   [topic.stack.summary.branches|### target: default (branch)]
   305   [topic.stack.summary.branches|### target: default (branch)]
   303   [topic.stack.index topic.stack.index.unstable|t4][topic.stack.state topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.unstable|c_f][topic.stack.state topic.stack.state.unstable| (unstable)]
   306   [topic.stack.index topic.stack.index.unstable|s4][topic.stack.state topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.unstable|c_f][topic.stack.state topic.stack.state.unstable| (unstable)]
   304   [topic.stack.index topic.stack.index.current topic.stack.index.unstable|t3][topic.stack.state topic.stack.state.current topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.current topic.stack.desc.unstable|c_e][topic.stack.state topic.stack.state.current topic.stack.state.unstable| (current unstable)]
   307   [topic.stack.index topic.stack.index.current topic.stack.index.unstable|s3][topic.stack.state topic.stack.state.current topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.current topic.stack.desc.unstable|c_e][topic.stack.state topic.stack.state.current topic.stack.state.unstable| (current unstable)]
   305   [topic.stack.index topic.stack.index.clean|t2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d]
   308   [topic.stack.index topic.stack.index.clean|s2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d]
   306   [topic.stack.index topic.stack.index.clean|t1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c]
   309   [topic.stack.index topic.stack.index.clean|s1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c]
   307   [topic.stack.index topic.stack.index.base|t0][topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b][topic.stack.state topic.stack.state.base| (base)]
   310   [topic.stack.index topic.stack.index.base|s0][topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b][topic.stack.state topic.stack.state.base| (base)]
   308   $ hg up t2
   311   $ hg up s2
   309   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   312   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   310 
   313 
   311 Also test the revset:
   314 Also test the revset:
   312 
   315 
   313   $ hg log -r 'stack()'
   316   $ hg log -r 'stack()'
   378 Test output
   381 Test output
   379 
   382 
   380   $ hg top -l
   383   $ hg top -l
   381   ### topic: foo (2 heads)
   384   ### topic: foo (2 heads)
   382   ### target: default (branch)
   385   ### target: default (branch)
   383   t6: c_f
   386   s6: c_f
   384   t5: c_e
   387   s5: c_e
   385   t2^ c_d (base)
   388   s2^ c_d (base)
   386   t4@ c_h (current)
   389   s4@ c_h (current)
   387   t3: c_g
   390   s3: c_g
   388   t2: c_d
   391   s2: c_d
   389   t1: c_c
   392   s1: c_c
   390   t0^ c_b (base)
   393   s0^ c_b (base)
   391 
   394 
   392 Case with multiple heads on the topic with unstability involved
   395 Case with multiple heads on the topic with unstability involved
   393 ---------------------------------------------------------------
   396 ---------------------------------------------------------------
   394 
   397 
   395 We amend the message to make sure the display base pick the right changeset
   398 We amend the message to make sure the display base pick the right changeset
   422   
   425   
   423 
   426 
   424   $ hg topic --list
   427   $ hg topic --list
   425   ### topic: foo (2 heads)
   428   ### topic: foo (2 heads)
   426   ### target: default (branch)
   429   ### target: default (branch)
   427   t6$ c_f (unstable)
   430   s6$ c_f (unstable)
   428   t5$ c_e (unstable)
   431   s5$ c_e (unstable)
   429   t2^ c_D (base current)
   432   s2^ c_D (base current)
   430   t4: c_h
   433   s4: c_h
   431   t3: c_g
   434   s3: c_g
   432   t2@ c_D (current)
   435   s2@ c_D (current)
   433   t1: c_c
   436   s1: c_c
   434   t0^ c_b (base)
   437   s0^ c_b (base)
   435 
   438 
   436 Trying to list non existing topic
   439 Trying to list non existing topic
   437   $ hg stack thisdoesnotexist
   440   $ hg stack thisdoesnotexist
   438   abort: cannot resolve "thisdoesnotexist": no such topic found
   441   abort: cannot resolve "thisdoesnotexist": no such topic found
   439   [255]
   442   [255]
   546 XXX: The behind count is weird, because the topic are interleaved.
   549 XXX: The behind count is weird, because the topic are interleaved.
   547 
   550 
   548   $ hg stack
   551   $ hg stack
   549   ### topic: foobar
   552   ### topic: foobar
   550   ### target: default (branch), 3 behind
   553   ### target: default (branch), 3 behind
   551   t2@ c_e (current)
   554   s2@ c_e (current)
   552     ^ c_h
   555     ^ c_h
   553   t1: c_D
   556   s1: c_D
   554   t0^ c_c (base)
   557   s0^ c_c (base)
   555 
   558 
   556   $ hg stack foo
   559   $ hg stack foo
   557   ### topic: foo
   560   ### topic: foo
   558   ### target: default (branch), ambiguous rebase destination - topic 'foo' has 3 heads
   561   ### target: default (branch), ambiguous rebase destination - topic 'foo' has 3 heads
   559   t4: c_f
   562   s4: c_f
   560     ^ c_e
   563     ^ c_e
   561   t3: c_h
   564   s3: c_h
   562   t2: c_g
   565   s2: c_g
   563     ^ c_D
   566     ^ c_D
   564   t1: c_c
   567   s1: c_c
   565   t0^ c_b (base)
   568   s0^ c_b (base)
   566 
   569 
   567 case involving a merge
   570 case involving a merge
   568 ----------------------
   571 ----------------------
   569 
   572 
   570   $ cd ..
   573   $ cd ..
   636   
   639   
   637 
   640 
   638   $ hg stack red
   641   $ hg stack red
   639   ### topic: red
   642   ### topic: red
   640   ### target: default (branch), 6 behind
   643   ### target: default (branch), 6 behind
   641   t5: c_H
   644   s5: c_H
   642     ^ c_G
   645     ^ c_G
   643     ^ c_D
   646     ^ c_D
   644   t4: c_C
   647   s4: c_C
   645   t1^ c_B (base)
   648   s1^ c_B (base)
   646   t3: c_F
   649   s3: c_F
   647   t2: c_E
   650   s2: c_E
   648   t1: c_B
   651   s1: c_B
   649   t0^ c_A (base)
   652   s0^ c_A (base)
   650   $ hg stack blue
   653   $ hg stack blue
   651   ### topic: blue
   654   ### topic: blue
   652   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
   655   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
   653   t3@ c_I (current)
   656   s3@ c_I (current)
   654     ^ c_H
   657     ^ c_H
   655   t2: c_D
   658   s2: c_D
   656     ^ c_C
   659     ^ c_C
   657   t1: c_G
   660   s1: c_G
   658   t0^ c_F (base)
   661   s0^ c_F (base)
   659 
   662 
   660 Even with some obsolete and orphan changesets
   663 Even with some obsolete and orphan changesets
   661 
   664 
   662 (the ordering of each branch of "blue" change because their hash change. we
   665 (the ordering of each branch of "blue" change because their hash change. we
   663 should stabilize this eventuelly)
   666 should stabilize this eventuelly)
   701   
   704   
   702 
   705 
   703   $ hg stack red
   706   $ hg stack red
   704   ### topic: red
   707   ### topic: red
   705   ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
   708   ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
   706   t5$ c_H (unstable)
   709   s5$ c_H (unstable)
   707     ^ c_G
   710     ^ c_G
   708     ^ c_D
   711     ^ c_D
   709   t4$ c_C (unstable)
   712   s4$ c_C (unstable)
   710   t1^ c_B (base)
   713   s1^ c_B (base)
   711   t3$ c_F (unstable)
   714   s3$ c_F (unstable)
   712   t2$ c_E (unstable)
   715   s2$ c_E (unstable)
   713   t1: c_B
   716   s1: c_B
   714   t0^ c_A (base)
   717   s0^ c_A (base)
   715   $ hg stack blue
   718   $ hg stack blue
   716   ### topic: blue
   719   ### topic: blue
   717   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
   720   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
   718   t3$ c_I (unstable)
   721   s3$ c_I (unstable)
   719     ^ c_H
   722     ^ c_H
   720   t2$ c_G (unstable)
   723   s2$ c_G (unstable)
   721     ^ c_F
   724     ^ c_F
   722   t1$ c_D (current unstable)
   725   s1$ c_D (current unstable)
   723   t0^ c_C (base unstable)
   726   s0^ c_C (base unstable)
   724 
   727 
   725 more obsolescence
   728 more obsolescence
   726 
   729 
   727   $ hg up 'max(desc("c_H"))'
   730   $ hg up 'max(desc("c_H"))'
   728   switching to topic red
   731   switching to topic red
   775   
   778   
   776 
   779 
   777   $ hg stack red
   780   $ hg stack red
   778   ### topic: red
   781   ### topic: red
   779   ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
   782   ### target: default (branch), ambiguous rebase destination - topic 'red' has 3 heads
   780   t5$ c_H (unstable)
   783   s5$ c_H (unstable)
   781     ^ c_G
   784     ^ c_G
   782     ^ c_D
   785     ^ c_D
   783   t4$ c_F (unstable)
   786   s4$ c_F (unstable)
   784   t3$ c_E (unstable)
   787   s3$ c_E (unstable)
   785   t1^ c_B (base)
   788   s1^ c_B (base)
   786   t2$ c_C (unstable)
   789   s2$ c_C (unstable)
   787   t1: c_B
   790   s1: c_B
   788   t0^ c_A (base)
   791   s0^ c_A (base)
   789   $ hg stack blue
   792   $ hg stack blue
   790   ### topic: blue
   793   ### topic: blue
   791   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
   794   ### target: default (branch), ambiguous rebase destination - topic 'blue' has 3 heads
   792   t3$ c_I (unstable)
   795   s3$ c_I (unstable)
   793     ^ c_H
   796     ^ c_H
   794   t2$ c_G (unstable)
   797   s2$ c_G (unstable)
   795     ^ c_F
   798     ^ c_F
   796   t1$ c_D (current unstable)
   799   s1$ c_D (current unstable)
   797   t0^ c_C (base unstable)
   800   s0^ c_C (base unstable)
   798 
   801 
   799 Test stack behavior with a split
   802 Test stack behavior with a split
   800 --------------------------------
   803 --------------------------------
   801 
   804 
   802 get things linear again
   805 get things linear again
   803 
   806 
   804   $ hg rebase -r t1 -d default
   807   $ hg rebase -r s1 -d default
   805   rebasing 16:1d84ec948370 "c_D" (tip)
   808   rebasing 16:1d84ec948370 "c_D" (tip)
   806   switching to topic blue
   809   switching to topic blue
   807   $ hg rebase -r t2 -d t1
   810   $ hg rebase -r s2 -d s1
   808   rebasing 13:3ab2eedae500 "c_G"
   811   rebasing 13:3ab2eedae500 "c_G"
   809   $ hg rebase -r t3 -d t2
   812   $ hg rebase -r s3 -d s2
   810   rebasing 8:3bfe800e0486 "c_I"
   813   rebasing 8:3bfe800e0486 "c_I"
   811   $ hg stack
   814   $ hg stack
   812   ### topic: blue
   815   ### topic: blue
   813   ### target: default (branch)
   816   ### target: default (branch)
   814   t3: c_I
   817   s3: c_I
   815   t2: c_G
   818   s2: c_G
   816   t1@ c_D (current)
   819   s1@ c_D (current)
   817   t0^ c_A (base)
   820   s0^ c_A (base)
   818 
   821 
   819 making a split
   822 making a split
   820 (first get something to split)
   823 (first get something to split)
   821 
   824 
   822   $ hg up t2
   825   $ hg up s2
   823   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   826   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   824   $ hg status --change .
   827   $ hg status --change .
   825   A ggg
   828   A ggg
   826   $ echo zzz > Z
   829   $ echo zzz > Z
   827   $ hg add Z
   830   $ hg add Z
   830   A Z
   833   A Z
   831   A ggg
   834   A ggg
   832   $ hg stack
   835   $ hg stack
   833   ### topic: blue
   836   ### topic: blue
   834   ### target: default (branch)
   837   ### target: default (branch)
   835   t3$ c_I (unstable)
   838   s3$ c_I (unstable)
   836   t2@ c_G (current)
   839   s2@ c_G (current)
   837   t1: c_D
   840   s1: c_D
   838   t0^ c_A (base)
   841   s0^ c_A (base)
   839   $ hg --config extensions.evolve=  --config ui.interactive=yes split << EOF
   842   $ hg --config extensions.evolve=  --config ui.interactive=yes split << EOF
   840   > y
   843   > y
   841   > y
   844   > y
   842   > n
   845   > n
   843   > y
   846   > y
   910 Check that stack ouput still make sense
   913 Check that stack ouput still make sense
   911 
   914 
   912   $ hg stack
   915   $ hg stack
   913   ### topic: blue
   916   ### topic: blue
   914   ### target: default (branch)
   917   ### target: default (branch)
   915   t4$ c_I (unstable)
   918   s4$ c_I (unstable)
   916   t3@ c_G (current)
   919   s3@ c_G (current)
   917   t2: c_G
   920   s2: c_G
   918   t1: c_D
   921   s1: c_D
   919   t0^ c_A (base)
   922   s0^ c_A (base)