Mercurial > hg
annotate tests/test-hooklib-enforce_draft_commits.t @ 46209:a51d345f1404
upgrade: move optimization addition to determineactions()
The documentation of `determineactions()` mention that it is given a list
returned from `findoptimizations()` however it was not true before this patch.
The code extending actions with optimizations also mentioned about it that this
should be in determineactions.
So let's do what comments at couple of places say.
Differential Revision: https://phab.mercurial-scm.org/D9615
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 16 Dec 2020 14:06:24 +0530 |
parents | 4cabeea6d214 |
children |
rev | line source |
---|---|
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 > [extensions] |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
3 > hooklib = |
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 > [phases] |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
6 > publish = False |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
7 > EOF |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
8 $ hg init a |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
9 $ hg --cwd a debugbuilddag . |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
10 $ hg --cwd a phase --public 0 |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
11 $ hg init b |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
12 $ cat <<EOF >> b/.hg/hgrc |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
13 > [hooks] |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
14 > pretxnclose-phase.enforce_draft_commits = \ |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
15 > python:hgext.hooklib.enforce_draft_commits.hook |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
16 > EOF |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
17 $ hg --cwd b pull ../a |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
18 pulling from ../a |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
19 requesting all changes |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
20 adding changesets |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
21 adding manifests |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
22 adding file changes |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
23 error: pretxnclose-phase.enforce_draft_commits hook failed: New changeset 1ea73414a91b in phase 'public' rejected |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
24 transaction abort! |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
25 rollback completed |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
26 abort: New changeset 1ea73414a91b in phase 'public' rejected |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
27 [255] |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
28 $ hg --cwd a phase --force --draft 0 |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
29 $ hg --cwd b pull ../a |
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 1 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 (1 drafts) |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
37 (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
|
38 $ hg --cwd a phase --public 0 |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
39 $ hg --cwd b pull ../a |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
40 pulling from ../a |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
41 searching for changes |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
42 no changes found |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
43 error: pretxnclose-phase.enforce_draft_commits hook failed: Phase change from 'draft' to 'public' for 1ea73414a91b rejected |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
44 abort: Phase change from 'draft' to 'public' for 1ea73414a91b rejected |
4cabeea6d214
hgext: start building a library for simple hooks
Joerg Sonnenberger <joerg@bec.de>
parents:
diff
changeset
|
45 [255] |