tests/test-push-checkheads-partial-C3.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sun, 21 May 2017 15:35:21 +0200
changeset 32476 e5e31b0fc924
parent 31984 c8f4876c0198
child 33542 b11e8c67fb0f
permissions -rw-r--r--
hidden: use _domainancestors to compute revs revealed by dynamic blocker The complexity of computing the revealed changesets is now 'O(revealed)'. This massively speeds up the computation on large repository. Moving it to the millisecond range. Below are timing from two Mozilla repositories with different contents: 1) mozilla repository with: * 400667 changesets * 35 hidden changesets (first rev-268334) * 288 visible drafts * obsolete working copy (dynamicblockers), Before: ! visible ! wall 0.030247 comb 0.030000 user 0.030000 sys 0.000000 (best of 100) After: ! visible ! wall 0.000585 comb 0.000000 user 0.000000 sys 0.000000 (best of 4221) The timing above include the computation of obsolete changeset: ! obsolete ! wall 0.000396 comb 0.000000 user 0.000000 sys 0.000000 (best of 6816) So adjusted time give 30ms before versus 0.2ms after. A 150x speedup. 2) mozilla repository with: * 405645 changesets * 4312 hidden changesets (first rev-326004) * 264 visible drafts * obsolete working copy (dynamicblockers), Before: ! visible ! wall 0.168658 comb 0.170000 user 0.170000 sys 0.000000 (best of 48) After ! visible ! wall 0.008612 comb 0.010000 user 0.010000 sys 0.000000 (best of 325) The timing above include the computation of obsolete changeset: ! obsolete ! wall 0.006408 comb 0.010000 user 0.010000 sys 0.000000 (best of 404) So adjusted time give 160ms before versus 2ms after. A 75x speedup.

====================================
Testing head checking code: Case C-3
====================================

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.

This case is part of a series of tests checking this behavior.

Category C: case were the branch is only partially obsoleted
TestCase 3: 2 changeset branch, only the head is pruned

.. old-state:
..
.. * 2 changeset branch
..
.. new-state:
..
.. * old head is pruned
.. * 1 new unrelated branch
..
.. expected-result:
..
.. * push denied
..
.. graph-summary:
..
..   B 
..     |
..   A   C
..     |/
..     

  $ . $TESTDIR/testlib/push-checkheads-util.sh

Test setup
----------

  $ mkdir C3
  $ cd C3
  $ setuprepos
  creating basic server and client repo
  updating to branch default
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ cd server
  $ mkcommit B0
  $ cd ../client
  $ hg pull
  pulling from $TESTTMP/C3/server (glob)
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files
  (run 'hg update' to get a working copy)
  $ hg up 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ mkcommit C0
  created new head
  $ hg debugobsolete --record-parents `getid "desc(B0)"`
  $ hg log -G --hidden
  @  0f88766e02d6 (draft): C0
  |
  | x  d73caddc5533 (draft): B0
  | |
  | o  8aaa48160adc (draft): A0
  |/
  o  1e4be0697311 (public): root
  

Actual testing
--------------

  $ hg push
  pushing to $TESTTMP/C3/server (glob)
  searching for changes
  abort: push creates new remote head 0f88766e02d6!
  (merge or see 'hg help push' for details about pushing new heads)
  [255]

  $ cd ../..