tests/test-obsolete-checkheads.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 01 Aug 2012 19:35:05 +0200
changeset 17546 488e470634d8
child 17547 e6de4761d26f
permissions -rw-r--r--
test: add testing of checkheads behavior with obsolete Expected behavior is quite complex. Explicit testing with clear scenarios is welcome.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17546
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     1
Check that obsolete properly strip heads
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     2
  $ cat > obs.py << EOF
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     3
  > import mercurial.obsolete
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     4
  > mercurial.obsolete._enabled = True
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     5
  > EOF
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     6
  $ cat >> $HGRCPATH << EOF
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     7
  > [phases]
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     8
  > # public changeset are not obsolete
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     9
  > publish=false
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    10
  > [ui]
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    11
  > logtemplate='{node|short} ({phase}) {desc|firstline}\n'
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    12
  > [extensions]
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    13
  > graphlog=
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    14
  > EOF
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    15
  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    16
  $ mkcommit() {
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    17
  >    echo "$1" > "$1"
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    18
  >    hg add "$1"
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    19
  >    hg ci -m "add $1"
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    20
  > }
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    21
  $ getid() {
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    22
  >    hg id --debug -ir "desc('$1')"
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    23
  > }
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    24
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    25
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    26
  $ hg init remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    27
  $ cd remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    28
  $ mkcommit base
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    29
  $ hg phase --public .
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    30
  $ cd ..
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    31
  $ cp -r remote base
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    32
  $ hg clone remote local
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    33
  updating to branch default
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    34
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    35
  $ cd local
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    36
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    37
New head replaces old head
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    38
==========================
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    39
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    40
setup
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    41
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    42
  $ mkcommit old
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    43
  $ hg push
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    44
  pushing to $TESTTMP/remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    45
  searching for changes
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    46
  adding changesets
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    47
  adding manifests
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    48
  adding file changes
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    49
  added 1 changesets with 1 changes to 1 files
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    50
  $ hg up -q '.^'
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    51
  $ mkcommit new
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    52
  created new head
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    53
  $ hg debugobsolete `getid old` `getid new`
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    54
  $ hg glog --hidden
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    55
  @  71e3228bffe1 (draft) add new
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    56
  |
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    57
  | x  c70b08862e08 (draft) add old
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    58
  |/
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    59
  o  b4952fcf48cf (public) add base
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    60
  
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    61
  $ cp -r ../remote ../backup1
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    62
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    63
old exists remotely as draft. It is obsoleted by new that we now push.
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    64
Push should not warn about creating new head
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    65
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    66
  $ hg push
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    67
  pushing to $TESTTMP/remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    68
  searching for changes
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    69
  adding changesets
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    70
  adding manifests
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    71
  adding file changes
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    72
  added 1 changesets with 1 changes to 1 files (+1 heads)
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    73
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    74
old head is obsolete but replacement in not pushed
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    75
==================================================
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    76
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    77
setup
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    78
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    79
  $ rm -fr ../remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    80
  $ cp -r ../backup1 ../remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    81
  $ hg up -q '.^'
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    82
  $ mkcommit other
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    83
  created new head
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    84
  $ hg glog --hidden
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    85
  @  d7d41ccbd4de (draft) add other
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    86
  |
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    87
  | o  71e3228bffe1 (draft) add new
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    88
  |/
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    89
  | x  c70b08862e08 (draft) add old
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    90
  |/
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    91
  o  b4952fcf48cf (public) add base
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    92
  
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    93
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    94
old exists remotely as draft. It is obsoleted by new but we don't push new.
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    95
Push should abort on new head
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    96
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    97
  $ hg push -r 'desc("other")'
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    98
  pushing to $TESTTMP/remote
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    99
  searching for changes
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   100
  abort: push creates new remote head d7d41ccbd4de!
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   101
  (did you forget to merge? use push -f to force)
488e470634d8 test: add testing of checkheads behavior with obsolete
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   102
  [255]