comparison tests/test-stabilize-order.t @ 269:6c6bb7a23bb5 0.1.0

stabilize: improve unstable selection heuristic Without argument, stabilize was picking the first in: "unstable() and ((suspended() or obsancestors(::.))::)" which usually returned the "oldest" unstable revision in parent predecessors descendants. This revision is interesting because it usually gives "soft" merges but rebasing it left the working directory on a remote branch, which was very confusing. The new heuristic picks an unstable changeset which can be rebased on top of the parent revision, or on top of one of its descendants (selected in revision order). This has the advantage of selecting a revision which can be rebased on the current subtree, and leave the working directory in a more convenient location.
author Patrick Mezard <patrick@mezard.eu>
date Wed, 13 Jun 2012 18:28:10 +0200
parents
children 258169d3428b
comparison
equal deleted inserted replaced
268:2da5af3dadeb 269:6c6bb7a23bb5
1 $ cat >> $HGRCPATH <<EOF
2 > [defaults]
3 > amend=-d "0 0"
4 > [extensions]
5 > hgext.rebase=
6 > hgext.graphlog=
7 > EOF
8 $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH
9 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
10
11 $ glog() {
12 > hg glog --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
13 > }
14
15 $ hg init repo
16 $ cd repo
17 $ echo root > root
18 $ hg ci -Am addroot
19 adding root
20 $ echo a > a
21 $ hg ci -Am adda
22 adding a
23 $ echo b > b
24 $ hg ci -Am addb
25 adding b
26 $ echo c > c
27 $ hg ci -Am addc
28 adding c
29 $ glog
30 @ 3:7a7552255fb5@default(draft) addc
31 |
32 o 2:ef23d6ef94d6@default(draft) addb
33 |
34 o 1:93418d2c0979@default(draft) adda
35 |
36 o 0:c471ef929e6a@default(draft) addroot
37
38 $ hg gdown
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
40 [2] addb
41 $ echo b >> b
42 $ hg amend
43 1 new unstables changesets
44 $ hg gdown
45 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
46 [1] adda
47 $ echo a >> a
48 $ hg amend
49 1 new unstables changesets
50 $ glog
51 @ 7:f5ff10856e5a@default(draft) adda
52 |
53 | o 5:ab8cbb6d87ff@default(draft) addb
54 | |
55 | | o 3:7a7552255fb5@default(draft) addc
56 | | |
57 | | o 2:ef23d6ef94d6@default(draft) addb
58 | |/
59 | o 1:93418d2c0979@default(draft) adda
60 |/
61 o 0:c471ef929e6a@default(draft) addroot
62
63
64 Test stabilizing a predecessor child
65
66 $ hg stabilize -v
67 move:[5] addb
68 atop:[7] adda
69 hg rebase -Dr ab8cbb6d87ff -d f5ff10856e5a
70 resolving manifests
71 getting b
72 b
73 $ glog
74 @ 8:6bf44048e43f@default(draft) addb
75 |
76 o 7:f5ff10856e5a@default(draft) adda
77 |
78 | o 3:7a7552255fb5@default(draft) addc
79 | |
80 | o 2:ef23d6ef94d6@default(draft) addb
81 | |
82 | o 1:93418d2c0979@default(draft) adda
83 |/
84 o 0:c471ef929e6a@default(draft) addroot
85
86
87 Test stabilizing a descendant predecessors child
88
89 $ hg up 7
90 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
91 $ hg stabilize -v
92 move:[3] addc
93 atop:[8] addb
94 hg rebase -Dr 7a7552255fb5 -d 6bf44048e43f
95 resolving manifests
96 getting b
97 resolving manifests
98 getting c
99 c
100 $ glog
101 @ 9:5e819fbb0d27@default(draft) addc
102 |
103 o 8:6bf44048e43f@default(draft) addb
104 |
105 o 7:f5ff10856e5a@default(draft) adda
106 |
107 o 0:c471ef929e6a@default(draft) addroot
108
109 $ hg stabilize -v
110 no unstable changeset
111 [1]
112
113 Test behaviour with --any
114
115 $ hg up 8
116 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
117 $ echo b >> b
118 $ hg amend
119 1 new unstables changesets
120 $ glog
121 @ 11:4e7cec6b4afe@default(draft) addb
122 |
123 | o 9:5e819fbb0d27@default(draft) addc
124 | |
125 | o 8:6bf44048e43f@default(draft) addb
126 |/
127 o 7:f5ff10856e5a@default(draft) adda
128 |
129 o 0:c471ef929e6a@default(draft) addroot
130
131 $ hg up 9
132 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 $ hg stabilize -v
134 nothing to stabilize here
135 (1 unstable changesets, do you want --any ?)
136 [2]
137 $ hg stabilize --any -v
138 move:[9] addc
139 atop:[11] addb
140 hg rebase -Dr 5e819fbb0d27 -d 4e7cec6b4afe
141 resolving manifests
142 removing c
143 getting b
144 resolving manifests
145 getting c
146 c
147 $ glog
148 @ 12:24f95816bb21@default(draft) addc
149 |
150 o 11:4e7cec6b4afe@default(draft) addb
151 |
152 o 7:f5ff10856e5a@default(draft) adda
153 |
154 o 0:c471ef929e6a@default(draft) addroot
155
156 $ hg stabilize --any -v
157 no unstable changeset
158 [1]