tests/test-stack.t
author Gregory Szorc <gregory.szorc@gmail.com>
Wed, 14 Mar 2018 15:25:06 -0700
changeset 37055 8c3c47362934
parent 37007 68fcc5503ec5
permissions -rw-r--r--
wireproto: implement basic frame reading and processing We just implemented support for writing frames. Now let's implement support for reading them. The bulk of the new code is for a class that maintains the state of a server. Essentially, you construct an instance, feed frames to it, and it tells you what you should do next. The design is inspired by the "sans I/O" movement and the reactor pattern. We don't want to perform I/O or any major blocking event during frame ingestion because this arbitrarily limits ways that server pieces can be implemented. For example, it makes it much harder to swap in an alternate implementation based on asyncio or do crazy things like have requests dispatch to other processes. We do still implement readframe() which does I/O. But it is decoupled from the server reactor. And important parsing of frame headers is a standalone function. So I/O is only needed to obtain frame data. Because testing server-side ingest is useful and difficult on running servers, we create a new "debugreflect" endpoint that will echo back to the client what was received and how it was interpreted. This could be useful for a server admin, someone implementing a client. But immediately, it is useful for testing: we're able to demonstrate that frames are parsed correctly and turned into requests to run commands without having to implement command dispatch on the server! In addition, we implement Python level unit tests for the reactor. This is vastly more efficient than sending requests to the "debugreflect" endpoint and vastly more powerful for advanced testing. Differential Revision: https://phab.mercurial-scm.org/D2852
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37004
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     2
This test test the low-level definition of stack, agnostic from all formatting
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     3
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     4
Initial setup
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     6
  $ cat << EOF >> $HGRCPATH
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     7
  > [ui]
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     8
  > logtemplate = {rev} {branch} {phase} {desc|firstline}\n
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     9
  > [extensions]
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    10
  > rebase=
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    11
  > [experimental]
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    12
  > evolution=createmarkers,exchange,allowunstable
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    13
  > EOF
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    14
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    15
  $ hg init main
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    16
  $ cd main
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    17
  $ hg branch other
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    18
  marked working directory as branch other
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    19
  (branches are permanent and global, did you want a bookmark?)
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    20
  $ echo aaa > aaa
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    21
  $ hg add aaa
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    22
  $ hg commit -m c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    23
  $ echo aaa > bbb
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    24
  $ hg add bbb
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    25
  $ hg commit -m c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    26
  $ hg branch foo
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    27
  marked working directory as branch foo
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    28
  $ echo aaa > ccc
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    29
  $ hg add ccc
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    30
  $ hg commit -m c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    31
  $ echo aaa > ddd
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    32
  $ hg add ddd
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    33
  $ hg commit -m c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    34
  $ echo aaa > eee
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    35
  $ hg add eee
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    36
  $ hg commit -m c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    37
  $ echo aaa > fff
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    38
  $ hg add fff
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    39
  $ hg commit -m c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    40
  $ hg log -G
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    41
  @  5 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    42
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    43
  o  4 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    44
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    45
  o  3 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    46
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    47
  o  2 foo draft c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    48
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    49
  o  1 other draft c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    50
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    51
  o  0 other draft c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    52
  
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    53
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    54
Check that stack doesn't include public changesets
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    55
--------------------------------------------------
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    56
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    57
  $ hg up other
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    58
  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    59
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    60
  @  1 other draft c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    61
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    62
  o  0 other draft c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    63
  
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    64
  $ hg phase --public 'branch("other")'
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    65
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    66
  $ hg up foo
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    67
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    68
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    69
Simple test
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    70
-----------
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    71
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    72
'stack()' list all changeset in the branch
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    73
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    74
  $ hg branch
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    75
  foo
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    76
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    77
  @  5 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    78
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    79
  o  4 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    80
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    81
  o  3 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    82
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    83
  o  2 foo draft c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    84
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    85
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    86
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    87
Case with some of the branch unstable
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    88
------------------------------------
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    89
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    90
  $ hg up 3
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    91
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    92
  $ echo bbb > ddd
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    93
  $ hg commit --amend
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    94
  2 new orphan changesets
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    95
  $ hg log -G
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    96
  @  6 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    97
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    98
  | *  5 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    99
  | |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   100
  | *  4 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   101
  | |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   102
  | x  3 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   103
  |/
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   104
  o  2 foo draft c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   105
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   106
  o  1 other public c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   107
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   108
  o  0 other public c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   109
  
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   110
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   111
  @  6 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   112
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   113
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   114
  $ hg up -r "desc(c_e)"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   115
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   116
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   117
  @  4 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   118
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   119
  x  3 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   120
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   121
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   122
  $ hg up -r "desc(c_d)"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   123
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   124
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   125
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   126
  @  6 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   127
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   128
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   129
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   130
Case with multiple topological heads
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   131
------------------------------------
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   132
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   133
Make things linear again
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   134
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   135
  $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   136
  rebasing 4:4f2a69f6d380 "c_e"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   137
  rebasing 5:913c298d8b0a "c_f"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   138
  $ hg log -G
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   139
  o  8 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   140
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   141
  o  7 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   142
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   143
  @  6 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   144
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   145
  o  2 foo draft c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   146
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   147
  o  1 other public c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   148
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   149
  o  0 other public c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   150
  
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   151
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   152
Create the second branch
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   153
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   154
  $ hg up 'desc(c_d)'
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   155
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   156
  $ echo aaa > ggg
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   157
  $ hg add ggg
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   158
  $ hg commit -m c_g
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   159
  created new head
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   160
  $ echo aaa > hhh
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   161
  $ hg add hhh
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   162
  $ hg commit -m c_h
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   163
  $ hg log -G
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   164
  @  10 foo draft c_h
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   165
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   166
  o  9 foo draft c_g
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   167
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   168
  | o  8 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   169
  | |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   170
  | o  7 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   171
  |/
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   172
  o  6 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   173
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   174
  o  2 foo draft c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   175
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   176
  o  1 other public c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   177
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   178
  o  0 other public c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   179
  
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   180
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   181
Test output
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   182
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   183
  $ hg log -G -r "stack(10)"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   184
  @  10 foo draft c_h
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   185
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   186
  o  9 foo draft c_g
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   187
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   188
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   189
  $ hg log -G -r "stack(8)"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   190
  o  8 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   191
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   192
  o  7 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   193
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   194
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   195
  $ hg log -G -r "stack(head())"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   196
  @  10 foo draft c_h
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   197
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   198
  o  9 foo draft c_g
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   199
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   200
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   201
  o  8 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   202
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   203
  o  7 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   204
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   205
  ~
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   206
Check the stack order
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   207
  $ hg log -r "first(stack())"
