tests/test-stack.t
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 24 Sep 2018 09:41:42 -0700
changeset 39861 db5501d93bcf
parent 37004 68fcc5503ec5
permissions -rw-r--r--
changegroup: remove reordering control (BC) This logic - including the experimental bundle.reorder option - was originally added in a8e3931e3fb5 in 2011 and then later ported to changegroup.py. The intent of this option and associated logic is to control the ordering of revisions in deltagroups in changegroups. At the time it was implemented, only changegroup version 1 existed and generaldelta revlogs were just coming into the world. Changegroup version 1 requires that deltas be made against the last revision sent over the wire. Used with generaldelta, this created an impedance mismatch of sorts and resulted in changegroup producers spending a lot of time recomputing deltas. Revision reordering was introduced so outgoing revisions would be sent in "generaldelta order" and producers would be able to reuse internal deltas from storage. Later on, we introduced changegroup version 2. It supported denoting which revision a delta was against. So we no longer needed to sort outgoing revisions to ensure optimal delta generation from the producer. So, subsequent changegroup versions disabled reordering. We also later made the changelog not store deltas by default. And we also made the changelog send out deltas in storage order. Why we do this for changelog, I'm not sure. Maybe we want to preserve revision order across clones? It doesn't really matter for this commit. Fast forward to 2018. We want to abstract storage backends. And having changegroup code require knowledge about how deltas are stored internally interferes with that goal. This commit removes reordering control from changegroup generation. After this commit, the reordering behavior is: * The changelog is always sent out in storage order (no behavior change). * Non-changelog generaldelta revlogs are reordered to always be in DAG topological order (previously, generaldelta revlogs would be emitted in storage order for version 2 and 3 changegroups). * Non-changelog non-generaldelta revlogs are sent in storage order (no behavior change). * There exists no config option to override behavior. The big difference here is that generaldelta revlogs now *always* have their revisions sorted in DAG order before going out over the wire. This behavior was previously only done for changegroup version 1. Version 2 and version 3 changegroups disabled reordering because the interchange format supported encoding arbitrary delta parents, so reordering wasn't strictly necessary. I can think of a few significant implications for this change. Because changegroup receivers will now see non-changelog revisions in DAG order instead of storage order, the internal storage order of manifests and files may differ substantially between producer and consumer. I don't think this matters that much, since the storage order of manifests and files is largely hidden from users. Only the storage order of changelog matters (because `hg log` shows the changelog in storage order). I don't think there should be any controversy here. The reordering of revisions has implications for changegroup producers. Previously, generaldelta revlogs would be emitted in storage order. And in the common case, the internally-stored delta could effectively be copied from disk into the deltagroup delta. This meant that emitting delta groups for generaldelta revlogs would be mostly linear read I/O. This is desirable for performance. With us now reordering generaldelta revlog revisions in DAG order, the read operations may use more random I/O instead of sequential I/O. This could result in performance loss. But with the prevalence of SSDs and fast random I/O, I'm not too worried. (Note: the optimal emission order for revlogs is actually delta encoding order. But the changegroup code wasn't doing that before or after this change. We could potentially implement that in a later commit.) Changegroups in DAG order will have implications for receivers. Previously, receiving storage order might mean seeing a number of interleaved branches. This would mean long delta chains, sparse I/O, and possibly more fulltext revisions instead of deltas, blowing up storage storage. (This is the same set of problems that sparse revlogs aims to address.) With the producer now sending revisions in DAG order, the receiver also stores revisions in DAG order. That means revisions for the same DAG branch are all grouped together. And this should yield better storage outcomes. In other words, sending the reordered changegroup allows the receiver to have better storage order and for the producer to not propagate its (possibly sub-optimal) internal storage order. On the mozilla-unified repository, this change influences bundle generation: $ hg bundle -t none-v2 -a before: time: real 355.680 secs (user 256.790+0.000 sys 16.820+0.000) after: time: real 382.950 secs (user 281.700+0.000 sys 17.690+0.000) before: 7,150,228,967 bytes (uncompressed) after: 7,041,556,273 bytes (uncompressed) before: 1,669,063,234 bytes (zstd l=3) after: 1,628,598,830 bytes (zstd l=3) $ hg unbundle before: time: real 511.910 secs (user 466.750+0.000 sys 32.680+0.000) after: time: real 487.790 secs (user 443.940+0.000 sys 30.840+0.000) 00manifest.d size: source: 274,924,292 bytes before: 304,741,626 bytes after: 245,252,087 bytes .hg/store total file size: source: 2,649,133,490 before: 2,680,888,130 after: 2,627,875,673 We see the bundle size drop. That's probably because if a revlog internally isn't storing a delta, it will choose to delta against the last emitted revision. And on repos with interleaved branches (like mozilla-unified), the previous revision could be an unrelated branch and therefore be a large delta. But with this patch, the previous revision is likely p1 or p2 and a delta should be small. We also see the manifest size drop by ~50 MB. It's worth noting that the manifest actually *increased* in size by ~25 MB in the old strategy and decreased ~25 MB from its source in the new strategy. Again, my explanation for this is that the DAG ordering in the changegroup is resulting in better grouping of revisions in the receiver, which results in more compact delta chains and higher storage efficiency. Unbundle time also dropped. I suspect this is due to the revlog having to work less to compute deltas since the incoming deltas are more optimal. i.e. the receiver spends less time resolving fulltext revisions as incoming deltas bounce around between DAG branches and delta chains. We also see bundle generation time increase. This is not desirable. However, the regression is only significant on the original repository: if we generate a bundle from the repository created from the new, always reordered bundles, we're close to baseline (if not at it with expected noise): $ hg bundle -t none-v2 -a before (original): time: real 355.680 secs (user 256.790+0.000 sys 16.820+0.000) after (original): time: real 382.950 secs (user 281.700+0.000 sys 17.690+0.000) after (new repo): time: real 362.280 secs (user 260.300+0.000 sys 17.700+0.000) This regression is a bit worrying because it will impact serving canonical repositories (that don't have optimal internal storage unless they are reordered - possibly as part of running `hg debugupgraderepo`). However, this regression will only be noticed by very large changegroups. And I'm guessing/hoping that any repository that large is using clonebundles to mitigate server load. Again, sending DAG order isn't the optimal send order for servers: sending in storage-delta order is. But in order to enable storage-optimal send order, we'll need a storage API that handles sorting. Future commits will introduce such an API. Differential Revision: https://phab.mercurial-scm.org/D4721
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37001
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())"
37004
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37001
diff changeset
   208
  9 foo draft c_g
37001
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   209
  $ hg log -r "first(stack(10))"
37004
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37001
diff changeset
   210
  9 foo draft c_g
37001
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   211
  $ hg log -r "first(stack(8))"
37004
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37001
diff changeset
   212
  7 foo draft c_e
37001
407934a97bc7 stack: import Evolve stack test file
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   213
  $ hg log -r "first(stack(head()))"
37004
68fcc5503ec5 stack: return a sorted smartrev by default
Boris Feld <boris.feld@octobus.net>
parents: 37001
diff changeset
   214
  7 foo draft c_e
37001
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
  ~