tests/test-update-reverse.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 07 Mar 2024 04:15:23 +0100
changeset 51536 718f28ea3af4
parent 49621 55c6ebd11cb9
permissions -rw-r--r--
branchcache: add a "pure topological head" fast path In a narrow but actually quick common case, all topological heads are all on the same branch and all open. In this case, computing the branch map is very simple. We can quickly detect situation where this situation will not change. So we update the V3 format to be able to express this situation and upgrade the update code to detect we remains in that mode. The branch cache is populated with the actual value when the branch map is accessed, but the update_disk method can do the update without needing to populate it.

  $ hg init repo
  $ cd repo

  $ touch a
  $ hg add a
  $ hg commit -m "Added a"

  $ touch main
  $ hg add main
  $ hg commit -m "Added main"
  $ hg checkout 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved

'main' should be gone:

  $ ls -A
  .hg
  a

  $ touch side1
  $ hg add side1
  $ hg commit -m "Added side1"
  created new head
  $ touch side2
  $ hg add side2
  $ hg commit -m "Added side2"

  $ hg log
  changeset:   3:91ebc10ed028
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added side2
  
  changeset:   2:b932d7dbb1e1
  parent:      0:c2eda428b523
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added side1
  
  changeset:   1:71a760306caf
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added main
  
  changeset:   0:c2eda428b523
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added a
  

  $ hg heads
  changeset:   3:91ebc10ed028
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added side2
  
  changeset:   1:71a760306caf
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added main
  
  $ ls -A
  .hg
  a
  side1
  side2

  $ hg update --debug -C 1
  resolving manifests
   branchmerge: False, force: True, partial: False
   ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf
   side1: other deleted -> r
  removing side1
   side2: other deleted -> r
  removing side2
   main: remote created -> g
  getting main
  1 files updated, 0 files merged, 2 files removed, 0 files unresolved

  $ ls -A
  .hg
  a
  main