37007
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37004
diff changeset
   208
  9 foo draft c_g
37004
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   209
  $ hg log -r "first(stack(10))"
37007
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37004
diff changeset
   210
  9 foo draft c_g
37004
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   211
  $ hg log -r "first(stack(8))"
37007
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37004
diff changeset
   212
  7 foo draft c_e
37004
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   213
  $ hg log -r "first(stack(head()))"
37007
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37004
diff changeset
   214
  7 foo draft c_e
37004
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   215
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   216
Case with multiple heads with unstability involved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   217
--------------------------------------------------
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   218
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   219
We amend the message to make sure the display base pick the right changeset
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   220
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   221
  $ hg up 'desc(c_d)'
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   222
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   223
  $ echo ccc > ddd
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   224
  $ hg commit --amend -m 'c_D'
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   225
  4 new orphan changesets
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   226
  $ hg rebase -d . -s 'desc(c_g)'
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   227
  rebasing 9:2ebb6e48ab8a "c_g"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   228
  rebasing 10:634f38e27a1d "c_h"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   229
  $ hg log -G
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   230
  o  13 foo draft c_h
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   231
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   232
  o  12 foo draft c_g
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   233
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   234
  @  11 foo draft c_D
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   235
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   236
  | *  8 foo draft c_f
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   237
  | |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   238
  | *  7 foo draft c_e
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   239
  | |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   240
  | x  6 foo draft c_d
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   241
  |/
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   242
  o  2 foo draft c_c
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   243
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   244
  o  1 other public c_b
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   245
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   246
  o  0 other public c_a
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   247
  
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   248
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   249
We should improve stack definition to also show 12 and 13 here
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   250
  $ hg log -G -r "stack()"
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   251
  @  11 foo draft c_D
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   252
  |
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   253
  ~