view tests/test-show-underway.t @ 31987:8823daaf4665

obsolescence: add test for the "branch replacement" logic during push, case D2 Mercurial checks for the introduction of new heads on push. Evolution comes into play to detect if existing branches on the server are being replaced by some of the new one we push. The current code for this logic is very basic (eg: issue4354) and was poorly tested. We have a better implementation coming in the evolve extension fixing these issues and with more serious tests coverage. In the process of upstreaming this improved logic, we start with adding the test case that are already passing with the current implementation. Once they are all in, we'll upstream the better implementation and the extra test cases. See inline documentation for details about the test case added in this changeset.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 13 Apr 2017 16:27:42 +0200
parents 99bc93147d87
children
line wrap: on
line source

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > show =
  > EOF

  $ hg init repo0
  $ cd repo0

Command works on an empty repo

  $ hg show underway

Single draft changeset shown

  $ echo 0 > foo
  $ hg -q commit -A -m 'commit 0'

  $ hg show underway
  @  9f171 commit 0

Even when it isn't the wdir

  $ hg -q up null

  $ hg show underway
  o  9f171 commit 0

Single changeset is still there when public because it is a head

  $ hg phase --public -r 0
  $ hg show underway
  o  9f171 commit 0

A draft child will show both it and public parent

  $ hg -q up 0
  $ echo 1 > foo
  $ hg commit -m 'commit 1'

  $ hg show underway
  @  181cc commit 1
  o  9f171 commit 0

Multiple draft children will be shown

  $ echo 2 > foo
  $ hg commit -m 'commit 2'

  $ hg show underway
  @  128c8 commit 2
  o  181cc commit 1
  o  9f171 commit 0

Bumping first draft changeset to public will hide its parent

  $ hg phase --public -r 1
  $ hg show underway
  @  128c8 commit 2
  o  181cc commit 1
  |
  ~

Multiple DAG heads will be shown

  $ hg -q up -r 1
  $ echo 3 > foo
  $ hg commit -m 'commit 3'
  created new head

  $ hg show underway
  @  f0abc commit 3
  | o  128c8 commit 2
  |/
  o  181cc commit 1
  |
  ~

Even when wdir is something else

  $ hg -q up null

  $ hg show underway
  o  f0abc commit 3
  | o  128c8 commit 2
  |/
  o  181cc commit 1
  |
  ~

Draft child shows public head (multiple heads)

  $ hg -q up 0
  $ echo 4 > foo
  $ hg commit -m 'commit 4'
  created new head

  $ hg show underway
  @  668ca commit 4
  | o  f0abc commit 3
  | | o  128c8 commit 2
  | |/
  | o  181cc commit 1
  |/
  o  9f171 commit 0

  $ cd ..

Branch name appears in output

  $ hg init branches
  $ cd branches
  $ echo 0 > foo
  $ hg -q commit -A -m 'commit 0'
  $ echo 1 > foo
  $ hg commit -m 'commit 1'
  $ echo 2 > foo
  $ hg commit -m 'commit 2'
  $ hg phase --public -r .
  $ hg -q up -r 1
  $ hg branch mybranch
  marked working directory as branch mybranch
  (branches are permanent and global, did you want a bookmark?)
  $ echo 3 > foo
  $ hg commit -m 'commit 3'
  $ echo 4 > foo
  $ hg commit -m 'commit 4'

  $ hg show underway
  @  f8dd3 (mybranch) commit 4
  o  90cfc (mybranch) commit 3
  | o  128c8 commit 2
  |/
  o  181cc commit 1
  |
  ~

  $ cd ..

Bookmark name appears in output

  $ hg init bookmarks
  $ cd bookmarks
  $ echo 0 > foo
  $ hg -q commit -A -m 'commit 0'
  $ echo 1 > foo
  $ hg commit -m 'commit 1'
  $ echo 2 > foo
  $ hg commit -m 'commit 2'
  $ hg phase --public -r .
  $ hg bookmark @
  $ hg -q up -r 1
  $ echo 3 > foo
  $ hg commit -m 'commit 3'
  created new head
  $ echo 4 > foo
  $ hg commit -m 'commit 4'
  $ hg bookmark mybook

  $ hg show underway
  @  cac82 (mybook) commit 4
  o  f0abc commit 3
  | o  128c8 (@) commit 2
  |/
  o  181cc commit 1
  |
  ~

  $ cd ..