tests/test-hooklib-changeset_obsoleted.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 15 Jan 2021 12:41:38 +0100
changeset 46314 95a615dd77bf
parent 45075 04ef381000a8
permissions -rw-r--r--
clone: make sure we warm the cache after a clone This work around any deviciency/limitation of the clone process. In our case this ensure the persistent nodemap exist with valid content. Ideally, the cloning process would also do "the right thing". However since older server will never be able to do "the right thing". The local workaround will be necessary anyway. I am not worried by the performance impact of this as `hg clone` is non-instant on large repositories where is could matters. Warming the cache if they are already correct is very fast. And if they are not already warm, this seems like a good time to do so. This impact various test as more cache are now warmed sooner, all the change should be harmless. Differential Revision: https://phab.mercurial-scm.org/D9789
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44413
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     1
  $ cat <<EOF >> $HGRCPATH
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     2
  > [experimental]
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     3
  > evolution = true
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     4
  > 
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     5
  > [extensions]
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     6
  > notify =
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     7
  > hooklib =
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     8
  > 
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     9
  > [phases]
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    10
  > publish = False
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    11
  > 
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    12
  > [notify]
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    13
  > sources = pull
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    14
  > diffstat = False
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    15
  > messageidseed = example
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    16
  > domain = example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    17
  > 
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    18
  > [reposubs]
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    19
  > * = baz
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    20
  > EOF
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    21
  $ hg init a
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    22
  $ hg --cwd a debugbuilddag +2
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    23
  $ hg init b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    24
  $ cat <<EOF >> b/.hg/hgrc
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    25
  > [hooks]
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    26
  > incoming.notify = python:hgext.notify.hook
45075
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    27
  > txnclose.changeset_obsoleted = python:hgext.hooklib.changeset_obsoleted.hook
44413
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    28
  > EOF
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    29
  $ hg --cwd b pull ../a | "$PYTHON" $TESTDIR/unwrap-message-id.py
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    30
  pulling from ../a
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    31
  requesting all changes
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    32
  adding changesets
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    33
  adding manifests
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    34
  adding file changes
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    35
  added 2 changesets with 0 changes to 0 files
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    36
  new changesets 1ea73414a91b:66f7d451a68b (2 drafts)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    37
  MIME-Version: 1.0
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    38
  Content-Type: text/plain; charset="us-ascii"
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    39
  Content-Transfer-Encoding: 7bit
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    40
  Date: * (glob)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    41
  Subject: changeset in * (glob)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    42
  From: debugbuilddag@example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    43
  X-Hg-Notification: changeset 1ea73414a91b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    44
  Message-Id: <hg.81c297828fd2d5afaadf2775a6a71b74143b6451dfaac09fac939e9107a50d01@example.com>
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    45
  To: baz@example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    46
  
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    47
  changeset 1ea73414a91b in $TESTTMP/b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    48
  details: $TESTTMP/b?cmd=changeset;node=1ea73414a91b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    49
  description:
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    50
  	r0
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    51
  MIME-Version: 1.0
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    52
  Content-Type: text/plain; charset="us-ascii"
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    53
  Content-Transfer-Encoding: 7bit
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    54
  Date: * (glob)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    55
  Subject: changeset in * (glob)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    56
  From: debugbuilddag@example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    57
  X-Hg-Notification: changeset 66f7d451a68b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    58
  Message-Id: <hg.364d03da7dc13829eb779a805be7e37f54f572e9afcea7d2626856a794d3e8f3@example.com>
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    59
  To: baz@example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    60
  
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    61
  changeset 66f7d451a68b in $TESTTMP/b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    62
  details: $TESTTMP/b?cmd=changeset;node=66f7d451a68b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    63
  description:
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    64
  	r1
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    65
  (run 'hg update' to get a working copy)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    66
  $ hg --cwd a debugobsolete 1ea73414a91b0920940797d8fc6a11e447f8ea1e
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    67
  1 new obsolescence markers
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    68
  obsoleted 1 changesets
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    69
  1 new orphan changesets
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    70
  $ hg --cwd a push ../b --hidden | "$PYTHON" $TESTDIR/unwrap-message-id.py
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    71
  1 new orphan changesets
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    72
  pushing to ../b
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    73
  searching for changes
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    74
  no changes found
45075
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    75
  1 new obsolescence markers
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    76
  obsoleted 1 changesets
44413
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    77
  Subject: changeset abandoned
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    78
  In-reply-to: <hg.81c297828fd2d5afaadf2775a6a71b74143b6451dfaac09fac939e9107a50d01@example.com>
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    79
  Message-Id: <hg.d6329e9481594f0f3c8a84362b3511318bfbce50748ab1123f909eb6fbcab018@example.com>
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    80
  Date: * (glob)
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    81
  From: test@example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    82
  To: baz@example.com
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    83
  
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    84
  This changeset has been abandoned.
45075
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    85
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    86
Check that known changesets with known successors do not result in a mail.
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    87
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    88
  $ hg init c
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    89
  $ hg init d
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    90
  $ cat <<EOF >> d/.hg/hgrc
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    91
  > [hooks]
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    92
  > incoming.notify = python:hgext.notify.hook
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    93
  > txnclose.changeset_obsoleted = python:hgext.hooklib.changeset_obsoleted.hook
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    94
  > EOF
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    95
  $ hg --cwd c debugbuilddag '.:parent.*parent'
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    96
  $ hg --cwd c push ../d -r 1
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    97
  pushing to ../d
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    98
  searching for changes
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
    99
  adding changesets
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   100
  adding manifests
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   101
  adding file changes
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   102
  added 2 changesets with 0 changes to 0 files
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   103
  $ hg --cwd c debugobsolete $(hg --cwd c log -T '{node}' -r 1) $(hg --cwd c log -T '{node}' -r 2)
44413
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   104
  1 new obsolescence markers
4cabeea6d214 hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
   105
  obsoleted 1 changesets
45075
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   106
  $ hg --cwd c push ../d | "$PYTHON" $TESTDIR/unwrap-message-id.py
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   107
  pushing to ../d
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   108
  searching for changes
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   109
  adding changesets
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   110
  adding manifests
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   111
  adding file changes
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   112
  added 1 changesets with 0 changes to 0 files (+1 heads)
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   113
  1 new obsolescence markers
04ef381000a8 hooklib: fix detection of successors for changeset_obsoleted
Joerg Sonnenberger <joerg@bec.de>
parents: 44413
diff changeset
   114
  obsoleted 1 changesets