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