##// END OF EJS Templates
strip: hide unbundle messages by default...
Matt Mackall -
r11202:f974fe89 default
parent child Browse files
Show More
@@ -1,154 +1,159 b''
1 1 # repair.py - functions for repository repair for mercurial
2 2 #
3 3 # Copyright 2005, 2006 Chris Mason <mason@suse.com>
4 4 # Copyright 2007 Matt Mackall
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # GNU General Public License version 2 or any later version.
8 8
9 9 import changegroup
10 10 from node import nullrev, short
11 11 from i18n import _
12 12 import os
13 13
14 14 def _bundle(repo, bases, heads, node, suffix, extranodes=None):
15 15 """create a bundle with the specified revisions as a backup"""
16 16 cg = repo.changegroupsubset(bases, heads, 'strip', extranodes)
17 17 backupdir = repo.join("strip-backup")
18 18 if not os.path.isdir(backupdir):
19 19 os.mkdir(backupdir)
20 20 name = os.path.join(backupdir, "%s-%s" % (short(node), suffix))
21 21 return changegroup.writebundle(cg, name, "HG10BZ")
22 22
23 23 def _collectfiles(repo, striprev):
24 24 """find out the filelogs affected by the strip"""
25 25 files = set()
26 26
27 27 for x in xrange(striprev, len(repo)):
28 28 files.update(repo[x].files())
29 29
30 30 return sorted(files)
31 31
32 32 def _collectextranodes(repo, files, link):
33 33 """return the nodes that have to be saved before the strip"""
34 34 def collectone(revlog):
35 35 extra = []
36 36 startrev = count = len(revlog)
37 37 # find the truncation point of the revlog
38 38 for i in xrange(count):
39 39 lrev = revlog.linkrev(i)
40 40 if lrev >= link:
41 41 startrev = i + 1
42 42 break
43 43
44 44 # see if any revision after that point has a linkrev less than link
45 45 # (we have to manually save these guys)
46 46 for i in xrange(startrev, count):
47 47 node = revlog.node(i)
48 48 lrev = revlog.linkrev(i)
49 49 if lrev < link:
50 50 extra.append((node, cl.node(lrev)))
51 51
52 52 return extra
53 53
54 54 extranodes = {}
55 55 cl = repo.changelog
56 56 extra = collectone(repo.manifest)
57 57 if extra:
58 58 extranodes[1] = extra
59 59 for fname in files:
60 60 f = repo.file(fname)
61 61 extra = collectone(f)
62 62 if extra:
63 63 extranodes[fname] = extra
64 64
65 65 return extranodes
66 66
67 67 def strip(ui, repo, node, backup="all"):
68 68 cl = repo.changelog
69 69 # TODO delete the undo files, and handle undo of merge sets
70 70 striprev = cl.rev(node)
71 71
72 72 # Some revisions with rev > striprev may not be descendants of striprev.
73 73 # We have to find these revisions and put them in a bundle, so that
74 74 # we can restore them after the truncations.
75 75 # To create the bundle we use repo.changegroupsubset which requires
76 76 # the list of heads and bases of the set of interesting revisions.
77 77 # (head = revision in the set that has no descendant in the set;
78 78 # base = revision in the set that has no ancestor in the set)
79 79 tostrip = set((striprev,))
80 80 saveheads = set()
81 81 savebases = []
82 82 for r in xrange(striprev + 1, len(cl)):
83 83 parents = cl.parentrevs(r)
84 84 if parents[0] in tostrip or parents[1] in tostrip:
85 85 # r is a descendant of striprev
86 86 tostrip.add(r)
87 87 # if this is a merge and one of the parents does not descend
88 88 # from striprev, mark that parent as a savehead.
89 89 if parents[1] != nullrev:
90 90 for p in parents:
91 91 if p not in tostrip and p > striprev:
92 92 saveheads.add(p)
93 93 else:
94 94 # if no parents of this revision will be stripped, mark it as
95 95 # a savebase
96 96 if parents[0] < striprev and parents[1] < striprev:
97 97 savebases.append(cl.node(r))
98 98
99 99 saveheads.difference_update(parents)
100 100 saveheads.add(r)
101 101
102 102 saveheads = [cl.node(r) for r in saveheads]
103 103 files = _collectfiles(repo, striprev)
104 104
105 105 extranodes = _collectextranodes(repo, files, striprev)
106 106
107 107 # create a changegroup for all the branches we need to keep
108 108 backupfile = None
109 109 if backup == "all":
110 110 backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
111 111 repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
112 112 if saveheads or extranodes:
113 113 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
114 114 extranodes)
115 115
116 116 mfst = repo.manifest
117 117
118 118 tr = repo.transaction("strip")
119 119 offset = len(tr.entries)
120 120
121 121 try:
122 122 tr.startgroup()
123 123 cl.strip(striprev, tr)
124 124 mfst.strip(striprev, tr)
125 125 for fn in files:
126 126 repo.file(fn).strip(striprev, tr)
127 127 tr.endgroup()
128 128
129 129 try:
130 130 for i in xrange(offset, len(tr.entries)):
131 131 file, troffset, ignore = tr.entries[i]
132 132 repo.sopener(file, 'a').truncate(troffset)
133 133 tr.close()
134 134 except:
135 135 tr.abort()
136 136 raise
137 137
138 138 if saveheads or extranodes:
139 ui.status(_("adding branch\n"))
139 ui.note(_("adding branch\n"))
140 140 f = open(chgrpfile, "rb")
141 141 gen = changegroup.readbundle(f, chgrpfile)
142 if not repo.ui.verbose:
143 # silence internal shuffling chatter
144 repo.ui.pushbuffer()
142 145 repo.addchangegroup(gen, 'strip', 'bundle:' + chgrpfile, True)
146 if not repo.ui.verbose:
147 repo.ui.popbuffer()
143 148 f.close()
144 149 if backup != "strip":
145 150 os.unlink(chgrpfile)
146 151 except:
147 152 if backupfile:
148 153 ui.warn("strip failed, full bundle stored in '%s'\n" % backupfile)
149 154 elif saveheads:
150 155 ui.warn("strip failed, partial bundle stored in '%s'\n"
151 156 % chgrpfile)
152 157 raise
153 158
154 159 repo.destroyed()
@@ -1,44 +1,39 b''
1 1 % initialize repository
2 2 adding a
3 3 adding b
4 4 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
5 5 adding c
6 6 created new head
7 7 adding d
8 8 % bookmark list
9 9 * two 3:2ae46b1d99a7
10 10 one 1:925d80f479bb
11 11 % rebase
12 12 saved backup bundle to
13 adding branch
14 adding changesets
15 adding manifests
16 adding file changes
17 added 1 changesets with 1 changes to 1 files (-1 heads)
18 13 rebase completed
19 14 changeset: 3:9163974d1cb5
20 15 tag: one
21 16 tag: tip
22 17 tag: two
23 18 parent: 1:925d80f479bb
24 19 parent: 2:db815d6d32e6
25 20 user: test
26 21 date: Thu Jan 01 00:00:00 1970 +0000
27 22 summary: 3
28 23
29 24 changeset: 2:db815d6d32e6
30 25 parent: 0:f7b1eb17ad24
31 26 user: test
32 27 date: Thu Jan 01 00:00:00 1970 +0000
33 28 summary: 2
34 29
35 30 changeset: 1:925d80f479bb
36 31 user: test
37 32 date: Thu Jan 01 00:00:00 1970 +0000
38 33 summary: 1
39 34
40 35 changeset: 0:f7b1eb17ad24
41 36 user: test
42 37 date: Thu Jan 01 00:00:00 1970 +0000
43 38 summary: 0
44 39
@@ -1,23 +1,18 b''
1 1 % add file
2 2 adding qqq.txt
3 3 % commit first revision
4 4 % set bookmark
5 5 % commit second revision
6 6 % set bookmark
7 7 % update to -2
8 8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 9 % commit new head
10 10 created new head
11 11 % bookmarks updated?
12 12 test 1:16b24da7e457
13 13 test2 1:16b24da7e457
14 14 % strip to revision 1
15 15 saved backup bundle to
16 adding branch
17 adding changesets
18 adding manifests
19 adding file changes
20 added 1 changesets with 1 changes to 1 files
21 16 % list bookmarks
22 17 * test 1:9f1b7e78eff8
23 18 * test2 1:9f1b7e78eff8
@@ -1,300 +1,295 b''
1 1 % init
2 2 % commit
3 3 adding 1/base
4 4 adding 2/base
5 5 % qnew mqbase
6 6 % qrefresh
7 7 % qdiff
8 8 diff -r b55ecdccb5cf 1/base
9 9 --- a/1/base
10 10 +++ b/1/base
11 11 @@ -1,1 +1,1 @@
12 12 -base
13 13 +patched
14 14 diff -r b55ecdccb5cf 2/base
15 15 --- a/2/base
16 16 +++ b/2/base
17 17 @@ -1,1 +1,1 @@
18 18 -base
19 19 +patched
20 20 % qdiff dirname
21 21 diff -r b55ecdccb5cf 1/base
22 22 --- a/1/base
23 23 +++ b/1/base
24 24 @@ -1,1 +1,1 @@
25 25 -base
26 26 +patched
27 27 diff -r b55ecdccb5cf 2/base
28 28 --- a/2/base
29 29 +++ b/2/base
30 30 @@ -1,1 +1,1 @@
31 31 -base
32 32 +patched
33 33 % patch file contents
34 34 # HG changeset patch
35 35 # Parent
36 36 mqbase
37 37
38 38 diff -r b55ecdccb5cf 1/base
39 39 --- a/1/base
40 40 +++ b/1/base
41 41 @@ -1,1 +1,1 @@
42 42 -base
43 43 +patched
44 44 diff -r b55ecdccb5cf 2/base
45 45 --- a/2/base
46 46 +++ b/2/base
47 47 @@ -1,1 +1,1 @@
48 48 -base
49 49 +patched
50 50 % qrefresh 1
51 51 % qdiff
52 52 diff -r b55ecdccb5cf 1/base
53 53 --- a/1/base
54 54 +++ b/1/base
55 55 @@ -1,1 +1,1 @@
56 56 -base
57 57 +patched
58 58 diff -r b55ecdccb5cf 2/base
59 59 --- a/2/base
60 60 +++ b/2/base
61 61 @@ -1,1 +1,1 @@
62 62 -base
63 63 +patched
64 64 % qdiff dirname
65 65 diff -r b55ecdccb5cf 1/base
66 66 --- a/1/base
67 67 +++ b/1/base
68 68 @@ -1,1 +1,1 @@
69 69 -base
70 70 +patched
71 71 diff -r b55ecdccb5cf 2/base
72 72 --- a/2/base
73 73 +++ b/2/base
74 74 @@ -1,1 +1,1 @@
75 75 -base
76 76 +patched
77 77 % patch file contents
78 78 # HG changeset patch
79 79 # Parent
80 80 mqbase
81 81
82 82 diff -r b55ecdccb5cf 1/base
83 83 --- a/1/base
84 84 +++ b/1/base
85 85 @@ -1,1 +1,1 @@
86 86 -base
87 87 +patched
88 88 % qrefresh . in subdir
89 89 % qdiff
90 90 diff -r b55ecdccb5cf 1/base
91 91 --- a/1/base
92 92 +++ b/1/base
93 93 @@ -1,1 +1,1 @@
94 94 -base
95 95 +patched
96 96 diff -r b55ecdccb5cf 2/base
97 97 --- a/2/base
98 98 +++ b/2/base
99 99 @@ -1,1 +1,1 @@
100 100 -base
101 101 +patched
102 102 % qdiff dirname
103 103 diff -r b55ecdccb5cf 1/base
104 104 --- a/1/base
105 105 +++ b/1/base
106 106 @@ -1,1 +1,1 @@
107 107 -base
108 108 +patched
109 109 diff -r b55ecdccb5cf 2/base
110 110 --- a/2/base
111 111 +++ b/2/base
112 112 @@ -1,1 +1,1 @@
113 113 -base
114 114 +patched
115 115 % patch file contents
116 116 # HG changeset patch
117 117 # Parent
118 118 mqbase
119 119
120 120 diff -r b55ecdccb5cf 1/base
121 121 --- a/1/base
122 122 +++ b/1/base
123 123 @@ -1,1 +1,1 @@
124 124 -base
125 125 +patched
126 126 % qrefresh in hg-root again
127 127 % qdiff
128 128 diff -r b55ecdccb5cf 1/base
129 129 --- a/1/base
130 130 +++ b/1/base
131 131 @@ -1,1 +1,1 @@
132 132 -base
133 133 +patched
134 134 diff -r b55ecdccb5cf 2/base
135 135 --- a/2/base
136 136 +++ b/2/base
137 137 @@ -1,1 +1,1 @@
138 138 -base
139 139 +patched
140 140 % qdiff dirname
141 141 diff -r b55ecdccb5cf 1/base
142 142 --- a/1/base
143 143 +++ b/1/base
144 144 @@ -1,1 +1,1 @@
145 145 -base
146 146 +patched
147 147 diff -r b55ecdccb5cf 2/base
148 148 --- a/2/base
149 149 +++ b/2/base
150 150 @@ -1,1 +1,1 @@
151 151 -base
152 152 +patched
153 153 % patch file contents
154 154 # HG changeset patch
155 155 # Parent
156 156 mqbase
157 157
158 158 diff -r b55ecdccb5cf 1/base
159 159 --- a/1/base
160 160 +++ b/1/base
161 161 @@ -1,1 +1,1 @@
162 162 -base
163 163 +patched
164 164 diff -r b55ecdccb5cf 2/base
165 165 --- a/2/base
166 166 +++ b/2/base
167 167 @@ -1,1 +1,1 @@
168 168 -base
169 169 +patched
170 170
171 171 % qrefresh --short tests:
172 172 % - add 1/base and 2/base one by one
173 173 % -- qdiff output
174 174 diff -r b55ecdccb5cf 1/base
175 175 --- a/1/base
176 176 +++ b/1/base
177 177 @@ -1,1 +1,1 @@
178 178 -base
179 179 +patched
180 180 diff -r b55ecdccb5cf 2/base
181 181 --- a/2/base
182 182 +++ b/2/base
183 183 @@ -1,1 +1,1 @@
184 184 -base
185 185 +patched
186 186 diff -r b55ecdccb5cf orphanchild
187 187 --- /dev/null
188 188 +++ b/orphanchild
189 189 @@ -0,0 +1,1 @@
190 190 +orphan
191 191 % -- patch file content
192 192 # HG changeset patch
193 193 # Parent
194 194 mqbase
195 195
196 196 diff -r b55ecdccb5cf 1/base
197 197 --- a/1/base
198 198 +++ b/1/base
199 199 @@ -1,1 +1,1 @@
200 200 -base
201 201 +patched
202 202 diff -r b55ecdccb5cf 2/base
203 203 --- a/2/base
204 204 +++ b/2/base
205 205 @@ -1,1 +1,1 @@
206 206 -base
207 207 +patched
208 208 A orphanchild
209 209 ? base
210 210 % -- diff shows what is not in patch
211 211 diff
212 212 --- /dev/null
213 213 +++ b/orphanchild
214 214 @@ -0,0 +1,1 @@
215 215 +orphan
216 216 % - before starting exclusive tests
217 217 1/base
218 218 2/base
219 219 % - exclude 2/base
220 220 1/base
221 221 % -- status shows 2/base as dirty
222 222 M 2/base
223 223 A orphanchild
224 224 ? base
225 225 % - remove 1/base and add 2/base again but not orphanchild
226 226 2/base
227 227 % - add 1/base with include filter - and thus remove 2/base from patch
228 228 1/base
229 229
230 230 % create test repo
231 231 adding a
232 232 % capture changes
233 233 diff --git a/a b/ab
234 234 copy from a
235 235 copy to ab
236 236 --- a/a
237 237 +++ b/ab
238 238 @@ -1,1 +1,2 @@
239 239 a
240 240 +b
241 241 diff --git a/a b/ac
242 242 copy from a
243 243 copy to ac
244 244 --- a/a
245 245 +++ b/ac
246 246 @@ -1,1 +1,2 @@
247 247 a
248 248 +c
249 249 % refresh and check changes again
250 250 diff --git a/a b/ab
251 251 copy from a
252 252 copy to ab
253 253 --- a/a
254 254 +++ b/ab
255 255 @@ -1,1 +1,2 @@
256 256 a
257 257 +b
258 258 diff --git a/a b/ac
259 259 copy from a
260 260 copy to ac
261 261 --- a/a
262 262 +++ b/ac
263 263 @@ -1,1 +1,2 @@
264 264 a
265 265 +c
266 266 % issue1441 without git patches
267 267 diff -r 000000000000 b
268 268 --- /dev/null
269 269 +++ b/b
270 270 @@ -0,0 +1,1 @@
271 271 +a
272 272 % issue2025: qrefresh does not honor filtering options when tip != qtip
273 273 % refresh with tip != qtip
274 adding branch
275 adding changesets
276 adding manifests
277 adding file changes
278 added 1 changesets with 1 changes to 1 files
279 274 % status after refresh
280 275 M a
281 276 % b after refresh
282 277 b
283 278 b
284 279 % patch file after refresh
285 280 # HG changeset patch
286 281 # Parent
287 282
288 283 diff -r 1a60229be7ac b
289 284 --- a/b
290 285 +++ b/b
291 286 @@ -1,1 +1,2 @@
292 287 b
293 288 +b
294 289 % issue1441 with git patches
295 290 diff --git a/b b/b
296 291 new file mode 100644
297 292 --- /dev/null
298 293 +++ b/b
299 294 @@ -0,0 +1,1 @@
300 295 +a
@@ -1,172 +1,167 b''
1 1 adding bar
2 2 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 3 created new head
4 4 changeset: 4:443431ffac4f
5 5 tag: tip
6 6 user: test
7 7 date: Thu Jan 01 00:00:00 1970 +0000
8 8 summary: e
9 9
10 10 changeset: 3:65bd5f99a4a3
11 11 parent: 1:ef3a871183d7
12 12 user: test
13 13 date: Thu Jan 01 00:00:00 1970 +0000
14 14 summary: d
15 15
16 16 changeset: 2:264128213d29
17 17 user: test
18 18 date: Thu Jan 01 00:00:00 1970 +0000
19 19 summary: c
20 20
21 21 changeset: 1:ef3a871183d7
22 22 user: test
23 23 date: Thu Jan 01 00:00:00 1970 +0000
24 24 summary: b
25 25
26 26 changeset: 0:9ab35a2d17cb
27 27 user: test
28 28 date: Thu Jan 01 00:00:00 1970 +0000
29 29 summary: a
30 30
31 31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 32 % before update 4, strip 4
33 33 changeset: 4:443431ffac4f
34 34 tag: tip
35 35 user: test
36 36 date: Thu Jan 01 00:00:00 1970 +0000
37 37 summary: e
38 38
39 39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 40 saved backup bundle to
41 41 % after update 4, strip 4
42 42 changeset: 3:65bd5f99a4a3
43 43 tag: tip
44 44 parent: 1:ef3a871183d7
45 45 user: test
46 46 date: Thu Jan 01 00:00:00 1970 +0000
47 47 summary: d
48 48
49 49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 50 % before update 4, strip 3
51 51 changeset: 4:443431ffac4f
52 52 tag: tip
53 53 user: test
54 54 date: Thu Jan 01 00:00:00 1970 +0000
55 55 summary: e
56 56
57 57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58 saved backup bundle to
59 59 % after update 4, strip 3
60 60 changeset: 1:ef3a871183d7
61 61 user: test
62 62 date: Thu Jan 01 00:00:00 1970 +0000
63 63 summary: b
64 64
65 65 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 66 % before update 1, strip 4
67 67 changeset: 1:ef3a871183d7
68 68 user: test
69 69 date: Thu Jan 01 00:00:00 1970 +0000
70 70 summary: b
71 71
72 72 saved backup bundle to
73 73 % after update 1, strip 4
74 74 changeset: 1:ef3a871183d7
75 75 user: test
76 76 date: Thu Jan 01 00:00:00 1970 +0000
77 77 summary: b
78 78
79 79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 80 % before update 4, strip 2
81 81 changeset: 4:443431ffac4f
82 82 tag: tip
83 83 user: test
84 84 date: Thu Jan 01 00:00:00 1970 +0000
85 85 summary: e
86 86
87 87 saved backup bundle to
88 adding branch
89 adding changesets
90 adding manifests
91 adding file changes
92 added 2 changesets with 2 changes to 1 files
93 88 % after update 4, strip 2
94 89 changeset: 3:443431ffac4f
95 90 tag: tip
96 91 user: test
97 92 date: Thu Jan 01 00:00:00 1970 +0000
98 93 summary: e
99 94
100 95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
101 96 % before update 4, strip 1
102 97 changeset: 4:264128213d29
103 98 tag: tip
104 99 parent: 1:ef3a871183d7
105 100 user: test
106 101 date: Thu Jan 01 00:00:00 1970 +0000
107 102 summary: c
108 103
109 104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 105 saved backup bundle to
111 106 % after update 4, strip 1
112 107 changeset: 0:9ab35a2d17cb
113 108 tag: tip
114 109 user: test
115 110 date: Thu Jan 01 00:00:00 1970 +0000
116 111 summary: a
117 112
118 113 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 114 % before update null, strip 4
120 115 saved backup bundle to
121 116 % after update null, strip 4
122 117 changeset: 4:264128213d29
123 118 tag: tip
124 119 parent: 1:ef3a871183d7
125 120 user: test
126 121 date: Thu Jan 01 00:00:00 1970 +0000
127 122 summary: c
128 123
129 124 changeset: 3:443431ffac4f
130 125 user: test
131 126 date: Thu Jan 01 00:00:00 1970 +0000
132 127 summary: e
133 128
134 129 changeset: 2:65bd5f99a4a3
135 130 user: test
136 131 date: Thu Jan 01 00:00:00 1970 +0000
137 132 summary: d
138 133
139 134 changeset: 1:ef3a871183d7
140 135 user: test
141 136 date: Thu Jan 01 00:00:00 1970 +0000
142 137 summary: b
143 138
144 139 changeset: 0:9ab35a2d17cb
145 140 user: test
146 141 date: Thu Jan 01 00:00:00 1970 +0000
147 142 summary: a
148 143
149 144 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 145 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 146 (branch merge, don't forget to commit)
152 147 % before strip of merge parent
153 148 changeset: 2:65bd5f99a4a3
154 149 user: test
155 150 date: Thu Jan 01 00:00:00 1970 +0000
156 151 summary: d
157 152
158 153 changeset: 4:264128213d29
159 154 tag: tip
160 155 parent: 1:ef3a871183d7
161 156 user: test
162 157 date: Thu Jan 01 00:00:00 1970 +0000
163 158 summary: c
164 159
165 160 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 161 saved backup bundle to
167 162 % after strip of merge parent
168 163 changeset: 1:ef3a871183d7
169 164 user: test
170 165 date: Thu Jan 01 00:00:00 1970 +0000
171 166 summary: b
172 167
@@ -1,650 +1,635 b''
1 1 % help
2 2 mq extension - manage a stack of patches
3 3
4 4 This extension lets you work with a stack of patches in a Mercurial
5 5 repository. It manages two stacks of patches - all known patches, and applied
6 6 patches (subset of known patches).
7 7
8 8 Known patches are represented as patch files in the .hg/patches directory.
9 9 Applied patches are both patch files and changesets.
10 10
11 11 Common tasks (use "hg help command" for more details):
12 12
13 13 create new patch qnew
14 14 import existing patch qimport
15 15
16 16 print patch series qseries
17 17 print applied patches qapplied
18 18
19 19 add known patch to applied stack qpush
20 20 remove patch from applied stack qpop
21 21 refresh contents of top applied patch qrefresh
22 22
23 23 By default, mq will automatically use git patches when required to avoid
24 24 losing file mode changes, copy records, binary files or empty files creations
25 25 or deletions. This behaviour can be configured with:
26 26
27 27 [mq]
28 28 git = auto/keep/yes/no
29 29
30 30 If set to 'keep', mq will obey the [diff] section configuration while
31 31 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
32 32 will override the [diff] section and always generate git or regular patches,
33 33 possibly losing data in the second case.
34 34
35 35 list of commands:
36 36
37 37 qapplied print the patches already applied
38 38 qclone clone main and patch repository at same time
39 39 qdelete remove patches from queue
40 40 qdiff diff of the current patch and subsequent modifications
41 41 qfinish move applied patches into repository history
42 42 qfold fold the named patches into the current patch
43 43 qgoto push or pop patches until named patch is at top of stack
44 44 qguard set or print guards for a patch
45 45 qheader print the header of the topmost or specified patch
46 46 qimport import a patch
47 47 qnew create a new patch
48 48 qnext print the name of the next patch
49 49 qpop pop the current patch off the stack
50 50 qprev print the name of the previous patch
51 51 qpush push the next patch onto the stack
52 52 qrefresh update the current patch
53 53 qrename rename a patch
54 54 qselect set or print guarded patches to push
55 55 qseries print the entire series file
56 56 qtop print the name of the current patch
57 57 qunapplied print the patches not yet applied
58 58 strip strip a changeset and all its descendants from the repository
59 59
60 60 use "hg -v help mq" to show aliases and global options
61 61 adding a
62 62 updating to branch default
63 63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 64 adding b/z
65 65 % qinit
66 66 % -R qinit
67 67 % qinit -c
68 68 A .hgignore
69 69 A series
70 70 % qinit; qinit -c
71 71 .hgignore:
72 72 ^\.hg
73 73 ^\.mq
74 74 syntax: glob
75 75 status
76 76 guards
77 77 series:
78 78 abort: repository already exists!
79 79 % qinit; <stuff>; qinit -c
80 80 adding .hg/patches/A
81 81 adding .hg/patches/B
82 82 A .hgignore
83 83 A A
84 84 A B
85 85 A series
86 86 .hgignore:
87 87 status
88 88 bleh
89 89 series:
90 90 A
91 91 B
92 92 % init --mq without repo
93 93 abort: There is no Mercurial repository here (.hg not found)
94 94 % init --mq with repo path
95 95 ok
96 96 % init --mq with nonexistent directory
97 97 abort: repository nonexistentdir not found!
98 98 % init --mq with bundle (non "local")
99 99 abort: only a local queue repository may be initialized
100 100 % qrefresh
101 101 foo bar
102 102
103 103 diff -r xa
104 104 --- a/a
105 105 +++ b/a
106 106 @@ -1,1 +1,2 @@
107 107 a
108 108 +a
109 109 % empty qrefresh
110 110 revision:
111 111 patch:
112 112 foo bar
113 113
114 114 working dir diff:
115 115 --- a/a
116 116 +++ b/a
117 117 @@ -1,1 +1,2 @@
118 118 a
119 119 +a
120 120 % qpop
121 121 popping test.patch
122 122 patch queue now empty
123 123 % qpush with dump of tag cache
124 124 .hg/tags.cache (pre qpush):
125 125 1
126 126
127 127 applying test.patch
128 128 now at: test.patch
129 129 .hg/tags.cache (post qpush):
130 130 2
131 131
132 132 % pop/push outside repo
133 133 popping test.patch
134 134 patch queue now empty
135 135 applying test.patch
136 136 now at: test.patch
137 137 % qrefresh in subdir
138 138 % pop/push -a in subdir
139 139 popping test2.patch
140 140 popping test.patch
141 141 patch queue now empty
142 142 applying test.patch
143 143 applying test2.patch
144 144 now at: test2.patch
145 145 % qseries
146 146 test.patch
147 147 test2.patch
148 148 0 A test.patch: f...
149 149 1 A test2.patch:
150 150 popping test2.patch
151 151 now at: test.patch
152 152 0 A test.patch: foo bar
153 153 1 U test2.patch:
154 154 mq: 1 applied, 1 unapplied
155 155 applying test2.patch
156 156 now at: test2.patch
157 157 mq: 2 applied
158 158 % qapplied
159 159 test.patch
160 160 test2.patch
161 161 % qtop
162 162 test2.patch
163 163 % prev
164 164 test.patch
165 165 % next
166 166 all patches applied
167 167 popping test2.patch
168 168 now at: test.patch
169 169 % commit should fail
170 170 abort: cannot commit over an applied mq patch
171 171 % push should fail
172 172 pushing to ../../k
173 173 abort: source has mq patches applied
174 174 % import should fail
175 175 abort: cannot import over an applied patch
176 176 % import --no-commit should succeed
177 177 applying ../../import.diff
178 178 M a
179 179 % qunapplied
180 180 test2.patch
181 181 % qpush/qpop with index
182 182 applying test2.patch
183 183 now at: test2.patch
184 184 popping test2.patch
185 185 popping test1b.patch
186 186 now at: test.patch
187 187 applying test1b.patch
188 188 now at: test1b.patch
189 189 applying test2.patch
190 190 now at: test2.patch
191 191 popping test2.patch
192 192 now at: test1b.patch
193 193 popping test1b.patch
194 194 now at: test.patch
195 195 applying test1b.patch
196 196 applying test2.patch
197 197 now at: test2.patch
198 198 % qpush --move
199 199 popping test2.patch
200 200 popping test1b.patch
201 201 popping test.patch
202 202 patch queue now empty
203 203 applying test2.patch
204 204 now at: test2.patch
205 205 applying test1b.patch
206 206 now at: test1b.patch
207 207 applying test.patch
208 208 now at: test.patch
209 209 0 A test2.patch
210 210 1 A test1b.patch
211 211 2 A test.patch
212 212 popping test.patch
213 213 popping test1b.patch
214 214 popping test2.patch
215 215 patch queue now empty
216 216 applying test.patch
217 217 now at: test.patch
218 218 applying test1b.patch
219 219 now at: test1b.patch
220 220 abort: patch bogus not in series
221 221 abort: cannot push to a previous patch: test.patch
222 222 applying test2.patch
223 223 now at: test2.patch
224 224 % pop, qapplied, qunapplied
225 225 0 A test.patch
226 226 1 A test1b.patch
227 227 2 A test2.patch
228 228 % qapplied -1 test.patch
229 229 only one patch applied
230 230 % qapplied -1 test1b.patch
231 231 test.patch
232 232 % qapplied -1 test2.patch
233 233 test1b.patch
234 234 % qapplied -1
235 235 test1b.patch
236 236 % qapplied
237 237 test.patch
238 238 test1b.patch
239 239 test2.patch
240 240 % qapplied test1b.patch
241 241 test.patch
242 242 test1b.patch
243 243 % qunapplied -1
244 244 all patches applied
245 245 % qunapplied
246 246 % popping
247 247 popping test2.patch
248 248 now at: test1b.patch
249 249 % qunapplied -1
250 250 test2.patch
251 251 % qunapplied
252 252 test2.patch
253 253 % qunapplied test2.patch
254 254 % qunapplied -1 test2.patch
255 255 all patches applied
256 256 % popping -a
257 257 popping test1b.patch
258 258 popping test.patch
259 259 patch queue now empty
260 260 % qapplied
261 261 % qapplied -1
262 262 no patches applied
263 263 applying test.patch
264 264 now at: test.patch
265 265 % push should succeed
266 266 popping test.patch
267 267 patch queue now empty
268 268 pushing to ../../k
269 269 searching for changes
270 270 adding changesets
271 271 adding manifests
272 272 adding file changes
273 273 added 1 changesets with 1 changes to 1 files
274 274 % qpush/qpop error codes
275 275 applying test.patch
276 276 applying test1b.patch
277 277 applying test2.patch
278 278 now at: test2.patch
279 279 % pops all patches and succeeds
280 280 popping test2.patch
281 281 popping test1b.patch
282 282 popping test.patch
283 283 patch queue now empty
284 284 qpop -a succeeds
285 285 % does nothing and succeeds
286 286 no patches applied
287 287 qpop -a succeeds
288 288 % fails - nothing else to pop
289 289 no patches applied
290 290 qpop fails
291 291 % pushes a patch and succeeds
292 292 applying test.patch
293 293 now at: test.patch
294 294 qpush succeeds
295 295 % pops a patch and succeeds
296 296 popping test.patch
297 297 patch queue now empty
298 298 qpop succeeds
299 299 % pushes up to test1b.patch and succeeds
300 300 applying test.patch
301 301 applying test1b.patch
302 302 now at: test1b.patch
303 303 qpush test1b.patch succeeds
304 304 % does nothing and succeeds
305 305 qpush: test1b.patch is already at the top
306 306 qpush test1b.patch succeeds
307 307 % does nothing and succeeds
308 308 qpop: test1b.patch is already at the top
309 309 qpop test1b.patch succeeds
310 310 % fails - can't push to this patch
311 311 abort: cannot push to a previous patch: test.patch
312 312 qpush test.patch fails
313 313 % fails - can't pop to this patch
314 314 abort: patch test2.patch is not applied
315 315 qpop test2.patch fails
316 316 % pops up to test.patch and succeeds
317 317 popping test1b.patch
318 318 now at: test.patch
319 319 qpop test.patch succeeds
320 320 % pushes all patches and succeeds
321 321 applying test1b.patch
322 322 applying test2.patch
323 323 now at: test2.patch
324 324 qpush -a succeeds
325 325 % does nothing and succeeds
326 326 all patches are currently applied
327 327 qpush -a succeeds
328 328 % fails - nothing else to push
329 329 patch series already fully applied
330 330 qpush fails
331 331 % does nothing and succeeds
332 332 qpush: test2.patch is already at the top
333 333 qpush test2.patch succeeds
334 334 % strip
335 335 adding x
336 336 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
337 337 saved backup bundle to
338 338 adding changesets
339 339 adding manifests
340 340 adding file changes
341 341 added 1 changesets with 1 changes to 1 files
342 342 (run 'hg update' to get a working copy)
343 343 % strip with local changes, should complain
344 344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 345 abort: local changes found
346 346 % --force strip with local changes
347 347 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
348 348 saved backup bundle to
349 349 % cd b; hg qrefresh
350 350 adding a
351 351 foo
352 352
353 353 diff -r cb9a9f314b8b a
354 354 --- a/a
355 355 +++ b/a
356 356 @@ -1,1 +1,2 @@
357 357 a
358 358 +a
359 359 diff -r cb9a9f314b8b b/f
360 360 --- /dev/null
361 361 +++ b/b/f
362 362 @@ -0,0 +1,1 @@
363 363 +f
364 364 % hg qrefresh .
365 365 foo
366 366
367 367 diff -r cb9a9f314b8b b/f
368 368 --- /dev/null
369 369 +++ b/b/f
370 370 @@ -0,0 +1,1 @@
371 371 +f
372 372 M a
373 373 % qpush failure
374 374 popping bar
375 375 popping foo
376 376 patch queue now empty
377 377 applying foo
378 378 applying bar
379 379 file foo already exists
380 380 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
381 381 patch failed, unable to continue (try -v)
382 382 patch failed, rejects left in working dir
383 383 errors during apply, please fix and refresh bar
384 384 ? foo
385 385 ? foo.rej
386 386 % mq tags
387 387 0 qparent
388 388 1 foo qbase
389 389 2 bar qtip tip
390 390 % bad node in status
391 391 popping bar
392 392 now at: foo
393 393 changeset: 0:cb9a9f314b8b
394 394 mq status file refers to unknown node
395 395 tag: tip
396 396 user: test
397 397 date: Thu Jan 01 00:00:00 1970 +0000
398 398 summary: a
399 399
400 400 mq status file refers to unknown node
401 401 default 0:cb9a9f314b8b
402 402 abort: trying to pop unknown node
403 403 new file
404 404
405 405 diff --git a/new b/new
406 406 new file mode 100755
407 407 --- /dev/null
408 408 +++ b/new
409 409 @@ -0,0 +1,1 @@
410 410 +foo
411 411 copy file
412 412
413 413 diff --git a/new b/copy
414 414 copy from new
415 415 copy to copy
416 416 popping copy
417 417 now at: new
418 418 applying copy
419 419 now at: copy
420 420 diff --git a/new b/copy
421 421 copy from new
422 422 copy to copy
423 423 diff --git a/new b/copy
424 424 copy from new
425 425 copy to copy
426 426 % test file addition in slow path
427 427 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
428 428 created new head
429 429 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
430 adding branch
431 adding changesets
432 adding manifests
433 adding file changes
434 added 1 changesets with 1 changes to 1 files
435 430 diff --git a/bar b/bar
436 431 new file mode 100644
437 432 --- /dev/null
438 433 +++ b/bar
439 434 @@ -0,0 +1,1 @@
440 435 +bar
441 436 diff --git a/foo b/baz
442 437 rename from foo
443 438 rename to baz
444 439 2 baz (foo)
445 440 diff --git a/bar b/bar
446 441 new file mode 100644
447 442 --- /dev/null
448 443 +++ b/bar
449 444 @@ -0,0 +1,1 @@
450 445 +bar
451 446 diff --git a/foo b/baz
452 447 rename from foo
453 448 rename to baz
454 449 2 baz (foo)
455 450 diff --git a/bar b/bar
456 451 diff --git a/foo b/baz
457 452 % test file move chains in the slow path
458 453 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
459 454 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
460 adding branch
461 adding changesets
462 adding manifests
463 adding file changes
464 added 1 changesets with 1 changes to 1 files
465 455 diff --git a/foo b/bleh
466 456 rename from foo
467 457 rename to bleh
468 458 diff --git a/quux b/quux
469 459 new file mode 100644
470 460 --- /dev/null
471 461 +++ b/quux
472 462 @@ -0,0 +1,1 @@
473 463 +bar
474 464 3 bleh (foo)
475 465 diff --git a/foo b/barney
476 466 rename from foo
477 467 rename to barney
478 468 diff --git a/fred b/fred
479 469 new file mode 100644
480 470 --- /dev/null
481 471 +++ b/fred
482 472 @@ -0,0 +1,1 @@
483 473 +bar
484 474 3 barney (foo)
485 475 % refresh omitting an added file
486 476 C newfile
487 477 A newfile
488 478 popping baz
489 479 now at: bar
490 480 % create a git patch
491 481 diff --git a/alexander b/alexander
492 482 % create a git binary patch
493 483 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
494 484 diff --git a/bucephalus b/bucephalus
495 485 % check binary patches can be popped and pushed
496 486 popping addbucephalus
497 487 now at: addalexander
498 488 applying addbucephalus
499 489 now at: addbucephalus
500 490 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
501 491 % strip again
502 492 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
503 493 created new head
504 494 merging foo
505 495 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
506 496 (branch merge, don't forget to commit)
507 497 changeset: 3:99615015637b
508 498 tag: tip
509 499 parent: 2:20cbbe65cff7
510 500 parent: 1:d2871fc282d4
511 501 user: test
512 502 date: Thu Jan 01 00:00:00 1970 +0000
513 503 summary: merge
514 504
515 505 changeset: 2:20cbbe65cff7
516 506 parent: 0:53245c60e682
517 507 user: test
518 508 date: Thu Jan 01 00:00:00 1970 +0000
519 509 summary: change foo 2
520 510
521 511 changeset: 1:d2871fc282d4
522 512 user: test
523 513 date: Thu Jan 01 00:00:00 1970 +0000
524 514 summary: change foo 1
525 515
526 516 changeset: 0:53245c60e682
527 517 user: test
528 518 date: Thu Jan 01 00:00:00 1970 +0000
529 519 summary: add foo
530 520
531 521 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 522 saved backup bundle to
533 adding branch
534 adding changesets
535 adding manifests
536 adding file changes
537 added 1 changesets with 1 changes to 1 files
538 523 changeset: 1:20cbbe65cff7
539 524 tag: tip
540 525 user: test
541 526 date: Thu Jan 01 00:00:00 1970 +0000
542 527 summary: change foo 2
543 528
544 529 changeset: 0:53245c60e682
545 530 user: test
546 531 date: Thu Jan 01 00:00:00 1970 +0000
547 532 summary: add foo
548 533
549 534 % qclone
550 535 abort: versioned patch repository not found (see init --mq)
551 536 adding .hg/patches/patch1
552 537 main repo:
553 538 rev 1: change foo
554 539 rev 0: add foo
555 540 patch repo:
556 541 rev 0: checkpoint
557 542 updating to branch default
558 543 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
559 544 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
560 545 main repo:
561 546 rev 0: add foo
562 547 patch repo:
563 548 rev 0: checkpoint
564 549 popping patch1
565 550 patch queue now empty
566 551 main repo:
567 552 rev 0: add foo
568 553 patch repo:
569 554 rev 0: checkpoint
570 555 updating to branch default
571 556 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
572 557 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
573 558 main repo:
574 559 rev 0: add foo
575 560 patch repo:
576 561 rev 0: checkpoint
577 562 % test applying on an empty file (issue 1033)
578 563 adding a
579 564 popping changea
580 565 patch queue now empty
581 566 applying changea
582 567 now at: changea
583 568 % test qpush with --force, issue1087
584 569 adding bye.txt
585 570 adding hello.txt
586 571 popping empty
587 572 patch queue now empty
588 573 % qpush should fail, local changes
589 574 abort: local changes found, refresh first
590 575 % apply force, should not discard changes with empty patch
591 576 applying empty
592 577 patch empty is empty
593 578 now at: empty
594 579 diff -r bf5fc3f07a0a hello.txt
595 580 --- a/hello.txt
596 581 +++ b/hello.txt
597 582 @@ -1,1 +1,2 @@
598 583 hello
599 584 +world
600 585 diff -r 9ecee4f634e3 hello.txt
601 586 --- a/hello.txt
602 587 +++ b/hello.txt
603 588 @@ -1,1 +1,2 @@
604 589 hello
605 590 +world
606 591 changeset: 1:bf5fc3f07a0a
607 592 tag: empty
608 593 tag: qbase
609 594 tag: qtip
610 595 tag: tip
611 596 user: test
612 597 date: Thu Jan 01 00:00:00 1970 +0000
613 598 summary: imported patch empty
614 599
615 600
616 601 popping empty
617 602 patch queue now empty
618 603 % qpush should fail, local changes
619 604 abort: local changes found, refresh first
620 605 % apply force, should discard changes in hello, but not bye
621 606 applying empty
622 607 now at: empty
623 608 M bye.txt
624 609 diff -r ba252371dbc1 bye.txt
625 610 --- a/bye.txt
626 611 +++ b/bye.txt
627 612 @@ -1,1 +1,2 @@
628 613 bye
629 614 +universe
630 615 diff -r 9ecee4f634e3 bye.txt
631 616 --- a/bye.txt
632 617 +++ b/bye.txt
633 618 @@ -1,1 +1,2 @@
634 619 bye
635 620 +universe
636 621 diff -r 9ecee4f634e3 hello.txt
637 622 --- a/hello.txt
638 623 +++ b/hello.txt
639 624 @@ -1,1 +1,3 @@
640 625 hello
641 626 +world
642 627 +universe
643 628 % test popping revisions not in working dir ancestry
644 629 0 A empty
645 630 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 631 popping empty
647 632 patch queue now empty
648 633 % test popping must remove files added in subdirectories first
649 634 popping rename-dir
650 635 patch queue now empty
@@ -1,186 +1,171 b''
1 1
2 2 @ 8:c11d5b3e9c00 F branch: branch3
3 3 |
4 4 o 7:33c9da881988 Branch3 branch: branch3
5 5 |
6 6 | o 6:0e4064ab11a3 E branch: branch2
7 7 | |
8 8 | o 5:5ac035cb5d8f D branch: branch2
9 9 | |
10 10 | | o 4:8e66061486ee C branch: branch2
11 11 | | |
12 12 +---o 3:99567862abbe Branch2 branch: branch2
13 13 | |
14 14 | o 2:65a26a4d12f6 B branch: branch1
15 15 | |
16 16 | o 1:0f3f3010ee16 Branch1 branch: branch1
17 17 |/
18 18 o 0:1994f17a630e A branch:
19 19
20 20
21 21 % Branches
22 22 branch3 8:c11d5b3e9c00
23 23 branch2 6:0e4064ab11a3
24 24 branch1 2:65a26a4d12f6 (inactive)
25 25 default 0:1994f17a630e (inactive)
26 26
27 27 % Heads
28 28 8:c11d5b3e9c00 F branch: branch3
29 29 6:0e4064ab11a3 E branch: branch2
30 30 4:8e66061486ee C branch: branch2
31 31 2:65a26a4d12f6 B branch: branch1
32 32 0:1994f17a630e A branch:
33 33
34 34 % Rebase part of branch2 (5-6) onto branch3 (8)
35 35 saved backup bundle to
36 adding branch
37 adding changesets
38 adding manifests
39 adding file changes
40 added 4 changesets with 3 changes to 3 files (+1 heads)
41 36 rebase completed
42 37
43 38 % Branches
44 39 branch3 8:c9bfa9beb84e
45 40 branch2 4:8e66061486ee
46 41 branch1 2:65a26a4d12f6
47 42 default 0:1994f17a630e (inactive)
48 43
49 44 % Heads
50 45 8:c9bfa9beb84e E branch: branch3
51 46 4:8e66061486ee C branch: branch2
52 47 2:65a26a4d12f6 B branch: branch1
53 48 0:1994f17a630e A branch:
54 49
55 50 @ 8:c9bfa9beb84e E branch: branch3
56 51 |
57 52 o 7:bf9037384081 D branch: branch3
58 53 |
59 54 o 6:c11d5b3e9c00 F branch: branch3
60 55 |
61 56 o 5:33c9da881988 Branch3 branch: branch3
62 57 |
63 58 | o 4:8e66061486ee C branch: branch2
64 59 | |
65 60 | o 3:99567862abbe Branch2 branch: branch2
66 61 |/
67 62 | o 2:65a26a4d12f6 B branch: branch1
68 63 | |
69 64 | o 1:0f3f3010ee16 Branch1 branch: branch1
70 65 |/
71 66 o 0:1994f17a630e A branch:
72 67
73 68
74 69 % Rebase head of branch3 (8) onto branch2 (6)
75 70 @ 8:c11d5b3e9c00 F branch: branch3
76 71 |
77 72 o 7:33c9da881988 Branch3 branch: branch3
78 73 |
79 74 | o 6:0e4064ab11a3 E branch: branch2
80 75 | |
81 76 | o 5:5ac035cb5d8f D branch: branch2
82 77 | |
83 78 | | o 4:8e66061486ee C branch: branch2
84 79 | | |
85 80 +---o 3:99567862abbe Branch2 branch: branch2
86 81 | |
87 82 | o 2:65a26a4d12f6 B branch: branch1
88 83 | |
89 84 | o 1:0f3f3010ee16 Branch1 branch: branch1
90 85 |/
91 86 o 0:1994f17a630e A branch:
92 87
93 88 saved backup bundle to
94 adding branch
95 adding changesets
96 adding manifests
97 adding file changes
98 added 1 changesets with 1 changes to 1 files
99 89 rebase completed
100 90
101 91 % Branches
102 92 branch2 8:b44d3024f247
103 93 branch3 7:33c9da881988
104 94 branch1 2:65a26a4d12f6 (inactive)
105 95 default 0:1994f17a630e (inactive)
106 96
107 97 % Heads
108 98 8:b44d3024f247 F branch: branch2
109 99 7:33c9da881988 Branch3 branch: branch3
110 100 4:8e66061486ee C branch: branch2
111 101 2:65a26a4d12f6 B branch: branch1
112 102 0:1994f17a630e A branch:
113 103
114 104 @ 8:b44d3024f247 F branch: branch2
115 105 |
116 106 | o 7:33c9da881988 Branch3 branch: branch3
117 107 | |
118 108 o | 6:0e4064ab11a3 E branch: branch2
119 109 | |
120 110 o | 5:5ac035cb5d8f D branch: branch2
121 111 | |
122 112 | | o 4:8e66061486ee C branch: branch2
123 113 | | |
124 114 | | o 3:99567862abbe Branch2 branch: branch2
125 115 | |/
126 116 o | 2:65a26a4d12f6 B branch: branch1
127 117 | |
128 118 o | 1:0f3f3010ee16 Branch1 branch: branch1
129 119 |/
130 120 o 0:1994f17a630e A branch:
131 121
132 122
133 123 % Rebase entire branch3 (7-8) onto branch2 (6)
134 124 @ 8:c11d5b3e9c00 F branch: branch3
135 125 |
136 126 o 7:33c9da881988 Branch3 branch: branch3
137 127 |
138 128 | o 6:0e4064ab11a3 E branch: branch2
139 129 | |
140 130 | o 5:5ac035cb5d8f D branch: branch2
141 131 | |
142 132 | | o 4:8e66061486ee C branch: branch2
143 133 | | |
144 134 +---o 3:99567862abbe Branch2 branch: branch2
145 135 | |
146 136 | o 2:65a26a4d12f6 B branch: branch1
147 137 | |
148 138 | o 1:0f3f3010ee16 Branch1 branch: branch1
149 139 |/
150 140 o 0:1994f17a630e A branch:
151 141
152 142 saved backup bundle to
153 adding branch
154 adding changesets
155 adding manifests
156 adding file changes
157 added 1 changesets with 1 changes to 1 files
158 143 rebase completed
159 144
160 145 % Branches
161 146 branch2 7:b44d3024f247
162 147 branch1 2:65a26a4d12f6 (inactive)
163 148 default 0:1994f17a630e (inactive)
164 149
165 150 % Heads
166 151 7:b44d3024f247 F branch: branch2
167 152 4:8e66061486ee C branch: branch2
168 153 2:65a26a4d12f6 B branch: branch1
169 154 0:1994f17a630e A branch:
170 155
171 156 @ 7:b44d3024f247 F branch: branch2
172 157 |
173 158 o 6:0e4064ab11a3 E branch: branch2
174 159 |
175 160 o 5:5ac035cb5d8f D branch: branch2
176 161 |
177 162 | o 4:8e66061486ee C branch: branch2
178 163 | |
179 164 | o 3:99567862abbe Branch2 branch: branch2
180 165 | |
181 166 o | 2:65a26a4d12f6 B branch: branch1
182 167 | |
183 168 o | 1:0f3f3010ee16 Branch1 branch: branch1
184 169 |/
185 170 o 0:1994f17a630e A branch:
186 171
@@ -1,76 +1,71 b''
1 1
2 2 % - Rebasing B onto E - check keep
3 3 @ 5:F:notdefault
4 4 |
5 5 | o 4:E:
6 6 | |
7 7 | o 3:D:
8 8 |/
9 9 | o 2:C:
10 10 | |
11 11 | o 1:B:
12 12 |/
13 13 o 0:A:
14 14
15 15 warning: conflicts during merge.
16 16 merging A failed!
17 17 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
18 18 merging A
19 19
20 20 % - Solve the conflict and go on
21 21 rebase completed
22 22 @ 7:C:
23 23 |
24 24 o 6:B:
25 25 |
26 26 | o 5:F:notdefault
27 27 | |
28 28 o | 4:E:
29 29 | |
30 30 o | 3:D:
31 31 |/
32 32 | o 2:C:
33 33 | |
34 34 | o 1:B:
35 35 |/
36 36 o 0:A:
37 37
38 38
39 39 % - Rebase F onto E - check keepbranches
40 40 @ 5:F:notdefault
41 41 |
42 42 | o 4:E:
43 43 | |
44 44 | o 3:D:
45 45 |/
46 46 | o 2:C:
47 47 | |
48 48 | o 1:B:
49 49 |/
50 50 o 0:A:
51 51
52 52 warning: conflicts during merge.
53 53 merging A failed!
54 54 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
55 55 merging A
56 56
57 57 % - Solve the conflict and go on
58 58 saved backup bundle to
59 adding branch
60 adding changesets
61 adding manifests
62 adding file changes
63 added 1 changesets with 1 changes to 1 files
64 59 rebase completed
65 60 @ 5:F:notdefault
66 61 |
67 62 o 4:E:
68 63 |
69 64 o 3:D:
70 65 |
71 66 | o 2:C:
72 67 | |
73 68 | o 1:B:
74 69 |/
75 70 o 0:A:
76 71
@@ -1,215 +1,190 b''
1 1 @ 7: H
2 2 |
3 3 | o 6: G
4 4 |/|
5 5 o | 5: F
6 6 | |
7 7 | o 4: E
8 8 |/
9 9 | o 3: D
10 10 | |
11 11 | o 2: C
12 12 | |
13 13 | o 1: B
14 14 |/
15 15 o 0: A
16 16
17 17 % Rebasing B onto H
18 18 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
19 19 saved backup bundle to
20 adding branch
21 adding changesets
22 adding manifests
23 adding file changes
24 added 5 changesets with 6 changes to 6 files (+1 heads)
25 20 rebase completed
26 21 @ 5: Collapsed revision
27 22 | * B
28 23 | * C
29 24 | * D
30 25 o 4: H
31 26 |
32 27 | o 3: G
33 28 |/|
34 29 o | 2: F
35 30 | |
36 31 | o 1: E
37 32 |/
38 33 o 0: A
39 34
40 35 Expected A, B, C, D, F, H
41 36 A
42 37 B
43 38 C
44 39 D
45 40 F
46 41 H
47 42
48 43 % Rebasing G onto H
49 44 saved backup bundle to
50 adding branch
51 adding changesets
52 adding manifests
53 adding file changes
54 added 3 changesets with 3 changes to 3 files (+1 heads)
55 45 rebase completed
56 46 @ 6: Collapsed revision
57 47 | * E
58 48 | * G
59 49 o 5: H
60 50 |
61 51 o 4: F
62 52 |
63 53 | o 3: D
64 54 | |
65 55 | o 2: C
66 56 | |
67 57 | o 1: B
68 58 |/
69 59 o 0: A
70 60
71 61 Expected A, E, F, H
72 62 A
73 63 E
74 64 F
75 65 H
76 66
77 67 @ 7: H
78 68 |
79 69 | o 6: G
80 70 | |\
81 71 | | o 5: F
82 72 | | |
83 73 | | o 4: E
84 74 | | |
85 75 | o | 3: D
86 76 | |\|
87 77 | o | 2: C
88 78 |/ /
89 79 | o 1: B
90 80 |/
91 81 o 0: A
92 82
93 83
94 84 % Rebase and collapse - more than one external (fail)
95 85 abort: unable to collapse, there is more than one external parent
96 86
97 87 % Rebase and collapse - E onto H
98 88 saved backup bundle to
99 adding branch
100 adding changesets
101 adding manifests
102 adding file changes
103 added 2 changesets with 3 changes to 3 files
104 89 rebase completed
105 90 @ 5: Collapsed revision
106 91 |\ * E
107 92 | | * F
108 93 | | * G
109 94 | o 4: H
110 95 | |
111 96 o | 3: D
112 97 |\ \
113 98 | o | 2: C
114 99 | |/
115 100 o / 1: B
116 101 |/
117 102 o 0: A
118 103
119 104 Expected A, B, C, E, F, H
120 105 A
121 106 B
122 107 C
123 108 E
124 109 F
125 110 H
126 111
127 112 @ 8: I
128 113 |
129 114 | o 7: H
130 115 | |\
131 116 | | o 6: G
132 117 | | |
133 118 | | o 5: F
134 119 | | |
135 120 | | o 4: E
136 121 | | |
137 122 | o | 3: D
138 123 | |\|
139 124 | o | 2: C
140 125 |/ /
141 126 | o 1: B
142 127 |/
143 128 o 0: A
144 129
145 130
146 131 % Rebase and collapse - E onto I
147 132 merging E
148 133 saved backup bundle to
149 adding branch
150 adding changesets
151 adding manifests
152 adding file changes
153 added 2 changesets with 3 changes to 3 files
154 134 rebase completed
155 135 @ 5: Collapsed revision
156 136 |\ * E
157 137 | | * F
158 138 | | * G
159 139 | | * H
160 140 | o 4: I
161 141 | |
162 142 o | 3: D
163 143 |\ \
164 144 | o | 2: C
165 145 | |/
166 146 o / 1: B
167 147 |/
168 148 o 0: A
169 149
170 150 Expected A, B, C, E, G, I
171 151 A
172 152 B
173 153 C
174 154 E
175 155 G
176 156 I
177 157 Cat E:
178 158 F
179 159
180 160 @ 5: F
181 161 |
182 162 | o 4: E
183 163 | |\
184 164 | | o 3: D
185 165 | | |
186 166 | o | 2: C
187 167 | |/
188 168 | o 1: B
189 169 |/
190 170 o 0: A
191 171
192 172
193 173 % Rebase and collapse - B onto F
194 174 saved backup bundle to
195 adding branch
196 adding changesets
197 adding manifests
198 adding file changes
199 added 2 changesets with 4 changes to 4 files
200 175 rebase completed
201 176 @ 2: Collapsed revision
202 177 | * B
203 178 | * C
204 179 | * D
205 180 | * E
206 181 o 1: F
207 182 |
208 183 o 0: A
209 184
210 185 Expected A, B, C, D, F
211 186 A
212 187 B
213 188 C
214 189 D
215 190 F
@@ -1,66 +1,61 b''
1 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 2 created new head
3 3 @ 5: L3
4 4 |
5 5 o 4: L2
6 6 |
7 7 o 3: L1
8 8 |
9 9 | o 2: C3
10 10 |/
11 11 o 1: C2
12 12 |
13 13 o 0: C1
14 14
15 15
16 16 % Try to call --continue
17 17 abort: no rebase in progress
18 18
19 19 % Conflicting rebase
20 20 merging common
21 21 warning: conflicts during merge.
22 22 merging common failed!
23 23 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
24 24
25 25 % Try to continue without solving the conflict
26 26 abort: unresolved merge conflicts (see hg resolve)
27 27
28 28 % Conclude rebase
29 29 saved backup bundle to
30 adding branch
31 adding changesets
32 adding manifests
33 adding file changes
34 added 3 changesets with 3 changes to 3 files
35 30 rebase completed
36 31 @ 5: L3
37 32 |
38 33 o 4: L2
39 34 |
40 35 o 3: L1
41 36 |
42 37 o 2: C3
43 38 |
44 39 o 1: C2
45 40 |
46 41 o 0: C1
47 42
48 43
49 44 % Check correctness
50 45 - Rev. 0
51 46 c1
52 47 - Rev. 1
53 48 c1
54 49 c2
55 50 - Rev. 2
56 51 c1
57 52 c2
58 53 c3
59 54 - Rev. 3
60 55 c1
61 56 c2
62 57 c3
63 58 - Rev. 4
64 59 resolved merge
65 60 - Rev. 5
66 61 resolved merge
@@ -1,134 +1,114 b''
1 1 @ 4: E
2 2 |
3 3 | o 3: D
4 4 | |
5 5 | o 2: C
6 6 | |
7 7 | o 1: B
8 8 |/
9 9 o 0: A
10 10
11 11 % Rebasing D onto E detaching from C
12 12 saved backup bundle to
13 adding branch
14 adding changesets
15 adding manifests
16 adding file changes
17 added 2 changesets with 2 changes to 2 files (+1 heads)
18 13 rebase completed
19 14 @ 4: D
20 15 |
21 16 o 3: E
22 17 |
23 18 | o 2: C
24 19 | |
25 20 | o 1: B
26 21 |/
27 22 o 0: A
28 23
29 24 Expected A, D, E
30 25 A
31 26 D
32 27 E
33 28
34 29 @ 4: E
35 30 |
36 31 | o 3: D
37 32 | |
38 33 | o 2: C
39 34 | |
40 35 | o 1: B
41 36 |/
42 37 o 0: A
43 38
44 39 % Rebasing C onto E detaching from B
45 40 saved backup bundle to
46 adding branch
47 adding changesets
48 adding manifests
49 adding file changes
50 added 3 changesets with 3 changes to 3 files (+1 heads)
51 41 rebase completed
52 42 @ 4: D
53 43 |
54 44 o 3: C
55 45 |
56 46 o 2: E
57 47 |
58 48 | o 1: B
59 49 |/
60 50 o 0: A
61 51
62 52 Expected A, C, D, E
63 53 A
64 54 C
65 55 D
66 56 E
67 57
68 58 @ 4: E
69 59 |
70 60 | o 3: D
71 61 | |
72 62 | o 2: C
73 63 | |
74 64 | o 1: B
75 65 |/
76 66 o 0: A
77 67
78 68 % Rebasing B onto E using detach (same as not using it)
79 69 saved backup bundle to
80 adding branch
81 adding changesets
82 adding manifests
83 adding file changes
84 added 4 changesets with 4 changes to 4 files
85 70 rebase completed
86 71 @ 4: D
87 72 |
88 73 o 3: C
89 74 |
90 75 o 2: B
91 76 |
92 77 o 1: E
93 78 |
94 79 o 0: A
95 80
96 81 Expected A, B, C, D, E
97 82 A
98 83 B
99 84 C
100 85 D
101 86 E
102 87
103 88 @ 4: E
104 89 |
105 90 | o 3: D
106 91 | |
107 92 | o 2: C
108 93 | |
109 94 | o 1: B
110 95 |/
111 96 o 0: A
112 97
113 98 % Rebasing C onto E detaching from B and collapsing
114 99 saved backup bundle to
115 adding branch
116 adding changesets
117 adding manifests
118 adding file changes
119 added 2 changesets with 3 changes to 3 files (+1 heads)
120 100 rebase completed
121 101 @ 3: Collapsed revision
122 102 | * C
123 103 | * D
124 104 o 2: E
125 105 |
126 106 | o 1: B
127 107 |/
128 108 o 0: A
129 109
130 110 Expected A, C, D, E
131 111 A
132 112 C
133 113 D
134 114 E
@@ -1,64 +1,54 b''
1 1 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2 2 created new head
3 3 @ 4:r2
4 4 |
5 5 o 3:r1
6 6 |
7 7 | o 2:l1
8 8 |/
9 9 o 1:c2
10 10 |
11 11 o 0:c1
12 12
13 13
14 14 % Rebase with no arguments - single revision in source branch
15 15 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
16 16 saved backup bundle to
17 adding branch
18 adding changesets
19 adding manifests
20 adding file changes
21 added 3 changesets with 3 changes to 3 files
22 17 rebase completed
23 18 @ 4:l1
24 19 |
25 20 o 3:r2
26 21 |
27 22 o 2:r1
28 23 |
29 24 o 1:c2
30 25 |
31 26 o 0:c1
32 27
33 28 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
34 29 created new head
35 30 @ 4:r1
36 31 |
37 32 | o 3:l2
38 33 | |
39 34 | o 2:l1
40 35 |/
41 36 o 1:c2
42 37 |
43 38 o 0:c1
44 39
45 40
46 41 % Rebase with no arguments - single revision in target branch
47 42 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
48 43 saved backup bundle to
49 adding branch
50 adding changesets
51 adding manifests
52 adding file changes
53 added 3 changesets with 3 changes to 3 files
54 44 rebase completed
55 45 @ 4:l2
56 46 |
57 47 o 3:l1
58 48 |
59 49 o 2:r1
60 50 |
61 51 o 1:c2
62 52 |
63 53 o 0:c1
64 54
@@ -1,23 +1,18 b''
1 1 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2 2
3 3 % "Mainstream" import p1.patch
4 4 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
5 5 applying p1.patch
6 6
7 7 % Rebase
8 8 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
9 9 saved backup bundle to
10 adding branch
11 adding changesets
12 adding manifests
13 adding file changes
14 added 2 changesets with 2 changes to 2 files
15 10 rebase completed
16 11 @ 3 P0 tags: p0.patch qbase qtip tip
17 12 |
18 13 o 2 P1 tags: qparent
19 14 |
20 15 o 1 R1 tags:
21 16 |
22 17 o 0 C1 tags:
23 18
@@ -1,138 +1,133 b''
1 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 2 @ 3 P1 tags: f2.patch qtip tip
3 3 |
4 4 o 2 P0 tags: f.patch qbase
5 5 |
6 6 | o 1 R1 tags:
7 7 |/
8 8 o 0 C1 tags: qparent
9 9
10 10
11 11 % Rebase - try to rebase on an applied mq patch
12 12 abort: cannot rebase onto an applied mq patch
13 13
14 14 % Rebase - same thing, but mq patch is default dest
15 15 abort: cannot rebase onto an applied mq patch
16 16
17 17 % Rebase - generate a conflict
18 18 merging f
19 19 warning: conflicts during merge.
20 20 merging f failed!
21 21 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
22 22
23 23 % Fix the 1st conflict
24 24 warning: conflicts during merge.
25 25 merging f failed!
26 26 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
27 27 merging f
28 28
29 29 % Fix the 2nd conflict
30 30 saved backup bundle to
31 adding branch
32 adding changesets
33 adding manifests
34 adding file changes
35 added 2 changesets with 2 changes to 1 files
36 31 rebase completed
37 32 @ 3 P1 tags: f2.patch qtip tip
38 33 |
39 34 o 2 P0 tags: f.patch qbase
40 35 |
41 36 o 1 R1 tags: qparent
42 37 |
43 38 o 0 C1 tags:
44 39
45 40
46 41 % Update to qbase
47 42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 43 % f correctly reflects the merge result
49 44 mq1r1
50 45 % And the patch is correct
51 46 # HG changeset patch
52 47 # User test
53 48 # Date
54 49 # Node ID
55 50 # Parent
56 51 P0
57 52
58 53 diff -r x -r y f
59 54 --- a/f
60 55 +++ b/f
61 56 @@ -1,1 +1,1 @@
62 57 -r1
63 58 +mq1r1
64 59
65 60 % Update to qtip
66 61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 62 % f correctly reflects the merge result
68 63 mq1r1mq2
69 64 % And the patch is correct
70 65 # HG changeset patch
71 66 # User test
72 67 # Date
73 68 # Node ID
74 69 # Parent
75 70 P1
76 71
77 72 diff -r x -r y f
78 73 --- a/f
79 74 +++ b/f
80 75 @@ -1,1 +1,1 @@
81 76 -mq1r1
82 77 +mq1r1mq2
83 78
84 79 % Adding one git-style patch and one normal
85 80 popping f2.patch
86 81 popping f.patch
87 82 patch queue now empty
88 83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 84 % Git patch
90 85 P0 (git)
91 86
92 87 diff --git a/p b/p
93 88 new file mode 100644
94 89 --- /dev/null
95 90 +++ b/p
96 91 @@ -0,0 +1,1 @@
97 92 +mq1
98 93
99 94 % Normal patch
100 95 P1
101 96
102 97 diff -r x p
103 98 --- a/p
104 99 +++ b/p
105 100 @@ -1,1 +1,1 @@
106 101 -mq1
107 102 +mq2
108 103
109 104 % Rebase the applied mq patches
110 105 % And the patches are correct
111 106 % Git patch
112 107 # HG changeset patch
113 108 # User test
114 109 # Date
115 110 # Node ID
116 111 # Parent
117 112 P0 (git)
118 113
119 114 diff --git a/p b/p
120 115 new file mode 100644
121 116 --- /dev/null
122 117 +++ b/p
123 118 @@ -0,0 +1,1 @@
124 119 +mq1
125 120
126 121 % Normal patch
127 122 # HG changeset patch
128 123 # User test
129 124 # Date
130 125 # Node ID
131 126 # Parent
132 127 P1
133 128
134 129 --- a/p
135 130 +++ b/p
136 131 @@ -1,1 +1,1 @@
137 132 -mq1
138 133 +mq2
@@ -1,344 +1,304 b''
1 1 % These fail
2 2
3 3 % Use continue and abort
4 4 hg rebase: cannot use both abort and continue
5 5 hg rebase [-s REV | -b REV] [-d REV] [options]
6 6 hg rebase {-a|-c}
7 7
8 8 move changeset (and descendants) to a different branch
9 9
10 10 Rebase uses repeated merging to graft changesets from one part of history
11 11 (the source) onto another (the destination). This can be useful for
12 12 linearizing *local* changes relative to a master development tree.
13 13
14 14 You should not rebase changesets that have already been shared with
15 15 others. Doing so will force everybody else to perform the same rebase or
16 16 they will end up with duplicated changesets after pulling in your rebased
17 17 changesets.
18 18
19 19 If you don't specify a destination changeset ("-d/--dest"), rebase uses
20 20 the tipmost head of the current named branch as the destination. (The
21 21 destination changeset is not modified by rebasing, but new changesets are
22 22 added as its descendants.)
23 23
24 24 You can specify which changesets to rebase in two ways: as a "source"
25 25 changeset or as a "base" changeset. Both are shorthand for a topologically
26 26 related set of changesets (the "source branch"). If you specify source
27 27 ("-s/--source"), rebase will rebase that changeset and all of its
28 28 descendants onto dest. If you specify base ("-b/--base"), rebase will
29 29 select ancestors of base back to but not including the common ancestor
30 30 with dest. Thus, "-b" is less precise but more convenient than "-s": you
31 31 can specify any changeset in the source branch, and rebase will select the
32 32 whole branch. If you specify neither "-s" nor "-b", rebase uses the parent
33 33 of the working directory as the base.
34 34
35 35 By default, rebase recreates the changesets in the source branch as
36 36 descendants of dest and then destroys the originals. Use "--keep" to
37 37 preserve the original source changesets. Some changesets in the source
38 38 branch (e.g. merges from the destination branch) may be dropped if they no
39 39 longer contribute any change.
40 40
41 41 One result of the rules for selecting the destination changeset and source
42 42 branch is that, unlike "merge", rebase will do nothing if you are at the
43 43 latest (tipmost) head of a named branch with two heads. You need to
44 44 explicitly specify source and/or destination (or "update" to the other
45 45 head, if it's the head of the intended source branch).
46 46
47 47 If a rebase is interrupted to manually resolve a merge, it can be
48 48 continued with --continue/-c or aborted with --abort/-a.
49 49
50 50 options:
51 51
52 52 -s --source rebase from the specified changeset
53 53 -b --base rebase from the base of the specified changeset (up to
54 54 greatest common ancestor of base and dest)
55 55 -d --dest rebase onto the specified changeset
56 56 --collapse collapse the rebased changesets
57 57 --keep keep original changesets
58 58 --keepbranches keep original branch names
59 59 --detach force detaching of source from its original branch
60 60 -c --continue continue an interrupted rebase
61 61 -a --abort abort an interrupted rebase
62 62 --style display using template map file
63 63 --template display with template
64 64
65 65 use "hg -v help rebase" to show global options
66 66
67 67 % Use continue and collapse
68 68 hg rebase: cannot use collapse with continue or abort
69 69 hg rebase [-s REV | -b REV] [-d REV] [options]
70 70 hg rebase {-a|-c}
71 71
72 72 move changeset (and descendants) to a different branch
73 73
74 74 Rebase uses repeated merging to graft changesets from one part of history
75 75 (the source) onto another (the destination). This can be useful for
76 76 linearizing *local* changes relative to a master development tree.
77 77
78 78 You should not rebase changesets that have already been shared with
79 79 others. Doing so will force everybody else to perform the same rebase or
80 80 they will end up with duplicated changesets after pulling in your rebased
81 81 changesets.
82 82
83 83 If you don't specify a destination changeset ("-d/--dest"), rebase uses
84 84 the tipmost head of the current named branch as the destination. (The
85 85 destination changeset is not modified by rebasing, but new changesets are
86 86 added as its descendants.)
87 87
88 88 You can specify which changesets to rebase in two ways: as a "source"
89 89 changeset or as a "base" changeset. Both are shorthand for a topologically
90 90 related set of changesets (the "source branch"). If you specify source
91 91 ("-s/--source"), rebase will rebase that changeset and all of its
92 92 descendants onto dest. If you specify base ("-b/--base"), rebase will
93 93 select ancestors of base back to but not including the common ancestor
94 94 with dest. Thus, "-b" is less precise but more convenient than "-s": you
95 95 can specify any changeset in the source branch, and rebase will select the
96 96 whole branch. If you specify neither "-s" nor "-b", rebase uses the parent
97 97 of the working directory as the base.
98 98
99 99 By default, rebase recreates the changesets in the source branch as
100 100 descendants of dest and then destroys the originals. Use "--keep" to
101 101 preserve the original source changesets. Some changesets in the source
102 102 branch (e.g. merges from the destination branch) may be dropped if they no
103 103 longer contribute any change.
104 104
105 105 One result of the rules for selecting the destination changeset and source
106 106 branch is that, unlike "merge", rebase will do nothing if you are at the
107 107 latest (tipmost) head of a named branch with two heads. You need to
108 108 explicitly specify source and/or destination (or "update" to the other
109 109 head, if it's the head of the intended source branch).
110 110
111 111 If a rebase is interrupted to manually resolve a merge, it can be
112 112 continued with --continue/-c or aborted with --abort/-a.
113 113
114 114 options:
115 115
116 116 -s --source rebase from the specified changeset
117 117 -b --base rebase from the base of the specified changeset (up to
118 118 greatest common ancestor of base and dest)
119 119 -d --dest rebase onto the specified changeset
120 120 --collapse collapse the rebased changesets
121 121 --keep keep original changesets
122 122 --keepbranches keep original branch names
123 123 --detach force detaching of source from its original branch
124 124 -c --continue continue an interrupted rebase
125 125 -a --abort abort an interrupted rebase
126 126 --style display using template map file
127 127 --template display with template
128 128
129 129 use "hg -v help rebase" to show global options
130 130
131 131 % Use continue/abort and dest/source
132 132 hg rebase: abort and continue do not allow specifying revisions
133 133 hg rebase [-s REV | -b REV] [-d REV] [options]
134 134 hg rebase {-a|-c}
135 135
136 136 move changeset (and descendants) to a different branch
137 137
138 138 Rebase uses repeated merging to graft changesets from one part of history
139 139 (the source) onto another (the destination). This can be useful for
140 140 linearizing *local* changes relative to a master development tree.
141 141
142 142 You should not rebase changesets that have already been shared with
143 143 others. Doing so will force everybody else to perform the same rebase or
144 144 they will end up with duplicated changesets after pulling in your rebased
145 145 changesets.
146 146
147 147 If you don't specify a destination changeset ("-d/--dest"), rebase uses
148 148 the tipmost head of the current named branch as the destination. (The
149 149 destination changeset is not modified by rebasing, but new changesets are
150 150 added as its descendants.)
151 151
152 152 You can specify which changesets to rebase in two ways: as a "source"
153 153 changeset or as a "base" changeset. Both are shorthand for a topologically
154 154 related set of changesets (the "source branch"). If you specify source
155 155 ("-s/--source"), rebase will rebase that changeset and all of its
156 156 descendants onto dest. If you specify base ("-b/--base"), rebase will
157 157 select ancestors of base back to but not including the common ancestor
158 158 with dest. Thus, "-b" is less precise but more convenient than "-s": you
159 159 can specify any changeset in the source branch, and rebase will select the
160 160 whole branch. If you specify neither "-s" nor "-b", rebase uses the parent
161 161 of the working directory as the base.
162 162
163 163 By default, rebase recreates the changesets in the source branch as
164 164 descendants of dest and then destroys the originals. Use "--keep" to
165 165 preserve the original source changesets. Some changesets in the source
166 166 branch (e.g. merges from the destination branch) may be dropped if they no
167 167 longer contribute any change.
168 168
169 169 One result of the rules for selecting the destination changeset and source
170 170 branch is that, unlike "merge", rebase will do nothing if you are at the
171 171 latest (tipmost) head of a named branch with two heads. You need to
172 172 explicitly specify source and/or destination (or "update" to the other
173 173 head, if it's the head of the intended source branch).
174 174
175 175 If a rebase is interrupted to manually resolve a merge, it can be
176 176 continued with --continue/-c or aborted with --abort/-a.
177 177
178 178 options:
179 179
180 180 -s --source rebase from the specified changeset
181 181 -b --base rebase from the base of the specified changeset (up to
182 182 greatest common ancestor of base and dest)
183 183 -d --dest rebase onto the specified changeset
184 184 --collapse collapse the rebased changesets
185 185 --keep keep original changesets
186 186 --keepbranches keep original branch names
187 187 --detach force detaching of source from its original branch
188 188 -c --continue continue an interrupted rebase
189 189 -a --abort abort an interrupted rebase
190 190 --style display using template map file
191 191 --template display with template
192 192
193 193 use "hg -v help rebase" to show global options
194 194
195 195 % Use source and base
196 196 hg rebase: cannot specify both a revision and a base
197 197 hg rebase [-s REV | -b REV] [-d REV] [options]
198 198 hg rebase {-a|-c}
199 199
200 200 move changeset (and descendants) to a different branch
201 201
202 202 Rebase uses repeated merging to graft changesets from one part of history
203 203 (the source) onto another (the destination). This can be useful for
204 204 linearizing *local* changes relative to a master development tree.
205 205
206 206 You should not rebase changesets that have already been shared with
207 207 others. Doing so will force everybody else to perform the same rebase or
208 208 they will end up with duplicated changesets after pulling in your rebased
209 209 changesets.
210 210
211 211 If you don't specify a destination changeset ("-d/--dest"), rebase uses
212 212 the tipmost head of the current named branch as the destination. (The
213 213 destination changeset is not modified by rebasing, but new changesets are
214 214 added as its descendants.)
215 215
216 216 You can specify which changesets to rebase in two ways: as a "source"
217 217 changeset or as a "base" changeset. Both are shorthand for a topologically
218 218 related set of changesets (the "source branch"). If you specify source
219 219 ("-s/--source"), rebase will rebase that changeset and all of its
220 220 descendants onto dest. If you specify base ("-b/--base"), rebase will
221 221 select ancestors of base back to but not including the common ancestor
222 222 with dest. Thus, "-b" is less precise but more convenient than "-s": you
223 223 can specify any changeset in the source branch, and rebase will select the
224 224 whole branch. If you specify neither "-s" nor "-b", rebase uses the parent
225 225 of the working directory as the base.
226 226
227 227 By default, rebase recreates the changesets in the source branch as
228 228 descendants of dest and then destroys the originals. Use "--keep" to
229 229 preserve the original source changesets. Some changesets in the source
230 230 branch (e.g. merges from the destination branch) may be dropped if they no
231 231 longer contribute any change.
232 232
233 233 One result of the rules for selecting the destination changeset and source
234 234 branch is that, unlike "merge", rebase will do nothing if you are at the
235 235 latest (tipmost) head of a named branch with two heads. You need to
236 236 explicitly specify source and/or destination (or "update" to the other
237 237 head, if it's the head of the intended source branch).
238 238
239 239 If a rebase is interrupted to manually resolve a merge, it can be
240 240 continued with --continue/-c or aborted with --abort/-a.
241 241
242 242 options:
243 243
244 244 -s --source rebase from the specified changeset
245 245 -b --base rebase from the base of the specified changeset (up to
246 246 greatest common ancestor of base and dest)
247 247 -d --dest rebase onto the specified changeset
248 248 --collapse collapse the rebased changesets
249 249 --keep keep original changesets
250 250 --keepbranches keep original branch names
251 251 --detach force detaching of source from its original branch
252 252 -c --continue continue an interrupted rebase
253 253 -a --abort abort an interrupted rebase
254 254 --style display using template map file
255 255 --template display with template
256 256
257 257 use "hg -v help rebase" to show global options
258 258
259 259 % Rebase with no arguments - from current
260 260 nothing to rebase
261 261
262 262 % Rebase with no arguments - from the current branch
263 263 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
264 264 nothing to rebase
265 265 % ----------
266 266 % These work
267 267
268 268 % Rebase with no arguments (from 3 onto 7)
269 269 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
270 270 saved backup bundle to
271 adding branch
272 adding changesets
273 adding manifests
274 adding file changes
275 added 5 changesets with 5 changes to 5 files
276 271 rebase completed
277 272 % Try to rollback after a rebase (fail)
278 273 no rollback information available
279 274
280 275 % Rebase with base == '.' => same as no arguments (from 3 onto 7)
281 276 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
282 277 saved backup bundle to
283 adding branch
284 adding changesets
285 adding manifests
286 adding file changes
287 added 5 changesets with 5 changes to 5 files
288 278 rebase completed
289 279
290 280 % Rebase with dest == default => same as no arguments (from 3 onto 7)
291 281 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
292 282 saved backup bundle to
293 adding branch
294 adding changesets
295 adding manifests
296 adding file changes
297 added 5 changesets with 5 changes to 5 files
298 283 rebase completed
299 284
300 285 % Specify only source (from 4 onto 7)
301 286 saved backup bundle to
302 adding branch
303 adding changesets
304 adding manifests
305 adding file changes
306 added 4 changesets with 4 changes to 4 files (-1 heads)
307 287 rebase completed
308 288
309 289 % Specify only dest (from 3 onto 6)
310 290 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
311 291 saved backup bundle to
312 adding branch
313 adding changesets
314 adding manifests
315 adding file changes
316 added 5 changesets with 5 changes to 5 files (+1 heads)
317 292 rebase completed
318 293
319 294 % Specify only base (from 3 onto 7)
320 295 saved backup bundle to
321 adding branch
322 adding changesets
323 adding manifests
324 adding file changes
325 added 5 changesets with 5 changes to 5 files
326 296 rebase completed
327 297
328 298 % Specify source and dest (from 4 onto 6)
329 299 saved backup bundle to
330 adding branch
331 adding changesets
332 adding manifests
333 adding file changes
334 added 4 changesets with 4 changes to 4 files
335 300 rebase completed
336 301
337 302 % Specify base and dest (from 3 onto 6)
338 303 saved backup bundle to
339 adding branch
340 adding changesets
341 adding manifests
342 adding file changes
343 added 5 changesets with 5 changes to 5 files (+1 heads)
344 304 rebase completed
@@ -1,57 +1,52 b''
1 1 updating to branch default
2 2 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
3 3 updating to branch default
4 4 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 5
6 6 % Now b has one revision to be pulled from a
7 7 pulling from
8 8 searching for changes
9 9 adding changesets
10 10 adding manifests
11 11 adding file changes
12 12 added 1 changesets with 1 changes to 1 files (+1 heads)
13 13 saved backup bundle to
14 adding branch
15 adding changesets
16 adding manifests
17 adding file changes
18 added 2 changesets with 2 changes to 2 files
19 14 rebase completed
20 15 @ 3:L1
21 16 |
22 17 o 2:R1
23 18 |
24 19 o 1:C2
25 20 |
26 21 o 0:C1
27 22
28 23
29 24 % Re-run pull --rebase
30 25 pulling from
31 26 searching for changes
32 27 no changes found
33 28
34 29 % Invoke pull --rebase and nothing to rebase
35 30 pulling from
36 31 searching for changes
37 32 adding changesets
38 33 adding manifests
39 34 adding file changes
40 35 added 1 changesets with 1 changes to 1 files
41 36 nothing to rebase
42 37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 38 @ 2
44 39 |
45 40
46 41 % pull --rebase --update should ignore --update
47 42 pulling from
48 43 searching for changes
49 44 no changes found
50 45
51 46 % pull --rebase doesn't update if nothing has been pulled
52 47 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
53 48 pulling from
54 49 searching for changes
55 50 no changes found
56 51 o 2
57 52 |
@@ -1,144 +1,114 b''
1 1 @ 5: F
2 2 |
3 3 | o 4: E
4 4 |/|
5 5 o | 3: D
6 6 | |
7 7 | o 2: C
8 8 |/
9 9 | o 1: B
10 10 |/
11 11 o 0: A
12 12
13 13 % Rebasing
14 14 % B onto F - simple rebase
15 15 saved backup bundle to
16 adding branch
17 adding changesets
18 adding manifests
19 adding file changes
20 added 5 changesets with 4 changes to 4 files (+1 heads)
21 16 rebase completed
22 17 @ 5: B
23 18 |
24 19 o 4: F
25 20 |
26 21 | o 3: E
27 22 |/|
28 23 o | 2: D
29 24 | |
30 25 | o 1: C
31 26 |/
32 27 o 0: A
33 28
34 29 % B onto D - intermediate point
35 30 saved backup bundle to
36 adding branch
37 adding changesets
38 adding manifests
39 adding file changes
40 added 5 changesets with 4 changes to 4 files (+2 heads)
41 31 rebase completed
42 32 @ 5: B
43 33 |
44 34 | o 4: F
45 35 |/
46 36 | o 3: E
47 37 |/|
48 38 o | 2: D
49 39 | |
50 40 | o 1: C
51 41 |/
52 42 o 0: A
53 43
54 44 % C onto F - skip of E
55 45 saved backup bundle to
56 adding branch
57 adding changesets
58 adding manifests
59 adding file changes
60 added 3 changesets with 3 changes to 3 files (+1 heads)
61 46 rebase completed
62 47 @ 4: C
63 48 |
64 49 o 3: F
65 50 |
66 51 o 2: D
67 52 |
68 53 | o 1: B
69 54 |/
70 55 o 0: A
71 56
72 57 % D onto C - rebase of a branching point (skip E)
73 58 saved backup bundle to
74 adding branch
75 adding changesets
76 adding manifests
77 adding file changes
78 added 2 changesets with 2 changes to 2 files
79 59 rebase completed
80 60 @ 4: F
81 61 |
82 62 o 3: D
83 63 |
84 64 o 2: C
85 65 |
86 66 | o 1: B
87 67 |/
88 68 o 0: A
89 69
90 70 % E onto F - merged revision having a parent in ancestors of target
91 71 saved backup bundle to
92 adding branch
93 adding changesets
94 adding manifests
95 adding file changes
96 added 2 changesets with 1 changes to 1 files (-1 heads)
97 72 rebase completed
98 73 @ 5: E
99 74 |\
100 75 | o 4: F
101 76 | |
102 77 | o 3: D
103 78 | |
104 79 o | 2: C
105 80 |/
106 81 | o 1: B
107 82 |/
108 83 o 0: A
109 84
110 85 % D onto B - E maintains C as parent
111 86 saved backup bundle to
112 adding branch
113 adding changesets
114 adding manifests
115 adding file changes
116 added 3 changesets with 2 changes to 2 files
117 87 rebase completed
118 88 @ 5: F
119 89 |
120 90 | o 4: E
121 91 |/|
122 92 o | 3: D
123 93 | |
124 94 | o 2: C
125 95 | |
126 96 o | 1: B
127 97 |/
128 98 o 0: A
129 99
130 100 % These will fail (using --source)
131 101 % E onto D - rebase onto an ancestor
132 102 abort: source is descendant of destination
133 103 % D onto E - rebase onto a descendant
134 104 abort: source is ancestor of destination
135 105 % E onto B - merge revision with both parents not in ancestors of target
136 106 abort: cannot use revision 4 as base, result would have 3 parents
137 107
138 108 % These will abort gracefully (using --base)
139 109 % E onto E - rebase onto same changeset
140 110 nothing to rebase
141 111 % E onto D - rebase onto an ancestor
142 112 nothing to rebase
143 113 % D onto E - rebase onto a descendant
144 114 nothing to rebase
@@ -1,114 +1,94 b''
1 1 crossed/.hg/store/00manifest.i
2 2 rev offset length base linkrev nodeid p1 p2
3 3 0 0 112 0 0 6f105cbb914d 000000000000 000000000000
4 4 1 112 56 1 3 1b55917b3699 000000000000 000000000000
5 5 2 168 123 1 1 8f3d04e263e5 000000000000 000000000000
6 6 3 291 122 1 2 f0ef8726ac4f 000000000000 000000000000
7 7 4 413 87 4 4 0b76e38b4070 000000000000 000000000000
8 8
9 9 crossed/.hg/store/data/012.i
10 10 rev offset length base linkrev nodeid p1 p2
11 11 0 0 3 0 0 b8e02f643373 000000000000 000000000000
12 12 1 3 3 1 1 5d9299349fc0 000000000000 000000000000
13 13 2 6 3 2 2 2661d26c6496 000000000000 000000000000
14 14
15 15 crossed/.hg/store/data/021.i
16 16 rev offset length base linkrev nodeid p1 p2
17 17 0 0 3 0 0 b8e02f643373 000000000000 000000000000
18 18 1 3 3 1 2 5d9299349fc0 000000000000 000000000000
19 19 2 6 3 2 1 2661d26c6496 000000000000 000000000000
20 20
21 21 crossed/.hg/store/data/102.i
22 22 rev offset length base linkrev nodeid p1 p2
23 23 0 0 3 0 1 b8e02f643373 000000000000 000000000000
24 24 1 3 3 1 0 5d9299349fc0 000000000000 000000000000
25 25 2 6 3 2 2 2661d26c6496 000000000000 000000000000
26 26
27 27 crossed/.hg/store/data/120.i
28 28 rev offset length base linkrev nodeid p1 p2
29 29 0 0 3 0 1 b8e02f643373 000000000000 000000000000
30 30 1 3 3 1 2 5d9299349fc0 000000000000 000000000000
31 31 2 6 3 2 0 2661d26c6496 000000000000 000000000000
32 32
33 33 crossed/.hg/store/data/201.i
34 34 rev offset length base linkrev nodeid p1 p2
35 35 0 0 3 0 2 b8e02f643373 000000000000 000000000000
36 36 1 3 3 1 0 5d9299349fc0 000000000000 000000000000
37 37 2 6 3 2 1 2661d26c6496 000000000000 000000000000
38 38
39 39 crossed/.hg/store/data/210.i
40 40 rev offset length base linkrev nodeid p1 p2
41 41 0 0 3 0 2 b8e02f643373 000000000000 000000000000
42 42 1 3 3 1 1 5d9299349fc0 000000000000 000000000000
43 43 2 6 3 2 0 2661d26c6496 000000000000 000000000000
44 44
45 45 crossed/.hg/store/data/manifest-file.i
46 46 rev offset length base linkrev nodeid p1 p2
47 47 0 0 3 0 3 b8e02f643373 000000000000 000000000000
48 48 1 3 3 1 4 5d9299349fc0 000000000000 000000000000
49 49
50 50 % Trying to strip revision 0
51 51 saved backup bundle to
52 adding branch
53 adding changesets
54 adding manifests
55 adding file changes
56 added 4 changesets with 15 changes to 7 files (+3 heads)
57 52 % Verifying
58 53 checking changesets
59 54 checking manifests
60 55 crosschecking files in changesets and manifests
61 56 checking files
62 57 7 files, 4 changesets, 15 total revisions
63 58
64 59 % Trying to strip revision 1
65 60 saved backup bundle to
66 adding branch
67 adding changesets
68 adding manifests
69 adding file changes
70 added 3 changesets with 12 changes to 7 files (+3 heads)
71 61 % Verifying
72 62 checking changesets
73 63 checking manifests
74 64 crosschecking files in changesets and manifests
75 65 checking files
76 66 7 files, 4 changesets, 14 total revisions
77 67
78 68 % Trying to strip revision 2
79 69 saved backup bundle to
80 adding branch
81 adding changesets
82 adding manifests
83 adding file changes
84 added 2 changesets with 8 changes to 6 files (+2 heads)
85 70 % Verifying
86 71 checking changesets
87 72 checking manifests
88 73 crosschecking files in changesets and manifests
89 74 checking files
90 75 7 files, 4 changesets, 14 total revisions
91 76
92 77 % Trying to strip revision 3
93 78 saved backup bundle to
94 adding branch
95 adding changesets
96 adding manifests
97 adding file changes
98 added 1 changesets with 1 changes to 2 files (+1 heads)
99 79 % Verifying
100 80 checking changesets
101 81 checking manifests
102 82 crosschecking files in changesets and manifests
103 83 checking files
104 84 7 files, 4 changesets, 19 total revisions
105 85
106 86 % Trying to strip revision 4
107 87 saved backup bundle to
108 88 % Verifying
109 89 checking changesets
110 90 checking manifests
111 91 crosschecking files in changesets and manifests
112 92 checking files
113 93 7 files, 4 changesets, 19 total revisions
114 94
General Comments 0
You need to be logged in to leave comments. Login now