tests/test-push-checkheads-unpushed-D4.t
branchmercurial-3.9
changeset 2279 347849e17876
parent 2277 61d885899466
child 2710 e22de367fc74
equal deleted inserted replaced
2261:3e339f6717c7 2279:347849e17876
       
     1 ====================================
       
     2 Testing head checking code: Case D-4
       
     3 ====================================
       
     4 
       
     5 Mercurial checks for the introduction of new heads on push. Evolution comes
       
     6 into play to detect if existing branches on the server are being replaced by
       
     7 some of the new one we push.
       
     8 
       
     9 This case is part of a series of tests checking this behavior.
       
    10 
       
    11 Category D: remote head is "obs-affected" locally, but result is not part of the push
       
    12 TestCase 4: multi-changeset branch, split on multiple other, (base on its own new branch)
       
    13 
       
    14 .. old-state:
       
    15 ..
       
    16 .. * 2 branch (1 changeset, and 2 changesets)
       
    17 ..
       
    18 .. new-state:
       
    19 ..
       
    20 .. * 1 new branch superceeding the base of the old-2-changesets-branch,
       
    21 .. * 1 new changesets on the old-1-changeset-branch superceeding the head of the other
       
    22 ..
       
    23 .. expected-result:
       
    24 ..
       
    25 .. * push the new branch only -> push denied (variant a)
       
    26 .. * push the existing branch only -> push allowed (variant b)
       
    27 .. (pushing all is tested as case A-7)
       
    28 ..
       
    29 .. graph-summary:
       
    30 ..
       
    31 .. (variant a)
       
    32 ..
       
    33 .. B'○⇢ø B
       
    34 ..   | |
       
    35 .. A | ø⇠◔ A'
       
    36 ..   | |/
       
    37 .. C ● |
       
    38 ..    \|
       
    39 ..     ●
       
    40 ..
       
    41 .. or (variant b)
       
    42 ..
       
    43 .. B'◔⇢ø B
       
    44 ..   | |
       
    45 .. A | ø⇠○ A'
       
    46 ..   | |/
       
    47 .. C ● |
       
    48 ..    \|
       
    49 ..     ●
       
    50 
       
    51   $ . $TESTDIR/testlib/push-checkheads-util.sh
       
    52 
       
    53 Test setup
       
    54 ----------
       
    55 
       
    56   $ mkdir D4
       
    57   $ cd D4
       
    58   $ setuprepos
       
    59   creating basic server and client repo
       
    60   updating to branch default
       
    61   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    62   $ cd server
       
    63   $ mkcommit B0
       
    64   $ hg up 0
       
    65   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    66   $ mkcommit C0
       
    67   created new head
       
    68   $ cd ../client
       
    69   $ hg pull
       
    70   pulling from $TESTTMP/D4/server (glob)
       
    71   searching for changes
       
    72   adding changesets
       
    73   adding manifests
       
    74   adding file changes
       
    75   added 2 changesets with 2 changes to 2 files (+1 heads)
       
    76   (run 'hg heads' to see heads, 'hg merge' to merge)
       
    77   $ hg up 0
       
    78   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    79   $ mkcommit A1
       
    80   created new head
       
    81   $ hg up 'desc(C0)'
       
    82   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    83   $ mkcommit B1
       
    84   $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
       
    85   $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
       
    86   $ hg log -G --hidden
       
    87   @  d70a1f75a020 (draft): B1
       
    88   |
       
    89   | o  f6082bc4ffef (draft): A1
       
    90   | |
       
    91   o |  0f88766e02d6 (draft): C0
       
    92   |/
       
    93   | x  d73caddc5533 (draft): B0
       
    94   | |
       
    95   | x  8aaa48160adc (draft): A0
       
    96   |/
       
    97   o  1e4be0697311 (public): root
       
    98   
       
    99 
       
   100 Actual testing (new branch only)
       
   101 --------------------------------
       
   102 
       
   103   $ hg push --rev 'desc(A1)'
       
   104   pushing to $TESTTMP/D4/server (glob)
       
   105   searching for changes
       
   106   abort: push creates new remote head f6082bc4ffef!
       
   107   (merge or see 'hg help push' for details about pushing new heads)
       
   108   [255]
       
   109 
       
   110 Actual testing (existing branch only)
       
   111 ------------------------------------
       
   112 
       
   113   $ hg push --rev 'desc(B1)'
       
   114   pushing to $TESTTMP/D4/server (glob)
       
   115   searching for changes
       
   116   adding changesets
       
   117   adding manifests
       
   118   adding file changes
       
   119   added 1 changesets with 1 changes to 1 files
       
   120   1 new obsolescence markers
       
   121 
       
   122   $ cd ../..