##// END OF EJS Templates
rebase: clarify that commits that become empty are skipped...
Martin von Zweigbergk -
r40900:4edd427f default
parent child Browse files
Show More
@@ -1,1952 +1,1952 b''
1 # rebase.py - rebasing feature for mercurial
1 # rebase.py - rebasing feature for mercurial
2 #
2 #
3 # Copyright 2008 Stefano Tortarolo <stefano.tortarolo at gmail dot com>
3 # Copyright 2008 Stefano Tortarolo <stefano.tortarolo at gmail dot com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 '''command to move sets of revisions to a different ancestor
8 '''command to move sets of revisions to a different ancestor
9
9
10 This extension lets you rebase changesets in an existing Mercurial
10 This extension lets you rebase changesets in an existing Mercurial
11 repository.
11 repository.
12
12
13 For more information:
13 For more information:
14 https://mercurial-scm.org/wiki/RebaseExtension
14 https://mercurial-scm.org/wiki/RebaseExtension
15 '''
15 '''
16
16
17 from __future__ import absolute_import
17 from __future__ import absolute_import
18
18
19 import errno
19 import errno
20 import os
20 import os
21
21
22 from mercurial.i18n import _
22 from mercurial.i18n import _
23 from mercurial.node import (
23 from mercurial.node import (
24 nullrev,
24 nullrev,
25 short,
25 short,
26 )
26 )
27 from mercurial import (
27 from mercurial import (
28 bookmarks,
28 bookmarks,
29 cmdutil,
29 cmdutil,
30 commands,
30 commands,
31 copies,
31 copies,
32 destutil,
32 destutil,
33 dirstateguard,
33 dirstateguard,
34 error,
34 error,
35 extensions,
35 extensions,
36 hg,
36 hg,
37 merge as mergemod,
37 merge as mergemod,
38 mergeutil,
38 mergeutil,
39 obsolete,
39 obsolete,
40 obsutil,
40 obsutil,
41 patch,
41 patch,
42 phases,
42 phases,
43 pycompat,
43 pycompat,
44 registrar,
44 registrar,
45 repair,
45 repair,
46 revset,
46 revset,
47 revsetlang,
47 revsetlang,
48 scmutil,
48 scmutil,
49 smartset,
49 smartset,
50 state as statemod,
50 state as statemod,
51 util,
51 util,
52 )
52 )
53
53
54 # The following constants are used throughout the rebase module. The ordering of
54 # The following constants are used throughout the rebase module. The ordering of
55 # their values must be maintained.
55 # their values must be maintained.
56
56
57 # Indicates that a revision needs to be rebased
57 # Indicates that a revision needs to be rebased
58 revtodo = -1
58 revtodo = -1
59 revtodostr = '-1'
59 revtodostr = '-1'
60
60
61 # legacy revstates no longer needed in current code
61 # legacy revstates no longer needed in current code
62 # -2: nullmerge, -3: revignored, -4: revprecursor, -5: revpruned
62 # -2: nullmerge, -3: revignored, -4: revprecursor, -5: revpruned
63 legacystates = {'-2', '-3', '-4', '-5'}
63 legacystates = {'-2', '-3', '-4', '-5'}
64
64
65 cmdtable = {}
65 cmdtable = {}
66 command = registrar.command(cmdtable)
66 command = registrar.command(cmdtable)
67 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
67 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
68 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
68 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
69 # be specifying the version(s) of Mercurial they are tested with, or
69 # be specifying the version(s) of Mercurial they are tested with, or
70 # leave the attribute unspecified.
70 # leave the attribute unspecified.
71 testedwith = 'ships-with-hg-core'
71 testedwith = 'ships-with-hg-core'
72
72
73 def _nothingtorebase():
73 def _nothingtorebase():
74 return 1
74 return 1
75
75
76 def _savegraft(ctx, extra):
76 def _savegraft(ctx, extra):
77 s = ctx.extra().get('source', None)
77 s = ctx.extra().get('source', None)
78 if s is not None:
78 if s is not None:
79 extra['source'] = s
79 extra['source'] = s
80 s = ctx.extra().get('intermediate-source', None)
80 s = ctx.extra().get('intermediate-source', None)
81 if s is not None:
81 if s is not None:
82 extra['intermediate-source'] = s
82 extra['intermediate-source'] = s
83
83
84 def _savebranch(ctx, extra):
84 def _savebranch(ctx, extra):
85 extra['branch'] = ctx.branch()
85 extra['branch'] = ctx.branch()
86
86
87 def _destrebase(repo, sourceset, destspace=None):
87 def _destrebase(repo, sourceset, destspace=None):
88 """small wrapper around destmerge to pass the right extra args
88 """small wrapper around destmerge to pass the right extra args
89
89
90 Please wrap destutil.destmerge instead."""
90 Please wrap destutil.destmerge instead."""
91 return destutil.destmerge(repo, action='rebase', sourceset=sourceset,
91 return destutil.destmerge(repo, action='rebase', sourceset=sourceset,
92 onheadcheck=False, destspace=destspace)
92 onheadcheck=False, destspace=destspace)
93
93
94 revsetpredicate = registrar.revsetpredicate()
94 revsetpredicate = registrar.revsetpredicate()
95
95
96 @revsetpredicate('_destrebase')
96 @revsetpredicate('_destrebase')
97 def _revsetdestrebase(repo, subset, x):
97 def _revsetdestrebase(repo, subset, x):
98 # ``_rebasedefaultdest()``
98 # ``_rebasedefaultdest()``
99
99
100 # default destination for rebase.
100 # default destination for rebase.
101 # # XXX: Currently private because I expect the signature to change.
101 # # XXX: Currently private because I expect the signature to change.
102 # # XXX: - bailing out in case of ambiguity vs returning all data.
102 # # XXX: - bailing out in case of ambiguity vs returning all data.
103 # i18n: "_rebasedefaultdest" is a keyword
103 # i18n: "_rebasedefaultdest" is a keyword
104 sourceset = None
104 sourceset = None
105 if x is not None:
105 if x is not None:
106 sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
106 sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
107 return subset & smartset.baseset([_destrebase(repo, sourceset)])
107 return subset & smartset.baseset([_destrebase(repo, sourceset)])
108
108
109 @revsetpredicate('_destautoorphanrebase')
109 @revsetpredicate('_destautoorphanrebase')
110 def _revsetdestautoorphanrebase(repo, subset, x):
110 def _revsetdestautoorphanrebase(repo, subset, x):
111 """automatic rebase destination for a single orphan revision"""
111 """automatic rebase destination for a single orphan revision"""
112 unfi = repo.unfiltered()
112 unfi = repo.unfiltered()
113 obsoleted = unfi.revs('obsolete()')
113 obsoleted = unfi.revs('obsolete()')
114
114
115 src = revset.getset(repo, subset, x).first()
115 src = revset.getset(repo, subset, x).first()
116
116
117 # Empty src or already obsoleted - Do not return a destination
117 # Empty src or already obsoleted - Do not return a destination
118 if not src or src in obsoleted:
118 if not src or src in obsoleted:
119 return smartset.baseset()
119 return smartset.baseset()
120 dests = destutil.orphanpossibledestination(repo, src)
120 dests = destutil.orphanpossibledestination(repo, src)
121 if len(dests) > 1:
121 if len(dests) > 1:
122 raise error.Abort(
122 raise error.Abort(
123 _("ambiguous automatic rebase: %r could end up on any of %r") % (
123 _("ambiguous automatic rebase: %r could end up on any of %r") % (
124 src, dests))
124 src, dests))
125 # We have zero or one destination, so we can just return here.
125 # We have zero or one destination, so we can just return here.
126 return smartset.baseset(dests)
126 return smartset.baseset(dests)
127
127
128 def _ctxdesc(ctx):
128 def _ctxdesc(ctx):
129 """short description for a context"""
129 """short description for a context"""
130 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
130 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
131 ctx.description().split('\n', 1)[0])
131 ctx.description().split('\n', 1)[0])
132 repo = ctx.repo()
132 repo = ctx.repo()
133 names = []
133 names = []
134 for nsname, ns in repo.names.iteritems():
134 for nsname, ns in repo.names.iteritems():
135 if nsname == 'branches':
135 if nsname == 'branches':
136 continue
136 continue
137 names.extend(ns.names(repo, ctx.node()))
137 names.extend(ns.names(repo, ctx.node()))
138 if names:
138 if names:
139 desc += ' (%s)' % ' '.join(names)
139 desc += ' (%s)' % ' '.join(names)
140 return desc
140 return desc
141
141
142 class rebaseruntime(object):
142 class rebaseruntime(object):
143 """This class is a container for rebase runtime state"""
143 """This class is a container for rebase runtime state"""
144 def __init__(self, repo, ui, inmemory=False, opts=None):
144 def __init__(self, repo, ui, inmemory=False, opts=None):
145 if opts is None:
145 if opts is None:
146 opts = {}
146 opts = {}
147
147
148 # prepared: whether we have rebasestate prepared or not. Currently it
148 # prepared: whether we have rebasestate prepared or not. Currently it
149 # decides whether "self.repo" is unfiltered or not.
149 # decides whether "self.repo" is unfiltered or not.
150 # The rebasestate has explicit hash to hash instructions not depending
150 # The rebasestate has explicit hash to hash instructions not depending
151 # on visibility. If rebasestate exists (in-memory or on-disk), use
151 # on visibility. If rebasestate exists (in-memory or on-disk), use
152 # unfiltered repo to avoid visibility issues.
152 # unfiltered repo to avoid visibility issues.
153 # Before knowing rebasestate (i.e. when starting a new rebase (not
153 # Before knowing rebasestate (i.e. when starting a new rebase (not
154 # --continue or --abort)), the original repo should be used so
154 # --continue or --abort)), the original repo should be used so
155 # visibility-dependent revsets are correct.
155 # visibility-dependent revsets are correct.
156 self.prepared = False
156 self.prepared = False
157 self._repo = repo
157 self._repo = repo
158
158
159 self.ui = ui
159 self.ui = ui
160 self.opts = opts
160 self.opts = opts
161 self.originalwd = None
161 self.originalwd = None
162 self.external = nullrev
162 self.external = nullrev
163 # Mapping between the old revision id and either what is the new rebased
163 # Mapping between the old revision id and either what is the new rebased
164 # revision or what needs to be done with the old revision. The state
164 # revision or what needs to be done with the old revision. The state
165 # dict will be what contains most of the rebase progress state.
165 # dict will be what contains most of the rebase progress state.
166 self.state = {}
166 self.state = {}
167 self.activebookmark = None
167 self.activebookmark = None
168 self.destmap = {}
168 self.destmap = {}
169 self.skipped = set()
169 self.skipped = set()
170
170
171 self.collapsef = opts.get('collapse', False)
171 self.collapsef = opts.get('collapse', False)
172 self.collapsemsg = cmdutil.logmessage(ui, opts)
172 self.collapsemsg = cmdutil.logmessage(ui, opts)
173 self.date = opts.get('date', None)
173 self.date = opts.get('date', None)
174
174
175 e = opts.get('extrafn') # internal, used by e.g. hgsubversion
175 e = opts.get('extrafn') # internal, used by e.g. hgsubversion
176 self.extrafns = [_savegraft]
176 self.extrafns = [_savegraft]
177 if e:
177 if e:
178 self.extrafns = [e]
178 self.extrafns = [e]
179
179
180 self.backupf = ui.configbool('ui', 'history-editing-backup')
180 self.backupf = ui.configbool('ui', 'history-editing-backup')
181 self.keepf = opts.get('keep', False)
181 self.keepf = opts.get('keep', False)
182 self.keepbranchesf = opts.get('keepbranches', False)
182 self.keepbranchesf = opts.get('keepbranches', False)
183 self.obsoletenotrebased = {}
183 self.obsoletenotrebased = {}
184 self.obsoletewithoutsuccessorindestination = set()
184 self.obsoletewithoutsuccessorindestination = set()
185 self.inmemory = inmemory
185 self.inmemory = inmemory
186 self.stateobj = statemod.cmdstate(repo, 'rebasestate')
186 self.stateobj = statemod.cmdstate(repo, 'rebasestate')
187
187
188 @property
188 @property
189 def repo(self):
189 def repo(self):
190 if self.prepared:
190 if self.prepared:
191 return self._repo.unfiltered()
191 return self._repo.unfiltered()
192 else:
192 else:
193 return self._repo
193 return self._repo
194
194
195 def storestatus(self, tr=None):
195 def storestatus(self, tr=None):
196 """Store the current status to allow recovery"""
196 """Store the current status to allow recovery"""
197 if tr:
197 if tr:
198 tr.addfilegenerator('rebasestate', ('rebasestate',),
198 tr.addfilegenerator('rebasestate', ('rebasestate',),
199 self._writestatus, location='plain')
199 self._writestatus, location='plain')
200 else:
200 else:
201 with self.repo.vfs("rebasestate", "w") as f:
201 with self.repo.vfs("rebasestate", "w") as f:
202 self._writestatus(f)
202 self._writestatus(f)
203
203
204 def _writestatus(self, f):
204 def _writestatus(self, f):
205 repo = self.repo
205 repo = self.repo
206 assert repo.filtername is None
206 assert repo.filtername is None
207 f.write(repo[self.originalwd].hex() + '\n')
207 f.write(repo[self.originalwd].hex() + '\n')
208 # was "dest". we now write dest per src root below.
208 # was "dest". we now write dest per src root below.
209 f.write('\n')
209 f.write('\n')
210 f.write(repo[self.external].hex() + '\n')
210 f.write(repo[self.external].hex() + '\n')
211 f.write('%d\n' % int(self.collapsef))
211 f.write('%d\n' % int(self.collapsef))
212 f.write('%d\n' % int(self.keepf))
212 f.write('%d\n' % int(self.keepf))
213 f.write('%d\n' % int(self.keepbranchesf))
213 f.write('%d\n' % int(self.keepbranchesf))
214 f.write('%s\n' % (self.activebookmark or ''))
214 f.write('%s\n' % (self.activebookmark or ''))
215 destmap = self.destmap
215 destmap = self.destmap
216 for d, v in self.state.iteritems():
216 for d, v in self.state.iteritems():
217 oldrev = repo[d].hex()
217 oldrev = repo[d].hex()
218 if v >= 0:
218 if v >= 0:
219 newrev = repo[v].hex()
219 newrev = repo[v].hex()
220 else:
220 else:
221 newrev = "%d" % v
221 newrev = "%d" % v
222 destnode = repo[destmap[d]].hex()
222 destnode = repo[destmap[d]].hex()
223 f.write("%s:%s:%s\n" % (oldrev, newrev, destnode))
223 f.write("%s:%s:%s\n" % (oldrev, newrev, destnode))
224 repo.ui.debug('rebase status stored\n')
224 repo.ui.debug('rebase status stored\n')
225
225
226 def restorestatus(self):
226 def restorestatus(self):
227 """Restore a previously stored status"""
227 """Restore a previously stored status"""
228 if not self.stateobj.exists():
228 if not self.stateobj.exists():
229 cmdutil.wrongtooltocontinue(self.repo, _('rebase'))
229 cmdutil.wrongtooltocontinue(self.repo, _('rebase'))
230
230
231 data = self._read()
231 data = self._read()
232 self.repo.ui.debug('rebase status resumed\n')
232 self.repo.ui.debug('rebase status resumed\n')
233
233
234 self.originalwd = data['originalwd']
234 self.originalwd = data['originalwd']
235 self.destmap = data['destmap']
235 self.destmap = data['destmap']
236 self.state = data['state']
236 self.state = data['state']
237 self.skipped = data['skipped']
237 self.skipped = data['skipped']
238 self.collapsef = data['collapse']
238 self.collapsef = data['collapse']
239 self.keepf = data['keep']
239 self.keepf = data['keep']
240 self.keepbranchesf = data['keepbranches']
240 self.keepbranchesf = data['keepbranches']
241 self.external = data['external']
241 self.external = data['external']
242 self.activebookmark = data['activebookmark']
242 self.activebookmark = data['activebookmark']
243
243
244 def _read(self):
244 def _read(self):
245 self.prepared = True
245 self.prepared = True
246 repo = self.repo
246 repo = self.repo
247 assert repo.filtername is None
247 assert repo.filtername is None
248 data = {'keepbranches': None, 'collapse': None, 'activebookmark': None,
248 data = {'keepbranches': None, 'collapse': None, 'activebookmark': None,
249 'external': nullrev, 'keep': None, 'originalwd': None}
249 'external': nullrev, 'keep': None, 'originalwd': None}
250 legacydest = None
250 legacydest = None
251 state = {}
251 state = {}
252 destmap = {}
252 destmap = {}
253
253
254 if True:
254 if True:
255 f = repo.vfs("rebasestate")
255 f = repo.vfs("rebasestate")
256 for i, l in enumerate(f.read().splitlines()):
256 for i, l in enumerate(f.read().splitlines()):
257 if i == 0:
257 if i == 0:
258 data['originalwd'] = repo[l].rev()
258 data['originalwd'] = repo[l].rev()
259 elif i == 1:
259 elif i == 1:
260 # this line should be empty in newer version. but legacy
260 # this line should be empty in newer version. but legacy
261 # clients may still use it
261 # clients may still use it
262 if l:
262 if l:
263 legacydest = repo[l].rev()
263 legacydest = repo[l].rev()
264 elif i == 2:
264 elif i == 2:
265 data['external'] = repo[l].rev()
265 data['external'] = repo[l].rev()
266 elif i == 3:
266 elif i == 3:
267 data['collapse'] = bool(int(l))
267 data['collapse'] = bool(int(l))
268 elif i == 4:
268 elif i == 4:
269 data['keep'] = bool(int(l))
269 data['keep'] = bool(int(l))
270 elif i == 5:
270 elif i == 5:
271 data['keepbranches'] = bool(int(l))
271 data['keepbranches'] = bool(int(l))
272 elif i == 6 and not (len(l) == 81 and ':' in l):
272 elif i == 6 and not (len(l) == 81 and ':' in l):
273 # line 6 is a recent addition, so for backwards
273 # line 6 is a recent addition, so for backwards
274 # compatibility check that the line doesn't look like the
274 # compatibility check that the line doesn't look like the
275 # oldrev:newrev lines
275 # oldrev:newrev lines
276 data['activebookmark'] = l
276 data['activebookmark'] = l
277 else:
277 else:
278 args = l.split(':')
278 args = l.split(':')
279 oldrev = repo[args[0]].rev()
279 oldrev = repo[args[0]].rev()
280 newrev = args[1]
280 newrev = args[1]
281 if newrev in legacystates:
281 if newrev in legacystates:
282 continue
282 continue
283 if len(args) > 2:
283 if len(args) > 2:
284 destrev = repo[args[2]].rev()
284 destrev = repo[args[2]].rev()
285 else:
285 else:
286 destrev = legacydest
286 destrev = legacydest
287 destmap[oldrev] = destrev
287 destmap[oldrev] = destrev
288 if newrev == revtodostr:
288 if newrev == revtodostr:
289 state[oldrev] = revtodo
289 state[oldrev] = revtodo
290 # Legacy compat special case
290 # Legacy compat special case
291 else:
291 else:
292 state[oldrev] = repo[newrev].rev()
292 state[oldrev] = repo[newrev].rev()
293
293
294 if data['keepbranches'] is None:
294 if data['keepbranches'] is None:
295 raise error.Abort(_('.hg/rebasestate is incomplete'))
295 raise error.Abort(_('.hg/rebasestate is incomplete'))
296
296
297 data['destmap'] = destmap
297 data['destmap'] = destmap
298 data['state'] = state
298 data['state'] = state
299 skipped = set()
299 skipped = set()
300 # recompute the set of skipped revs
300 # recompute the set of skipped revs
301 if not data['collapse']:
301 if not data['collapse']:
302 seen = set(destmap.values())
302 seen = set(destmap.values())
303 for old, new in sorted(state.items()):
303 for old, new in sorted(state.items()):
304 if new != revtodo and new in seen:
304 if new != revtodo and new in seen:
305 skipped.add(old)
305 skipped.add(old)
306 seen.add(new)
306 seen.add(new)
307 data['skipped'] = skipped
307 data['skipped'] = skipped
308 repo.ui.debug('computed skipped revs: %s\n' %
308 repo.ui.debug('computed skipped revs: %s\n' %
309 (' '.join('%d' % r for r in sorted(skipped)) or ''))
309 (' '.join('%d' % r for r in sorted(skipped)) or ''))
310
310
311 return data
311 return data
312
312
313 def _handleskippingobsolete(self, obsoleterevs, destmap):
313 def _handleskippingobsolete(self, obsoleterevs, destmap):
314 """Compute structures necessary for skipping obsolete revisions
314 """Compute structures necessary for skipping obsolete revisions
315
315
316 obsoleterevs: iterable of all obsolete revisions in rebaseset
316 obsoleterevs: iterable of all obsolete revisions in rebaseset
317 destmap: {srcrev: destrev} destination revisions
317 destmap: {srcrev: destrev} destination revisions
318 """
318 """
319 self.obsoletenotrebased = {}
319 self.obsoletenotrebased = {}
320 if not self.ui.configbool('experimental', 'rebaseskipobsolete'):
320 if not self.ui.configbool('experimental', 'rebaseskipobsolete'):
321 return
321 return
322 obsoleteset = set(obsoleterevs)
322 obsoleteset = set(obsoleterevs)
323 (self.obsoletenotrebased,
323 (self.obsoletenotrebased,
324 self.obsoletewithoutsuccessorindestination,
324 self.obsoletewithoutsuccessorindestination,
325 obsoleteextinctsuccessors) = _computeobsoletenotrebased(
325 obsoleteextinctsuccessors) = _computeobsoletenotrebased(
326 self.repo, obsoleteset, destmap)
326 self.repo, obsoleteset, destmap)
327 skippedset = set(self.obsoletenotrebased)
327 skippedset = set(self.obsoletenotrebased)
328 skippedset.update(self.obsoletewithoutsuccessorindestination)
328 skippedset.update(self.obsoletewithoutsuccessorindestination)
329 skippedset.update(obsoleteextinctsuccessors)
329 skippedset.update(obsoleteextinctsuccessors)
330 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
330 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
331
331
332 def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
332 def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
333 try:
333 try:
334 self.restorestatus()
334 self.restorestatus()
335 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
335 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
336 except error.RepoLookupError:
336 except error.RepoLookupError:
337 if isabort:
337 if isabort:
338 clearstatus(self.repo)
338 clearstatus(self.repo)
339 clearcollapsemsg(self.repo)
339 clearcollapsemsg(self.repo)
340 self.repo.ui.warn(_('rebase aborted (no revision is removed,'
340 self.repo.ui.warn(_('rebase aborted (no revision is removed,'
341 ' only broken state is cleared)\n'))
341 ' only broken state is cleared)\n'))
342 return 0
342 return 0
343 else:
343 else:
344 msg = _('cannot continue inconsistent rebase')
344 msg = _('cannot continue inconsistent rebase')
345 hint = _('use "hg rebase --abort" to clear broken state')
345 hint = _('use "hg rebase --abort" to clear broken state')
346 raise error.Abort(msg, hint=hint)
346 raise error.Abort(msg, hint=hint)
347
347
348 if isabort:
348 if isabort:
349 backup = backup and self.backupf
349 backup = backup and self.backupf
350 return self._abort(backup=backup, suppwarns=suppwarns)
350 return self._abort(backup=backup, suppwarns=suppwarns)
351
351
352 def _preparenewrebase(self, destmap):
352 def _preparenewrebase(self, destmap):
353 if not destmap:
353 if not destmap:
354 return _nothingtorebase()
354 return _nothingtorebase()
355
355
356 rebaseset = destmap.keys()
356 rebaseset = destmap.keys()
357 allowunstable = obsolete.isenabled(self.repo, obsolete.allowunstableopt)
357 allowunstable = obsolete.isenabled(self.repo, obsolete.allowunstableopt)
358 if (not (self.keepf or allowunstable)
358 if (not (self.keepf or allowunstable)
359 and self.repo.revs('first(children(%ld) - %ld)',
359 and self.repo.revs('first(children(%ld) - %ld)',
360 rebaseset, rebaseset)):
360 rebaseset, rebaseset)):
361 raise error.Abort(
361 raise error.Abort(
362 _("can't remove original changesets with"
362 _("can't remove original changesets with"
363 " unrebased descendants"),
363 " unrebased descendants"),
364 hint=_('use --keep to keep original changesets'))
364 hint=_('use --keep to keep original changesets'))
365
365
366 result = buildstate(self.repo, destmap, self.collapsef)
366 result = buildstate(self.repo, destmap, self.collapsef)
367
367
368 if not result:
368 if not result:
369 # Empty state built, nothing to rebase
369 # Empty state built, nothing to rebase
370 self.ui.status(_('nothing to rebase\n'))
370 self.ui.status(_('nothing to rebase\n'))
371 return _nothingtorebase()
371 return _nothingtorebase()
372
372
373 for root in self.repo.set('roots(%ld)', rebaseset):
373 for root in self.repo.set('roots(%ld)', rebaseset):
374 if not self.keepf and not root.mutable():
374 if not self.keepf and not root.mutable():
375 raise error.Abort(_("can't rebase public changeset %s")
375 raise error.Abort(_("can't rebase public changeset %s")
376 % root,
376 % root,
377 hint=_("see 'hg help phases' for details"))
377 hint=_("see 'hg help phases' for details"))
378
378
379 (self.originalwd, self.destmap, self.state) = result
379 (self.originalwd, self.destmap, self.state) = result
380 if self.collapsef:
380 if self.collapsef:
381 dests = set(self.destmap.values())
381 dests = set(self.destmap.values())
382 if len(dests) != 1:
382 if len(dests) != 1:
383 raise error.Abort(
383 raise error.Abort(
384 _('--collapse does not work with multiple destinations'))
384 _('--collapse does not work with multiple destinations'))
385 destrev = next(iter(dests))
385 destrev = next(iter(dests))
386 destancestors = self.repo.changelog.ancestors([destrev],
386 destancestors = self.repo.changelog.ancestors([destrev],
387 inclusive=True)
387 inclusive=True)
388 self.external = externalparent(self.repo, self.state, destancestors)
388 self.external = externalparent(self.repo, self.state, destancestors)
389
389
390 for destrev in sorted(set(destmap.values())):
390 for destrev in sorted(set(destmap.values())):
391 dest = self.repo[destrev]
391 dest = self.repo[destrev]
392 if dest.closesbranch() and not self.keepbranchesf:
392 if dest.closesbranch() and not self.keepbranchesf:
393 self.ui.status(_('reopening closed branch head %s\n') % dest)
393 self.ui.status(_('reopening closed branch head %s\n') % dest)
394
394
395 self.prepared = True
395 self.prepared = True
396
396
397 def _assignworkingcopy(self):
397 def _assignworkingcopy(self):
398 if self.inmemory:
398 if self.inmemory:
399 from mercurial.context import overlayworkingctx
399 from mercurial.context import overlayworkingctx
400 self.wctx = overlayworkingctx(self.repo)
400 self.wctx = overlayworkingctx(self.repo)
401 self.repo.ui.debug("rebasing in-memory\n")
401 self.repo.ui.debug("rebasing in-memory\n")
402 else:
402 else:
403 self.wctx = self.repo[None]
403 self.wctx = self.repo[None]
404 self.repo.ui.debug("rebasing on disk\n")
404 self.repo.ui.debug("rebasing on disk\n")
405 self.repo.ui.log("rebase",
405 self.repo.ui.log("rebase",
406 "using in-memory rebase: %r\n", self.inmemory,
406 "using in-memory rebase: %r\n", self.inmemory,
407 rebase_imm_used=self.inmemory)
407 rebase_imm_used=self.inmemory)
408
408
409 def _performrebase(self, tr):
409 def _performrebase(self, tr):
410 self._assignworkingcopy()
410 self._assignworkingcopy()
411 repo, ui = self.repo, self.ui
411 repo, ui = self.repo, self.ui
412 if self.keepbranchesf:
412 if self.keepbranchesf:
413 # insert _savebranch at the start of extrafns so if
413 # insert _savebranch at the start of extrafns so if
414 # there's a user-provided extrafn it can clobber branch if
414 # there's a user-provided extrafn it can clobber branch if
415 # desired
415 # desired
416 self.extrafns.insert(0, _savebranch)
416 self.extrafns.insert(0, _savebranch)
417 if self.collapsef:
417 if self.collapsef:
418 branches = set()
418 branches = set()
419 for rev in self.state:
419 for rev in self.state:
420 branches.add(repo[rev].branch())
420 branches.add(repo[rev].branch())
421 if len(branches) > 1:
421 if len(branches) > 1:
422 raise error.Abort(_('cannot collapse multiple named '
422 raise error.Abort(_('cannot collapse multiple named '
423 'branches'))
423 'branches'))
424
424
425 # Calculate self.obsoletenotrebased
425 # Calculate self.obsoletenotrebased
426 obsrevs = _filterobsoleterevs(self.repo, self.state)
426 obsrevs = _filterobsoleterevs(self.repo, self.state)
427 self._handleskippingobsolete(obsrevs, self.destmap)
427 self._handleskippingobsolete(obsrevs, self.destmap)
428
428
429 # Keep track of the active bookmarks in order to reset them later
429 # Keep track of the active bookmarks in order to reset them later
430 self.activebookmark = self.activebookmark or repo._activebookmark
430 self.activebookmark = self.activebookmark or repo._activebookmark
431 if self.activebookmark:
431 if self.activebookmark:
432 bookmarks.deactivate(repo)
432 bookmarks.deactivate(repo)
433
433
434 # Store the state before we begin so users can run 'hg rebase --abort'
434 # Store the state before we begin so users can run 'hg rebase --abort'
435 # if we fail before the transaction closes.
435 # if we fail before the transaction closes.
436 self.storestatus()
436 self.storestatus()
437 if tr:
437 if tr:
438 # When using single transaction, store state when transaction
438 # When using single transaction, store state when transaction
439 # commits.
439 # commits.
440 self.storestatus(tr)
440 self.storestatus(tr)
441
441
442 cands = [k for k, v in self.state.iteritems() if v == revtodo]
442 cands = [k for k, v in self.state.iteritems() if v == revtodo]
443 p = repo.ui.makeprogress(_("rebasing"), unit=_('changesets'),
443 p = repo.ui.makeprogress(_("rebasing"), unit=_('changesets'),
444 total=len(cands))
444 total=len(cands))
445 def progress(ctx):
445 def progress(ctx):
446 p.increment(item=("%d:%s" % (ctx.rev(), ctx)))
446 p.increment(item=("%d:%s" % (ctx.rev(), ctx)))
447 allowdivergence = self.ui.configbool(
447 allowdivergence = self.ui.configbool(
448 'experimental', 'evolution.allowdivergence')
448 'experimental', 'evolution.allowdivergence')
449 for subset in sortsource(self.destmap):
449 for subset in sortsource(self.destmap):
450 sortedrevs = self.repo.revs('sort(%ld, -topo)', subset)
450 sortedrevs = self.repo.revs('sort(%ld, -topo)', subset)
451 if not allowdivergence:
451 if not allowdivergence:
452 sortedrevs -= self.repo.revs(
452 sortedrevs -= self.repo.revs(
453 'descendants(%ld) and not %ld',
453 'descendants(%ld) and not %ld',
454 self.obsoletewithoutsuccessorindestination,
454 self.obsoletewithoutsuccessorindestination,
455 self.obsoletewithoutsuccessorindestination,
455 self.obsoletewithoutsuccessorindestination,
456 )
456 )
457 for rev in sortedrevs:
457 for rev in sortedrevs:
458 self._rebasenode(tr, rev, allowdivergence, progress)
458 self._rebasenode(tr, rev, allowdivergence, progress)
459 p.complete()
459 p.complete()
460 ui.note(_('rebase merging completed\n'))
460 ui.note(_('rebase merging completed\n'))
461
461
462 def _concludenode(self, rev, p1, p2, editor, commitmsg=None):
462 def _concludenode(self, rev, p1, p2, editor, commitmsg=None):
463 '''Commit the wd changes with parents p1 and p2.
463 '''Commit the wd changes with parents p1 and p2.
464
464
465 Reuse commit info from rev but also store useful information in extra.
465 Reuse commit info from rev but also store useful information in extra.
466 Return node of committed revision.'''
466 Return node of committed revision.'''
467 repo = self.repo
467 repo = self.repo
468 ctx = repo[rev]
468 ctx = repo[rev]
469 if commitmsg is None:
469 if commitmsg is None:
470 commitmsg = ctx.description()
470 commitmsg = ctx.description()
471 date = self.date
471 date = self.date
472 if date is None:
472 if date is None:
473 date = ctx.date()
473 date = ctx.date()
474 extra = {'rebase_source': ctx.hex()}
474 extra = {'rebase_source': ctx.hex()}
475 for c in self.extrafns:
475 for c in self.extrafns:
476 c(ctx, extra)
476 c(ctx, extra)
477 keepbranch = self.keepbranchesf and repo[p1].branch() != ctx.branch()
477 keepbranch = self.keepbranchesf and repo[p1].branch() != ctx.branch()
478 destphase = max(ctx.phase(), phases.draft)
478 destphase = max(ctx.phase(), phases.draft)
479 overrides = {('phases', 'new-commit'): destphase}
479 overrides = {('phases', 'new-commit'): destphase}
480 if keepbranch:
480 if keepbranch:
481 overrides[('ui', 'allowemptycommit')] = True
481 overrides[('ui', 'allowemptycommit')] = True
482 with repo.ui.configoverride(overrides, 'rebase'):
482 with repo.ui.configoverride(overrides, 'rebase'):
483 if self.inmemory:
483 if self.inmemory:
484 newnode = commitmemorynode(repo, p1, p2,
484 newnode = commitmemorynode(repo, p1, p2,
485 wctx=self.wctx,
485 wctx=self.wctx,
486 extra=extra,
486 extra=extra,
487 commitmsg=commitmsg,
487 commitmsg=commitmsg,
488 editor=editor,
488 editor=editor,
489 user=ctx.user(),
489 user=ctx.user(),
490 date=date)
490 date=date)
491 mergemod.mergestate.clean(repo)
491 mergemod.mergestate.clean(repo)
492 else:
492 else:
493 newnode = commitnode(repo, p1, p2,
493 newnode = commitnode(repo, p1, p2,
494 extra=extra,
494 extra=extra,
495 commitmsg=commitmsg,
495 commitmsg=commitmsg,
496 editor=editor,
496 editor=editor,
497 user=ctx.user(),
497 user=ctx.user(),
498 date=date)
498 date=date)
499
499
500 if newnode is None:
500 if newnode is None:
501 # If it ended up being a no-op commit, then the normal
501 # If it ended up being a no-op commit, then the normal
502 # merge state clean-up path doesn't happen, so do it
502 # merge state clean-up path doesn't happen, so do it
503 # here. Fix issue5494
503 # here. Fix issue5494
504 mergemod.mergestate.clean(repo)
504 mergemod.mergestate.clean(repo)
505 return newnode
505 return newnode
506
506
507 def _rebasenode(self, tr, rev, allowdivergence, progressfn):
507 def _rebasenode(self, tr, rev, allowdivergence, progressfn):
508 repo, ui, opts = self.repo, self.ui, self.opts
508 repo, ui, opts = self.repo, self.ui, self.opts
509 dest = self.destmap[rev]
509 dest = self.destmap[rev]
510 ctx = repo[rev]
510 ctx = repo[rev]
511 desc = _ctxdesc(ctx)
511 desc = _ctxdesc(ctx)
512 if self.state[rev] == rev:
512 if self.state[rev] == rev:
513 ui.status(_('already rebased %s\n') % desc)
513 ui.status(_('already rebased %s\n') % desc)
514 elif (not allowdivergence
514 elif (not allowdivergence
515 and rev in self.obsoletewithoutsuccessorindestination):
515 and rev in self.obsoletewithoutsuccessorindestination):
516 msg = _('note: not rebasing %s and its descendants as '
516 msg = _('note: not rebasing %s and its descendants as '
517 'this would cause divergence\n') % desc
517 'this would cause divergence\n') % desc
518 repo.ui.status(msg)
518 repo.ui.status(msg)
519 self.skipped.add(rev)
519 self.skipped.add(rev)
520 elif rev in self.obsoletenotrebased:
520 elif rev in self.obsoletenotrebased:
521 succ = self.obsoletenotrebased[rev]
521 succ = self.obsoletenotrebased[rev]
522 if succ is None:
522 if succ is None:
523 msg = _('note: not rebasing %s, it has no '
523 msg = _('note: not rebasing %s, it has no '
524 'successor\n') % desc
524 'successor\n') % desc
525 else:
525 else:
526 succdesc = _ctxdesc(repo[succ])
526 succdesc = _ctxdesc(repo[succ])
527 msg = (_('note: not rebasing %s, already in '
527 msg = (_('note: not rebasing %s, already in '
528 'destination as %s\n') % (desc, succdesc))
528 'destination as %s\n') % (desc, succdesc))
529 repo.ui.status(msg)
529 repo.ui.status(msg)
530 # Make clearrebased aware state[rev] is not a true successor
530 # Make clearrebased aware state[rev] is not a true successor
531 self.skipped.add(rev)
531 self.skipped.add(rev)
532 # Record rev as moved to its desired destination in self.state.
532 # Record rev as moved to its desired destination in self.state.
533 # This helps bookmark and working parent movement.
533 # This helps bookmark and working parent movement.
534 dest = max(adjustdest(repo, rev, self.destmap, self.state,
534 dest = max(adjustdest(repo, rev, self.destmap, self.state,
535 self.skipped))
535 self.skipped))
536 self.state[rev] = dest
536 self.state[rev] = dest
537 elif self.state[rev] == revtodo:
537 elif self.state[rev] == revtodo:
538 ui.status(_('rebasing %s\n') % desc)
538 ui.status(_('rebasing %s\n') % desc)
539 progressfn(ctx)
539 progressfn(ctx)
540 p1, p2, base = defineparents(repo, rev, self.destmap,
540 p1, p2, base = defineparents(repo, rev, self.destmap,
541 self.state, self.skipped,
541 self.state, self.skipped,
542 self.obsoletenotrebased)
542 self.obsoletenotrebased)
543 if not self.inmemory and len(repo[None].parents()) == 2:
543 if not self.inmemory and len(repo[None].parents()) == 2:
544 repo.ui.debug('resuming interrupted rebase\n')
544 repo.ui.debug('resuming interrupted rebase\n')
545 else:
545 else:
546 overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
546 overrides = {('ui', 'forcemerge'): opts.get('tool', '')}
547 with ui.configoverride(overrides, 'rebase'):
547 with ui.configoverride(overrides, 'rebase'):
548 stats = rebasenode(repo, rev, p1, base, self.collapsef,
548 stats = rebasenode(repo, rev, p1, base, self.collapsef,
549 dest, wctx=self.wctx)
549 dest, wctx=self.wctx)
550 if stats.unresolvedcount > 0:
550 if stats.unresolvedcount > 0:
551 if self.inmemory:
551 if self.inmemory:
552 raise error.InMemoryMergeConflictsError()
552 raise error.InMemoryMergeConflictsError()
553 else:
553 else:
554 raise error.InterventionRequired(
554 raise error.InterventionRequired(
555 _('unresolved conflicts (see hg '
555 _('unresolved conflicts (see hg '
556 'resolve, then hg rebase --continue)'))
556 'resolve, then hg rebase --continue)'))
557 if not self.collapsef:
557 if not self.collapsef:
558 merging = p2 != nullrev
558 merging = p2 != nullrev
559 editform = cmdutil.mergeeditform(merging, 'rebase')
559 editform = cmdutil.mergeeditform(merging, 'rebase')
560 editor = cmdutil.getcommiteditor(editform=editform,
560 editor = cmdutil.getcommiteditor(editform=editform,
561 **pycompat.strkwargs(opts))
561 **pycompat.strkwargs(opts))
562 newnode = self._concludenode(rev, p1, p2, editor)
562 newnode = self._concludenode(rev, p1, p2, editor)
563 else:
563 else:
564 # Skip commit if we are collapsing
564 # Skip commit if we are collapsing
565 if self.inmemory:
565 if self.inmemory:
566 self.wctx.setbase(repo[p1])
566 self.wctx.setbase(repo[p1])
567 else:
567 else:
568 repo.setparents(repo[p1].node())
568 repo.setparents(repo[p1].node())
569 newnode = None
569 newnode = None
570 # Update the state
570 # Update the state
571 if newnode is not None:
571 if newnode is not None:
572 self.state[rev] = repo[newnode].rev()
572 self.state[rev] = repo[newnode].rev()
573 ui.debug('rebased as %s\n' % short(newnode))
573 ui.debug('rebased as %s\n' % short(newnode))
574 else:
574 else:
575 if not self.collapsef:
575 if not self.collapsef:
576 ui.warn(_('note: rebase of %s created no changes '
576 ui.warn(_('note: not rebasing %s, its destination already '
577 'to commit\n') % desc)
577 'has all its changes\n') % desc)
578 self.skipped.add(rev)
578 self.skipped.add(rev)
579 self.state[rev] = p1
579 self.state[rev] = p1
580 ui.debug('next revision set to %d\n' % p1)
580 ui.debug('next revision set to %d\n' % p1)
581 else:
581 else:
582 ui.status(_('already rebased %s as %s\n') %
582 ui.status(_('already rebased %s as %s\n') %
583 (desc, repo[self.state[rev]]))
583 (desc, repo[self.state[rev]]))
584 if not tr:
584 if not tr:
585 # When not using single transaction, store state after each
585 # When not using single transaction, store state after each
586 # commit is completely done. On InterventionRequired, we thus
586 # commit is completely done. On InterventionRequired, we thus
587 # won't store the status. Instead, we'll hit the "len(parents) == 2"
587 # won't store the status. Instead, we'll hit the "len(parents) == 2"
588 # case and realize that the commit was in progress.
588 # case and realize that the commit was in progress.
589 self.storestatus()
589 self.storestatus()
590
590
591 def _finishrebase(self):
591 def _finishrebase(self):
592 repo, ui, opts = self.repo, self.ui, self.opts
592 repo, ui, opts = self.repo, self.ui, self.opts
593 fm = ui.formatter('rebase', opts)
593 fm = ui.formatter('rebase', opts)
594 fm.startitem()
594 fm.startitem()
595 if self.collapsef:
595 if self.collapsef:
596 p1, p2, _base = defineparents(repo, min(self.state), self.destmap,
596 p1, p2, _base = defineparents(repo, min(self.state), self.destmap,
597 self.state, self.skipped,
597 self.state, self.skipped,
598 self.obsoletenotrebased)
598 self.obsoletenotrebased)
599 editopt = opts.get('edit')
599 editopt = opts.get('edit')
600 editform = 'rebase.collapse'
600 editform = 'rebase.collapse'
601 if self.collapsemsg:
601 if self.collapsemsg:
602 commitmsg = self.collapsemsg
602 commitmsg = self.collapsemsg
603 else:
603 else:
604 commitmsg = 'Collapsed revision'
604 commitmsg = 'Collapsed revision'
605 for rebased in sorted(self.state):
605 for rebased in sorted(self.state):
606 if rebased not in self.skipped:
606 if rebased not in self.skipped:
607 commitmsg += '\n* %s' % repo[rebased].description()
607 commitmsg += '\n* %s' % repo[rebased].description()
608 editopt = True
608 editopt = True
609 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
609 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
610 revtoreuse = max(self.state)
610 revtoreuse = max(self.state)
611
611
612 newnode = self._concludenode(revtoreuse, p1, self.external,
612 newnode = self._concludenode(revtoreuse, p1, self.external,
613 editor, commitmsg=commitmsg)
613 editor, commitmsg=commitmsg)
614
614
615 if newnode is not None:
615 if newnode is not None:
616 newrev = repo[newnode].rev()
616 newrev = repo[newnode].rev()
617 for oldrev in self.state:
617 for oldrev in self.state:
618 self.state[oldrev] = newrev
618 self.state[oldrev] = newrev
619
619
620 if 'qtip' in repo.tags():
620 if 'qtip' in repo.tags():
621 updatemq(repo, self.state, self.skipped,
621 updatemq(repo, self.state, self.skipped,
622 **pycompat.strkwargs(opts))
622 **pycompat.strkwargs(opts))
623
623
624 # restore original working directory
624 # restore original working directory
625 # (we do this before stripping)
625 # (we do this before stripping)
626 newwd = self.state.get(self.originalwd, self.originalwd)
626 newwd = self.state.get(self.originalwd, self.originalwd)
627 if newwd < 0:
627 if newwd < 0:
628 # original directory is a parent of rebase set root or ignored
628 # original directory is a parent of rebase set root or ignored
629 newwd = self.originalwd
629 newwd = self.originalwd
630 if newwd not in [c.rev() for c in repo[None].parents()]:
630 if newwd not in [c.rev() for c in repo[None].parents()]:
631 ui.note(_("update back to initial working directory parent\n"))
631 ui.note(_("update back to initial working directory parent\n"))
632 hg.updaterepo(repo, newwd, overwrite=False)
632 hg.updaterepo(repo, newwd, overwrite=False)
633
633
634 collapsedas = None
634 collapsedas = None
635 if self.collapsef and not self.keepf:
635 if self.collapsef and not self.keepf:
636 collapsedas = newnode
636 collapsedas = newnode
637 clearrebased(ui, repo, self.destmap, self.state, self.skipped,
637 clearrebased(ui, repo, self.destmap, self.state, self.skipped,
638 collapsedas, self.keepf, fm=fm, backup=self.backupf)
638 collapsedas, self.keepf, fm=fm, backup=self.backupf)
639
639
640 clearstatus(repo)
640 clearstatus(repo)
641 clearcollapsemsg(repo)
641 clearcollapsemsg(repo)
642
642
643 ui.note(_("rebase completed\n"))
643 ui.note(_("rebase completed\n"))
644 util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
644 util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
645 if self.skipped:
645 if self.skipped:
646 skippedlen = len(self.skipped)
646 skippedlen = len(self.skipped)
647 ui.note(_("%d revisions have been skipped\n") % skippedlen)
647 ui.note(_("%d revisions have been skipped\n") % skippedlen)
648 fm.end()
648 fm.end()
649
649
650 if (self.activebookmark and self.activebookmark in repo._bookmarks and
650 if (self.activebookmark and self.activebookmark in repo._bookmarks and
651 repo['.'].node() == repo._bookmarks[self.activebookmark]):
651 repo['.'].node() == repo._bookmarks[self.activebookmark]):
652 bookmarks.activate(repo, self.activebookmark)
652 bookmarks.activate(repo, self.activebookmark)
653
653
654 def _abort(self, backup=True, suppwarns=False):
654 def _abort(self, backup=True, suppwarns=False):
655 '''Restore the repository to its original state.'''
655 '''Restore the repository to its original state.'''
656
656
657 repo = self.repo
657 repo = self.repo
658 try:
658 try:
659 # If the first commits in the rebased set get skipped during the
659 # If the first commits in the rebased set get skipped during the
660 # rebase, their values within the state mapping will be the dest
660 # rebase, their values within the state mapping will be the dest
661 # rev id. The rebased list must must not contain the dest rev
661 # rev id. The rebased list must must not contain the dest rev
662 # (issue4896)
662 # (issue4896)
663 rebased = [s for r, s in self.state.items()
663 rebased = [s for r, s in self.state.items()
664 if s >= 0 and s != r and s != self.destmap[r]]
664 if s >= 0 and s != r and s != self.destmap[r]]
665 immutable = [d for d in rebased if not repo[d].mutable()]
665 immutable = [d for d in rebased if not repo[d].mutable()]
666 cleanup = True
666 cleanup = True
667 if immutable:
667 if immutable:
668 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
668 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
669 % ', '.join(bytes(repo[r]) for r in immutable),
669 % ', '.join(bytes(repo[r]) for r in immutable),
670 hint=_("see 'hg help phases' for details"))
670 hint=_("see 'hg help phases' for details"))
671 cleanup = False
671 cleanup = False
672
672
673 descendants = set()
673 descendants = set()
674 if rebased:
674 if rebased:
675 descendants = set(repo.changelog.descendants(rebased))
675 descendants = set(repo.changelog.descendants(rebased))
676 if descendants - set(rebased):
676 if descendants - set(rebased):
677 repo.ui.warn(_("warning: new changesets detected on "
677 repo.ui.warn(_("warning: new changesets detected on "
678 "destination branch, can't strip\n"))
678 "destination branch, can't strip\n"))
679 cleanup = False
679 cleanup = False
680
680
681 if cleanup:
681 if cleanup:
682 shouldupdate = False
682 shouldupdate = False
683 if rebased:
683 if rebased:
684 strippoints = [
684 strippoints = [
685 c.node() for c in repo.set('roots(%ld)', rebased)]
685 c.node() for c in repo.set('roots(%ld)', rebased)]
686
686
687 updateifonnodes = set(rebased)
687 updateifonnodes = set(rebased)
688 updateifonnodes.update(self.destmap.values())
688 updateifonnodes.update(self.destmap.values())
689 updateifonnodes.add(self.originalwd)
689 updateifonnodes.add(self.originalwd)
690 shouldupdate = repo['.'].rev() in updateifonnodes
690 shouldupdate = repo['.'].rev() in updateifonnodes
691
691
692 # Update away from the rebase if necessary
692 # Update away from the rebase if necessary
693 if shouldupdate or needupdate(repo, self.state):
693 if shouldupdate or needupdate(repo, self.state):
694 mergemod.update(repo, self.originalwd, branchmerge=False,
694 mergemod.update(repo, self.originalwd, branchmerge=False,
695 force=True)
695 force=True)
696
696
697 # Strip from the first rebased revision
697 # Strip from the first rebased revision
698 if rebased:
698 if rebased:
699 repair.strip(repo.ui, repo, strippoints, backup=backup)
699 repair.strip(repo.ui, repo, strippoints, backup=backup)
700
700
701 if self.activebookmark and self.activebookmark in repo._bookmarks:
701 if self.activebookmark and self.activebookmark in repo._bookmarks:
702 bookmarks.activate(repo, self.activebookmark)
702 bookmarks.activate(repo, self.activebookmark)
703
703
704 finally:
704 finally:
705 clearstatus(repo)
705 clearstatus(repo)
706 clearcollapsemsg(repo)
706 clearcollapsemsg(repo)
707 if not suppwarns:
707 if not suppwarns:
708 repo.ui.warn(_('rebase aborted\n'))
708 repo.ui.warn(_('rebase aborted\n'))
709 return 0
709 return 0
710
710
711 @command('rebase',
711 @command('rebase',
712 [('s', 'source', '',
712 [('s', 'source', '',
713 _('rebase the specified changeset and descendants'), _('REV')),
713 _('rebase the specified changeset and descendants'), _('REV')),
714 ('b', 'base', '',
714 ('b', 'base', '',
715 _('rebase everything from branching point of specified changeset'),
715 _('rebase everything from branching point of specified changeset'),
716 _('REV')),
716 _('REV')),
717 ('r', 'rev', [],
717 ('r', 'rev', [],
718 _('rebase these revisions'),
718 _('rebase these revisions'),
719 _('REV')),
719 _('REV')),
720 ('d', 'dest', '',
720 ('d', 'dest', '',
721 _('rebase onto the specified changeset'), _('REV')),
721 _('rebase onto the specified changeset'), _('REV')),
722 ('', 'collapse', False, _('collapse the rebased changesets')),
722 ('', 'collapse', False, _('collapse the rebased changesets')),
723 ('m', 'message', '',
723 ('m', 'message', '',
724 _('use text as collapse commit message'), _('TEXT')),
724 _('use text as collapse commit message'), _('TEXT')),
725 ('e', 'edit', False, _('invoke editor on commit messages')),
725 ('e', 'edit', False, _('invoke editor on commit messages')),
726 ('l', 'logfile', '',
726 ('l', 'logfile', '',
727 _('read collapse commit message from file'), _('FILE')),
727 _('read collapse commit message from file'), _('FILE')),
728 ('k', 'keep', False, _('keep original changesets')),
728 ('k', 'keep', False, _('keep original changesets')),
729 ('', 'keepbranches', False, _('keep original branch names')),
729 ('', 'keepbranches', False, _('keep original branch names')),
730 ('D', 'detach', False, _('(DEPRECATED)')),
730 ('D', 'detach', False, _('(DEPRECATED)')),
731 ('i', 'interactive', False, _('(DEPRECATED)')),
731 ('i', 'interactive', False, _('(DEPRECATED)')),
732 ('t', 'tool', '', _('specify merge tool')),
732 ('t', 'tool', '', _('specify merge tool')),
733 ('', 'stop', False, _('stop interrupted rebase')),
733 ('', 'stop', False, _('stop interrupted rebase')),
734 ('c', 'continue', False, _('continue an interrupted rebase')),
734 ('c', 'continue', False, _('continue an interrupted rebase')),
735 ('a', 'abort', False, _('abort an interrupted rebase')),
735 ('a', 'abort', False, _('abort an interrupted rebase')),
736 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
736 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
737 'in the specified revset (EXPERIMENTAL)')),
737 'in the specified revset (EXPERIMENTAL)')),
738 ] + cmdutil.dryrunopts + cmdutil.formatteropts + cmdutil.confirmopts,
738 ] + cmdutil.dryrunopts + cmdutil.formatteropts + cmdutil.confirmopts,
739 _('[-s REV | -b REV] [-d REV] [OPTION]'),
739 _('[-s REV | -b REV] [-d REV] [OPTION]'),
740 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
740 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
741 def rebase(ui, repo, **opts):
741 def rebase(ui, repo, **opts):
742 """move changeset (and descendants) to a different branch
742 """move changeset (and descendants) to a different branch
743
743
744 Rebase uses repeated merging to graft changesets from one part of
744 Rebase uses repeated merging to graft changesets from one part of
745 history (the source) onto another (the destination). This can be
745 history (the source) onto another (the destination). This can be
746 useful for linearizing *local* changes relative to a master
746 useful for linearizing *local* changes relative to a master
747 development tree.
747 development tree.
748
748
749 Published commits cannot be rebased (see :hg:`help phases`).
749 Published commits cannot be rebased (see :hg:`help phases`).
750 To copy commits, see :hg:`help graft`.
750 To copy commits, see :hg:`help graft`.
751
751
752 If you don't specify a destination changeset (``-d/--dest``), rebase
752 If you don't specify a destination changeset (``-d/--dest``), rebase
753 will use the same logic as :hg:`merge` to pick a destination. if
753 will use the same logic as :hg:`merge` to pick a destination. if
754 the current branch contains exactly one other head, the other head
754 the current branch contains exactly one other head, the other head
755 is merged with by default. Otherwise, an explicit revision with
755 is merged with by default. Otherwise, an explicit revision with
756 which to merge with must be provided. (destination changeset is not
756 which to merge with must be provided. (destination changeset is not
757 modified by rebasing, but new changesets are added as its
757 modified by rebasing, but new changesets are added as its
758 descendants.)
758 descendants.)
759
759
760 Here are the ways to select changesets:
760 Here are the ways to select changesets:
761
761
762 1. Explicitly select them using ``--rev``.
762 1. Explicitly select them using ``--rev``.
763
763
764 2. Use ``--source`` to select a root changeset and include all of its
764 2. Use ``--source`` to select a root changeset and include all of its
765 descendants.
765 descendants.
766
766
767 3. Use ``--base`` to select a changeset; rebase will find ancestors
767 3. Use ``--base`` to select a changeset; rebase will find ancestors
768 and their descendants which are not also ancestors of the destination.
768 and their descendants which are not also ancestors of the destination.
769
769
770 4. If you do not specify any of ``--rev``, ``source``, or ``--base``,
770 4. If you do not specify any of ``--rev``, ``source``, or ``--base``,
771 rebase will use ``--base .`` as above.
771 rebase will use ``--base .`` as above.
772
772
773 If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC``
773 If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC``
774 can be used in ``--dest``. Destination would be calculated per source
774 can be used in ``--dest``. Destination would be calculated per source
775 revision with ``SRC`` substituted by that single source revision and
775 revision with ``SRC`` substituted by that single source revision and
776 ``ALLSRC`` substituted by all source revisions.
776 ``ALLSRC`` substituted by all source revisions.
777
777
778 Rebase will destroy original changesets unless you use ``--keep``.
778 Rebase will destroy original changesets unless you use ``--keep``.
779 It will also move your bookmarks (even if you do).
779 It will also move your bookmarks (even if you do).
780
780
781 Some changesets may be dropped if they do not contribute changes
781 Some changesets may be dropped if they do not contribute changes
782 (e.g. merges from the destination branch).
782 (e.g. merges from the destination branch).
783
783
784 Unlike ``merge``, rebase will do nothing if you are at the branch tip of
784 Unlike ``merge``, rebase will do nothing if you are at the branch tip of
785 a named branch with two heads. You will need to explicitly specify source
785 a named branch with two heads. You will need to explicitly specify source
786 and/or destination.
786 and/or destination.
787
787
788 If you need to use a tool to automate merge/conflict decisions, you
788 If you need to use a tool to automate merge/conflict decisions, you
789 can specify one with ``--tool``, see :hg:`help merge-tools`.
789 can specify one with ``--tool``, see :hg:`help merge-tools`.
790 As a caveat: the tool will not be used to mediate when a file was
790 As a caveat: the tool will not be used to mediate when a file was
791 deleted, there is no hook presently available for this.
791 deleted, there is no hook presently available for this.
792
792
793 If a rebase is interrupted to manually resolve a conflict, it can be
793 If a rebase is interrupted to manually resolve a conflict, it can be
794 continued with --continue/-c, aborted with --abort/-a, or stopped with
794 continued with --continue/-c, aborted with --abort/-a, or stopped with
795 --stop.
795 --stop.
796
796
797 .. container:: verbose
797 .. container:: verbose
798
798
799 Examples:
799 Examples:
800
800
801 - move "local changes" (current commit back to branching point)
801 - move "local changes" (current commit back to branching point)
802 to the current branch tip after a pull::
802 to the current branch tip after a pull::
803
803
804 hg rebase
804 hg rebase
805
805
806 - move a single changeset to the stable branch::
806 - move a single changeset to the stable branch::
807
807
808 hg rebase -r 5f493448 -d stable
808 hg rebase -r 5f493448 -d stable
809
809
810 - splice a commit and all its descendants onto another part of history::
810 - splice a commit and all its descendants onto another part of history::
811
811
812 hg rebase --source c0c3 --dest 4cf9
812 hg rebase --source c0c3 --dest 4cf9
813
813
814 - rebase everything on a branch marked by a bookmark onto the
814 - rebase everything on a branch marked by a bookmark onto the
815 default branch::
815 default branch::
816
816
817 hg rebase --base myfeature --dest default
817 hg rebase --base myfeature --dest default
818
818
819 - collapse a sequence of changes into a single commit::
819 - collapse a sequence of changes into a single commit::
820
820
821 hg rebase --collapse -r 1520:1525 -d .
821 hg rebase --collapse -r 1520:1525 -d .
822
822
823 - move a named branch while preserving its name::
823 - move a named branch while preserving its name::
824
824
825 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
825 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
826
826
827 - stabilize orphaned changesets so history looks linear::
827 - stabilize orphaned changesets so history looks linear::
828
828
829 hg rebase -r 'orphan()-obsolete()'\
829 hg rebase -r 'orphan()-obsolete()'\
830 -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) +\
830 -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) +\
831 max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))'
831 max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))'
832
832
833 Configuration Options:
833 Configuration Options:
834
834
835 You can make rebase require a destination if you set the following config
835 You can make rebase require a destination if you set the following config
836 option::
836 option::
837
837
838 [commands]
838 [commands]
839 rebase.requiredest = True
839 rebase.requiredest = True
840
840
841 By default, rebase will close the transaction after each commit. For
841 By default, rebase will close the transaction after each commit. For
842 performance purposes, you can configure rebase to use a single transaction
842 performance purposes, you can configure rebase to use a single transaction
843 across the entire rebase. WARNING: This setting introduces a significant
843 across the entire rebase. WARNING: This setting introduces a significant
844 risk of losing the work you've done in a rebase if the rebase aborts
844 risk of losing the work you've done in a rebase if the rebase aborts
845 unexpectedly::
845 unexpectedly::
846
846
847 [rebase]
847 [rebase]
848 singletransaction = True
848 singletransaction = True
849
849
850 By default, rebase writes to the working copy, but you can configure it to
850 By default, rebase writes to the working copy, but you can configure it to
851 run in-memory for for better performance, and to allow it to run if the
851 run in-memory for for better performance, and to allow it to run if the
852 working copy is dirty::
852 working copy is dirty::
853
853
854 [rebase]
854 [rebase]
855 experimental.inmemory = True
855 experimental.inmemory = True
856
856
857 Return Values:
857 Return Values:
858
858
859 Returns 0 on success, 1 if nothing to rebase or there are
859 Returns 0 on success, 1 if nothing to rebase or there are
860 unresolved conflicts.
860 unresolved conflicts.
861
861
862 """
862 """
863 opts = pycompat.byteskwargs(opts)
863 opts = pycompat.byteskwargs(opts)
864 inmemory = ui.configbool('rebase', 'experimental.inmemory')
864 inmemory = ui.configbool('rebase', 'experimental.inmemory')
865 dryrun = opts.get('dry_run')
865 dryrun = opts.get('dry_run')
866 confirm = opts.get('confirm')
866 confirm = opts.get('confirm')
867 selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)]
867 selactions = [k for k in ['abort', 'stop', 'continue'] if opts.get(k)]
868 if len(selactions) > 1:
868 if len(selactions) > 1:
869 raise error.Abort(_('cannot use --%s with --%s')
869 raise error.Abort(_('cannot use --%s with --%s')
870 % tuple(selactions[:2]))
870 % tuple(selactions[:2]))
871 action = selactions[0] if selactions else None
871 action = selactions[0] if selactions else None
872 if dryrun and action:
872 if dryrun and action:
873 raise error.Abort(_('cannot specify both --dry-run and --%s') % action)
873 raise error.Abort(_('cannot specify both --dry-run and --%s') % action)
874 if confirm and action:
874 if confirm and action:
875 raise error.Abort(_('cannot specify both --confirm and --%s') % action)
875 raise error.Abort(_('cannot specify both --confirm and --%s') % action)
876 if dryrun and confirm:
876 if dryrun and confirm:
877 raise error.Abort(_('cannot specify both --confirm and --dry-run'))
877 raise error.Abort(_('cannot specify both --confirm and --dry-run'))
878
878
879 if action or repo.currenttransaction() is not None:
879 if action or repo.currenttransaction() is not None:
880 # in-memory rebase is not compatible with resuming rebases.
880 # in-memory rebase is not compatible with resuming rebases.
881 # (Or if it is run within a transaction, since the restart logic can
881 # (Or if it is run within a transaction, since the restart logic can
882 # fail the entire transaction.)
882 # fail the entire transaction.)
883 inmemory = False
883 inmemory = False
884
884
885 if opts.get('auto_orphans'):
885 if opts.get('auto_orphans'):
886 for key in opts:
886 for key in opts:
887 if key != 'auto_orphans' and opts.get(key):
887 if key != 'auto_orphans' and opts.get(key):
888 raise error.Abort(_('--auto-orphans is incompatible with %s') %
888 raise error.Abort(_('--auto-orphans is incompatible with %s') %
889 ('--' + key))
889 ('--' + key))
890 userrevs = list(repo.revs(opts.get('auto_orphans')))
890 userrevs = list(repo.revs(opts.get('auto_orphans')))
891 opts['rev'] = [revsetlang.formatspec('%ld and orphan()', userrevs)]
891 opts['rev'] = [revsetlang.formatspec('%ld and orphan()', userrevs)]
892 opts['dest'] = '_destautoorphanrebase(SRC)'
892 opts['dest'] = '_destautoorphanrebase(SRC)'
893
893
894 if dryrun or confirm:
894 if dryrun or confirm:
895 return _dryrunrebase(ui, repo, action, opts)
895 return _dryrunrebase(ui, repo, action, opts)
896 elif action == 'stop':
896 elif action == 'stop':
897 rbsrt = rebaseruntime(repo, ui)
897 rbsrt = rebaseruntime(repo, ui)
898 with repo.wlock(), repo.lock():
898 with repo.wlock(), repo.lock():
899 rbsrt.restorestatus()
899 rbsrt.restorestatus()
900 if rbsrt.collapsef:
900 if rbsrt.collapsef:
901 raise error.Abort(_("cannot stop in --collapse session"))
901 raise error.Abort(_("cannot stop in --collapse session"))
902 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
902 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
903 if not (rbsrt.keepf or allowunstable):
903 if not (rbsrt.keepf or allowunstable):
904 raise error.Abort(_("cannot remove original changesets with"
904 raise error.Abort(_("cannot remove original changesets with"
905 " unrebased descendants"),
905 " unrebased descendants"),
906 hint=_('either enable obsmarkers to allow unstable '
906 hint=_('either enable obsmarkers to allow unstable '
907 'revisions or use --keep to keep original '
907 'revisions or use --keep to keep original '
908 'changesets'))
908 'changesets'))
909 if needupdate(repo, rbsrt.state):
909 if needupdate(repo, rbsrt.state):
910 # update to the current working revision
910 # update to the current working revision
911 # to clear interrupted merge
911 # to clear interrupted merge
912 hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
912 hg.updaterepo(repo, rbsrt.originalwd, overwrite=True)
913 rbsrt._finishrebase()
913 rbsrt._finishrebase()
914 return 0
914 return 0
915 elif inmemory:
915 elif inmemory:
916 try:
916 try:
917 # in-memory merge doesn't support conflicts, so if we hit any, abort
917 # in-memory merge doesn't support conflicts, so if we hit any, abort
918 # and re-run as an on-disk merge.
918 # and re-run as an on-disk merge.
919 overrides = {('rebase', 'singletransaction'): True}
919 overrides = {('rebase', 'singletransaction'): True}
920 with ui.configoverride(overrides, 'rebase'):
920 with ui.configoverride(overrides, 'rebase'):
921 return _dorebase(ui, repo, action, opts, inmemory=inmemory)
921 return _dorebase(ui, repo, action, opts, inmemory=inmemory)
922 except error.InMemoryMergeConflictsError:
922 except error.InMemoryMergeConflictsError:
923 ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
923 ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
924 ' merge\n'))
924 ' merge\n'))
925 # TODO: Make in-memory merge not use the on-disk merge state, so
925 # TODO: Make in-memory merge not use the on-disk merge state, so
926 # we don't have to clean it here
926 # we don't have to clean it here
927 mergemod.mergestate.clean(repo)
927 mergemod.mergestate.clean(repo)
928 clearstatus(repo)
928 clearstatus(repo)
929 clearcollapsemsg(repo)
929 clearcollapsemsg(repo)
930 return _dorebase(ui, repo, action, opts, inmemory=False)
930 return _dorebase(ui, repo, action, opts, inmemory=False)
931 else:
931 else:
932 return _dorebase(ui, repo, action, opts)
932 return _dorebase(ui, repo, action, opts)
933
933
934 def _dryrunrebase(ui, repo, action, opts):
934 def _dryrunrebase(ui, repo, action, opts):
935 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
935 rbsrt = rebaseruntime(repo, ui, inmemory=True, opts=opts)
936 confirm = opts.get('confirm')
936 confirm = opts.get('confirm')
937 if confirm:
937 if confirm:
938 ui.status(_('starting in-memory rebase\n'))
938 ui.status(_('starting in-memory rebase\n'))
939 else:
939 else:
940 ui.status(_('starting dry-run rebase; repository will not be '
940 ui.status(_('starting dry-run rebase; repository will not be '
941 'changed\n'))
941 'changed\n'))
942 with repo.wlock(), repo.lock():
942 with repo.wlock(), repo.lock():
943 needsabort = True
943 needsabort = True
944 try:
944 try:
945 overrides = {('rebase', 'singletransaction'): True}
945 overrides = {('rebase', 'singletransaction'): True}
946 with ui.configoverride(overrides, 'rebase'):
946 with ui.configoverride(overrides, 'rebase'):
947 _origrebase(ui, repo, action, opts, rbsrt, inmemory=True,
947 _origrebase(ui, repo, action, opts, rbsrt, inmemory=True,
948 leaveunfinished=True)
948 leaveunfinished=True)
949 except error.InMemoryMergeConflictsError:
949 except error.InMemoryMergeConflictsError:
950 ui.status(_('hit a merge conflict\n'))
950 ui.status(_('hit a merge conflict\n'))
951 return 1
951 return 1
952 else:
952 else:
953 if confirm:
953 if confirm:
954 ui.status(_('rebase completed successfully\n'))
954 ui.status(_('rebase completed successfully\n'))
955 if not ui.promptchoice(_(b'apply changes (yn)?'
955 if not ui.promptchoice(_(b'apply changes (yn)?'
956 b'$$ &Yes $$ &No')):
956 b'$$ &Yes $$ &No')):
957 # finish unfinished rebase
957 # finish unfinished rebase
958 rbsrt._finishrebase()
958 rbsrt._finishrebase()
959 else:
959 else:
960 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
960 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
961 suppwarns=True)
961 suppwarns=True)
962 needsabort = False
962 needsabort = False
963 else:
963 else:
964 ui.status(_('dry-run rebase completed successfully; run without'
964 ui.status(_('dry-run rebase completed successfully; run without'
965 ' -n/--dry-run to perform this rebase\n'))
965 ' -n/--dry-run to perform this rebase\n'))
966 return 0
966 return 0
967 finally:
967 finally:
968 if needsabort:
968 if needsabort:
969 # no need to store backup in case of dryrun
969 # no need to store backup in case of dryrun
970 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
970 rbsrt._prepareabortorcontinue(isabort=True, backup=False,
971 suppwarns=True)
971 suppwarns=True)
972
972
973 def _dorebase(ui, repo, action, opts, inmemory=False):
973 def _dorebase(ui, repo, action, opts, inmemory=False):
974 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
974 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
975 return _origrebase(ui, repo, action, opts, rbsrt, inmemory=inmemory)
975 return _origrebase(ui, repo, action, opts, rbsrt, inmemory=inmemory)
976
976
977 def _origrebase(ui, repo, action, opts, rbsrt, inmemory=False,
977 def _origrebase(ui, repo, action, opts, rbsrt, inmemory=False,
978 leaveunfinished=False):
978 leaveunfinished=False):
979 assert action != 'stop'
979 assert action != 'stop'
980 with repo.wlock(), repo.lock():
980 with repo.wlock(), repo.lock():
981 # Validate input and define rebasing points
981 # Validate input and define rebasing points
982 destf = opts.get('dest', None)
982 destf = opts.get('dest', None)
983 srcf = opts.get('source', None)
983 srcf = opts.get('source', None)
984 basef = opts.get('base', None)
984 basef = opts.get('base', None)
985 revf = opts.get('rev', [])
985 revf = opts.get('rev', [])
986 # search default destination in this space
986 # search default destination in this space
987 # used in the 'hg pull --rebase' case, see issue 5214.
987 # used in the 'hg pull --rebase' case, see issue 5214.
988 destspace = opts.get('_destspace')
988 destspace = opts.get('_destspace')
989 if opts.get('interactive'):
989 if opts.get('interactive'):
990 try:
990 try:
991 if extensions.find('histedit'):
991 if extensions.find('histedit'):
992 enablehistedit = ''
992 enablehistedit = ''
993 except KeyError:
993 except KeyError:
994 enablehistedit = " --config extensions.histedit="
994 enablehistedit = " --config extensions.histedit="
995 help = "hg%s help -e histedit" % enablehistedit
995 help = "hg%s help -e histedit" % enablehistedit
996 msg = _("interactive history editing is supported by the "
996 msg = _("interactive history editing is supported by the "
997 "'histedit' extension (see \"%s\")") % help
997 "'histedit' extension (see \"%s\")") % help
998 raise error.Abort(msg)
998 raise error.Abort(msg)
999
999
1000 if rbsrt.collapsemsg and not rbsrt.collapsef:
1000 if rbsrt.collapsemsg and not rbsrt.collapsef:
1001 raise error.Abort(
1001 raise error.Abort(
1002 _('message can only be specified with collapse'))
1002 _('message can only be specified with collapse'))
1003
1003
1004 if action:
1004 if action:
1005 if rbsrt.collapsef:
1005 if rbsrt.collapsef:
1006 raise error.Abort(
1006 raise error.Abort(
1007 _('cannot use collapse with continue or abort'))
1007 _('cannot use collapse with continue or abort'))
1008 if srcf or basef or destf:
1008 if srcf or basef or destf:
1009 raise error.Abort(
1009 raise error.Abort(
1010 _('abort and continue do not allow specifying revisions'))
1010 _('abort and continue do not allow specifying revisions'))
1011 if action == 'abort' and opts.get('tool', False):
1011 if action == 'abort' and opts.get('tool', False):
1012 ui.warn(_('tool option will be ignored\n'))
1012 ui.warn(_('tool option will be ignored\n'))
1013 if action == 'continue':
1013 if action == 'continue':
1014 ms = mergemod.mergestate.read(repo)
1014 ms = mergemod.mergestate.read(repo)
1015 mergeutil.checkunresolved(ms)
1015 mergeutil.checkunresolved(ms)
1016
1016
1017 retcode = rbsrt._prepareabortorcontinue(isabort=(action == 'abort'))
1017 retcode = rbsrt._prepareabortorcontinue(isabort=(action == 'abort'))
1018 if retcode is not None:
1018 if retcode is not None:
1019 return retcode
1019 return retcode
1020 else:
1020 else:
1021 destmap = _definedestmap(ui, repo, inmemory, destf, srcf, basef,
1021 destmap = _definedestmap(ui, repo, inmemory, destf, srcf, basef,
1022 revf, destspace=destspace)
1022 revf, destspace=destspace)
1023 retcode = rbsrt._preparenewrebase(destmap)
1023 retcode = rbsrt._preparenewrebase(destmap)
1024 if retcode is not None:
1024 if retcode is not None:
1025 return retcode
1025 return retcode
1026 storecollapsemsg(repo, rbsrt.collapsemsg)
1026 storecollapsemsg(repo, rbsrt.collapsemsg)
1027
1027
1028 tr = None
1028 tr = None
1029
1029
1030 singletr = ui.configbool('rebase', 'singletransaction')
1030 singletr = ui.configbool('rebase', 'singletransaction')
1031 if singletr:
1031 if singletr:
1032 tr = repo.transaction('rebase')
1032 tr = repo.transaction('rebase')
1033
1033
1034 # If `rebase.singletransaction` is enabled, wrap the entire operation in
1034 # If `rebase.singletransaction` is enabled, wrap the entire operation in
1035 # one transaction here. Otherwise, transactions are obtained when
1035 # one transaction here. Otherwise, transactions are obtained when
1036 # committing each node, which is slower but allows partial success.
1036 # committing each node, which is slower but allows partial success.
1037 with util.acceptintervention(tr):
1037 with util.acceptintervention(tr):
1038 # Same logic for the dirstate guard, except we don't create one when
1038 # Same logic for the dirstate guard, except we don't create one when
1039 # rebasing in-memory (it's not needed).
1039 # rebasing in-memory (it's not needed).
1040 dsguard = None
1040 dsguard = None
1041 if singletr and not inmemory:
1041 if singletr and not inmemory:
1042 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
1042 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
1043 with util.acceptintervention(dsguard):
1043 with util.acceptintervention(dsguard):
1044 rbsrt._performrebase(tr)
1044 rbsrt._performrebase(tr)
1045 if not leaveunfinished:
1045 if not leaveunfinished:
1046 rbsrt._finishrebase()
1046 rbsrt._finishrebase()
1047
1047
1048 def _definedestmap(ui, repo, inmemory, destf=None, srcf=None, basef=None,
1048 def _definedestmap(ui, repo, inmemory, destf=None, srcf=None, basef=None,
1049 revf=None, destspace=None):
1049 revf=None, destspace=None):
1050 """use revisions argument to define destmap {srcrev: destrev}"""
1050 """use revisions argument to define destmap {srcrev: destrev}"""
1051 if revf is None:
1051 if revf is None:
1052 revf = []
1052 revf = []
1053
1053
1054 # destspace is here to work around issues with `hg pull --rebase` see
1054 # destspace is here to work around issues with `hg pull --rebase` see
1055 # issue5214 for details
1055 # issue5214 for details
1056 if srcf and basef:
1056 if srcf and basef:
1057 raise error.Abort(_('cannot specify both a source and a base'))
1057 raise error.Abort(_('cannot specify both a source and a base'))
1058 if revf and basef:
1058 if revf and basef:
1059 raise error.Abort(_('cannot specify both a revision and a base'))
1059 raise error.Abort(_('cannot specify both a revision and a base'))
1060 if revf and srcf:
1060 if revf and srcf:
1061 raise error.Abort(_('cannot specify both a revision and a source'))
1061 raise error.Abort(_('cannot specify both a revision and a source'))
1062
1062
1063 if not inmemory:
1063 if not inmemory:
1064 cmdutil.checkunfinished(repo)
1064 cmdutil.checkunfinished(repo)
1065 cmdutil.bailifchanged(repo)
1065 cmdutil.bailifchanged(repo)
1066
1066
1067 if ui.configbool('commands', 'rebase.requiredest') and not destf:
1067 if ui.configbool('commands', 'rebase.requiredest') and not destf:
1068 raise error.Abort(_('you must specify a destination'),
1068 raise error.Abort(_('you must specify a destination'),
1069 hint=_('use: hg rebase -d REV'))
1069 hint=_('use: hg rebase -d REV'))
1070
1070
1071 dest = None
1071 dest = None
1072
1072
1073 if revf:
1073 if revf:
1074 rebaseset = scmutil.revrange(repo, revf)
1074 rebaseset = scmutil.revrange(repo, revf)
1075 if not rebaseset:
1075 if not rebaseset:
1076 ui.status(_('empty "rev" revision set - nothing to rebase\n'))
1076 ui.status(_('empty "rev" revision set - nothing to rebase\n'))
1077 return None
1077 return None
1078 elif srcf:
1078 elif srcf:
1079 src = scmutil.revrange(repo, [srcf])
1079 src = scmutil.revrange(repo, [srcf])
1080 if not src:
1080 if not src:
1081 ui.status(_('empty "source" revision set - nothing to rebase\n'))
1081 ui.status(_('empty "source" revision set - nothing to rebase\n'))
1082 return None
1082 return None
1083 rebaseset = repo.revs('(%ld)::', src)
1083 rebaseset = repo.revs('(%ld)::', src)
1084 assert rebaseset
1084 assert rebaseset
1085 else:
1085 else:
1086 base = scmutil.revrange(repo, [basef or '.'])
1086 base = scmutil.revrange(repo, [basef or '.'])
1087 if not base:
1087 if not base:
1088 ui.status(_('empty "base" revision set - '
1088 ui.status(_('empty "base" revision set - '
1089 "can't compute rebase set\n"))
1089 "can't compute rebase set\n"))
1090 return None
1090 return None
1091 if destf:
1091 if destf:
1092 # --base does not support multiple destinations
1092 # --base does not support multiple destinations
1093 dest = scmutil.revsingle(repo, destf)
1093 dest = scmutil.revsingle(repo, destf)
1094 else:
1094 else:
1095 dest = repo[_destrebase(repo, base, destspace=destspace)]
1095 dest = repo[_destrebase(repo, base, destspace=destspace)]
1096 destf = bytes(dest)
1096 destf = bytes(dest)
1097
1097
1098 roots = [] # selected children of branching points
1098 roots = [] # selected children of branching points
1099 bpbase = {} # {branchingpoint: [origbase]}
1099 bpbase = {} # {branchingpoint: [origbase]}
1100 for b in base: # group bases by branching points
1100 for b in base: # group bases by branching points
1101 bp = repo.revs('ancestor(%d, %d)', b, dest.rev()).first()
1101 bp = repo.revs('ancestor(%d, %d)', b, dest.rev()).first()
1102 bpbase[bp] = bpbase.get(bp, []) + [b]
1102 bpbase[bp] = bpbase.get(bp, []) + [b]
1103 if None in bpbase:
1103 if None in bpbase:
1104 # emulate the old behavior, showing "nothing to rebase" (a better
1104 # emulate the old behavior, showing "nothing to rebase" (a better
1105 # behavior may be abort with "cannot find branching point" error)
1105 # behavior may be abort with "cannot find branching point" error)
1106 bpbase.clear()
1106 bpbase.clear()
1107 for bp, bs in bpbase.iteritems(): # calculate roots
1107 for bp, bs in bpbase.iteritems(): # calculate roots
1108 roots += list(repo.revs('children(%d) & ancestors(%ld)', bp, bs))
1108 roots += list(repo.revs('children(%d) & ancestors(%ld)', bp, bs))
1109
1109
1110 rebaseset = repo.revs('%ld::', roots)
1110 rebaseset = repo.revs('%ld::', roots)
1111
1111
1112 if not rebaseset:
1112 if not rebaseset:
1113 # transform to list because smartsets are not comparable to
1113 # transform to list because smartsets are not comparable to
1114 # lists. This should be improved to honor laziness of
1114 # lists. This should be improved to honor laziness of
1115 # smartset.
1115 # smartset.
1116 if list(base) == [dest.rev()]:
1116 if list(base) == [dest.rev()]:
1117 if basef:
1117 if basef:
1118 ui.status(_('nothing to rebase - %s is both "base"'
1118 ui.status(_('nothing to rebase - %s is both "base"'
1119 ' and destination\n') % dest)
1119 ' and destination\n') % dest)
1120 else:
1120 else:
1121 ui.status(_('nothing to rebase - working directory '
1121 ui.status(_('nothing to rebase - working directory '
1122 'parent is also destination\n'))
1122 'parent is also destination\n'))
1123 elif not repo.revs('%ld - ::%d', base, dest.rev()):
1123 elif not repo.revs('%ld - ::%d', base, dest.rev()):
1124 if basef:
1124 if basef:
1125 ui.status(_('nothing to rebase - "base" %s is '
1125 ui.status(_('nothing to rebase - "base" %s is '
1126 'already an ancestor of destination '
1126 'already an ancestor of destination '
1127 '%s\n') %
1127 '%s\n') %
1128 ('+'.join(bytes(repo[r]) for r in base),
1128 ('+'.join(bytes(repo[r]) for r in base),
1129 dest))
1129 dest))
1130 else:
1130 else:
1131 ui.status(_('nothing to rebase - working '
1131 ui.status(_('nothing to rebase - working '
1132 'directory parent is already an '
1132 'directory parent is already an '
1133 'ancestor of destination %s\n') % dest)
1133 'ancestor of destination %s\n') % dest)
1134 else: # can it happen?
1134 else: # can it happen?
1135 ui.status(_('nothing to rebase from %s to %s\n') %
1135 ui.status(_('nothing to rebase from %s to %s\n') %
1136 ('+'.join(bytes(repo[r]) for r in base), dest))
1136 ('+'.join(bytes(repo[r]) for r in base), dest))
1137 return None
1137 return None
1138
1138
1139 rebasingwcp = repo['.'].rev() in rebaseset
1139 rebasingwcp = repo['.'].rev() in rebaseset
1140 ui.log("rebase", "rebasing working copy parent: %r\n", rebasingwcp,
1140 ui.log("rebase", "rebasing working copy parent: %r\n", rebasingwcp,
1141 rebase_rebasing_wcp=rebasingwcp)
1141 rebase_rebasing_wcp=rebasingwcp)
1142 if inmemory and rebasingwcp:
1142 if inmemory and rebasingwcp:
1143 # Check these since we did not before.
1143 # Check these since we did not before.
1144 cmdutil.checkunfinished(repo)
1144 cmdutil.checkunfinished(repo)
1145 cmdutil.bailifchanged(repo)
1145 cmdutil.bailifchanged(repo)
1146
1146
1147 if not destf:
1147 if not destf:
1148 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]
1148 dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]
1149 destf = bytes(dest)
1149 destf = bytes(dest)
1150
1150
1151 allsrc = revsetlang.formatspec('%ld', rebaseset)
1151 allsrc = revsetlang.formatspec('%ld', rebaseset)
1152 alias = {'ALLSRC': allsrc}
1152 alias = {'ALLSRC': allsrc}
1153
1153
1154 if dest is None:
1154 if dest is None:
1155 try:
1155 try:
1156 # fast path: try to resolve dest without SRC alias
1156 # fast path: try to resolve dest without SRC alias
1157 dest = scmutil.revsingle(repo, destf, localalias=alias)
1157 dest = scmutil.revsingle(repo, destf, localalias=alias)
1158 except error.RepoLookupError:
1158 except error.RepoLookupError:
1159 # multi-dest path: resolve dest for each SRC separately
1159 # multi-dest path: resolve dest for each SRC separately
1160 destmap = {}
1160 destmap = {}
1161 for r in rebaseset:
1161 for r in rebaseset:
1162 alias['SRC'] = revsetlang.formatspec('%d', r)
1162 alias['SRC'] = revsetlang.formatspec('%d', r)
1163 # use repo.anyrevs instead of scmutil.revsingle because we
1163 # use repo.anyrevs instead of scmutil.revsingle because we
1164 # don't want to abort if destset is empty.
1164 # don't want to abort if destset is empty.
1165 destset = repo.anyrevs([destf], user=True, localalias=alias)
1165 destset = repo.anyrevs([destf], user=True, localalias=alias)
1166 size = len(destset)
1166 size = len(destset)
1167 if size == 1:
1167 if size == 1:
1168 destmap[r] = destset.first()
1168 destmap[r] = destset.first()
1169 elif size == 0:
1169 elif size == 0:
1170 ui.note(_('skipping %s - empty destination\n') % repo[r])
1170 ui.note(_('skipping %s - empty destination\n') % repo[r])
1171 else:
1171 else:
1172 raise error.Abort(_('rebase destination for %s is not '
1172 raise error.Abort(_('rebase destination for %s is not '
1173 'unique') % repo[r])
1173 'unique') % repo[r])
1174
1174
1175 if dest is not None:
1175 if dest is not None:
1176 # single-dest case: assign dest to each rev in rebaseset
1176 # single-dest case: assign dest to each rev in rebaseset
1177 destrev = dest.rev()
1177 destrev = dest.rev()
1178 destmap = {r: destrev for r in rebaseset} # {srcrev: destrev}
1178 destmap = {r: destrev for r in rebaseset} # {srcrev: destrev}
1179
1179
1180 if not destmap:
1180 if not destmap:
1181 ui.status(_('nothing to rebase - empty destination\n'))
1181 ui.status(_('nothing to rebase - empty destination\n'))
1182 return None
1182 return None
1183
1183
1184 return destmap
1184 return destmap
1185
1185
1186 def externalparent(repo, state, destancestors):
1186 def externalparent(repo, state, destancestors):
1187 """Return the revision that should be used as the second parent
1187 """Return the revision that should be used as the second parent
1188 when the revisions in state is collapsed on top of destancestors.
1188 when the revisions in state is collapsed on top of destancestors.
1189 Abort if there is more than one parent.
1189 Abort if there is more than one parent.
1190 """
1190 """
1191 parents = set()
1191 parents = set()
1192 source = min(state)
1192 source = min(state)
1193 for rev in state:
1193 for rev in state:
1194 if rev == source:
1194 if rev == source:
1195 continue
1195 continue
1196 for p in repo[rev].parents():
1196 for p in repo[rev].parents():
1197 if (p.rev() not in state
1197 if (p.rev() not in state
1198 and p.rev() not in destancestors):
1198 and p.rev() not in destancestors):
1199 parents.add(p.rev())
1199 parents.add(p.rev())
1200 if not parents:
1200 if not parents:
1201 return nullrev
1201 return nullrev
1202 if len(parents) == 1:
1202 if len(parents) == 1:
1203 return parents.pop()
1203 return parents.pop()
1204 raise error.Abort(_('unable to collapse on top of %d, there is more '
1204 raise error.Abort(_('unable to collapse on top of %d, there is more '
1205 'than one external parent: %s') %
1205 'than one external parent: %s') %
1206 (max(destancestors),
1206 (max(destancestors),
1207 ', '.join("%d" % p for p in sorted(parents))))
1207 ', '.join("%d" % p for p in sorted(parents))))
1208
1208
1209 def commitmemorynode(repo, p1, p2, wctx, editor, extra, user, date, commitmsg):
1209 def commitmemorynode(repo, p1, p2, wctx, editor, extra, user, date, commitmsg):
1210 '''Commit the memory changes with parents p1 and p2.
1210 '''Commit the memory changes with parents p1 and p2.
1211 Return node of committed revision.'''
1211 Return node of committed revision.'''
1212 # Replicates the empty check in ``repo.commit``.
1212 # Replicates the empty check in ``repo.commit``.
1213 if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
1213 if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
1214 return None
1214 return None
1215
1215
1216 # By convention, ``extra['branch']`` (set by extrafn) clobbers
1216 # By convention, ``extra['branch']`` (set by extrafn) clobbers
1217 # ``branch`` (used when passing ``--keepbranches``).
1217 # ``branch`` (used when passing ``--keepbranches``).
1218 branch = repo[p1].branch()
1218 branch = repo[p1].branch()
1219 if 'branch' in extra:
1219 if 'branch' in extra:
1220 branch = extra['branch']
1220 branch = extra['branch']
1221
1221
1222 memctx = wctx.tomemctx(commitmsg, parents=(p1, p2), date=date,
1222 memctx = wctx.tomemctx(commitmsg, parents=(p1, p2), date=date,
1223 extra=extra, user=user, branch=branch, editor=editor)
1223 extra=extra, user=user, branch=branch, editor=editor)
1224 commitres = repo.commitctx(memctx)
1224 commitres = repo.commitctx(memctx)
1225 wctx.clean() # Might be reused
1225 wctx.clean() # Might be reused
1226 return commitres
1226 return commitres
1227
1227
1228 def commitnode(repo, p1, p2, editor, extra, user, date, commitmsg):
1228 def commitnode(repo, p1, p2, editor, extra, user, date, commitmsg):
1229 '''Commit the wd changes with parents p1 and p2.
1229 '''Commit the wd changes with parents p1 and p2.
1230 Return node of committed revision.'''
1230 Return node of committed revision.'''
1231 dsguard = util.nullcontextmanager()
1231 dsguard = util.nullcontextmanager()
1232 if not repo.ui.configbool('rebase', 'singletransaction'):
1232 if not repo.ui.configbool('rebase', 'singletransaction'):
1233 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
1233 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
1234 with dsguard:
1234 with dsguard:
1235 repo.setparents(repo[p1].node(), repo[p2].node())
1235 repo.setparents(repo[p1].node(), repo[p2].node())
1236
1236
1237 # Commit might fail if unresolved files exist
1237 # Commit might fail if unresolved files exist
1238 newnode = repo.commit(text=commitmsg, user=user, date=date,
1238 newnode = repo.commit(text=commitmsg, user=user, date=date,
1239 extra=extra, editor=editor)
1239 extra=extra, editor=editor)
1240
1240
1241 repo.dirstate.setbranch(repo[newnode].branch())
1241 repo.dirstate.setbranch(repo[newnode].branch())
1242 return newnode
1242 return newnode
1243
1243
1244 def rebasenode(repo, rev, p1, base, collapse, dest, wctx):
1244 def rebasenode(repo, rev, p1, base, collapse, dest, wctx):
1245 'Rebase a single revision rev on top of p1 using base as merge ancestor'
1245 'Rebase a single revision rev on top of p1 using base as merge ancestor'
1246 # Merge phase
1246 # Merge phase
1247 # Update to destination and merge it with local
1247 # Update to destination and merge it with local
1248 if wctx.isinmemory():
1248 if wctx.isinmemory():
1249 wctx.setbase(repo[p1])
1249 wctx.setbase(repo[p1])
1250 else:
1250 else:
1251 if repo['.'].rev() != p1:
1251 if repo['.'].rev() != p1:
1252 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
1252 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
1253 mergemod.update(repo, p1, branchmerge=False, force=True)
1253 mergemod.update(repo, p1, branchmerge=False, force=True)
1254 else:
1254 else:
1255 repo.ui.debug(" already in destination\n")
1255 repo.ui.debug(" already in destination\n")
1256 # This is, alas, necessary to invalidate workingctx's manifest cache,
1256 # This is, alas, necessary to invalidate workingctx's manifest cache,
1257 # as well as other data we litter on it in other places.
1257 # as well as other data we litter on it in other places.
1258 wctx = repo[None]
1258 wctx = repo[None]
1259 repo.dirstate.write(repo.currenttransaction())
1259 repo.dirstate.write(repo.currenttransaction())
1260 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
1260 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
1261 if base is not None:
1261 if base is not None:
1262 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
1262 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
1263 # When collapsing in-place, the parent is the common ancestor, we
1263 # When collapsing in-place, the parent is the common ancestor, we
1264 # have to allow merging with it.
1264 # have to allow merging with it.
1265 stats = mergemod.update(repo, rev, branchmerge=True, force=True,
1265 stats = mergemod.update(repo, rev, branchmerge=True, force=True,
1266 ancestor=base, mergeancestor=collapse,
1266 ancestor=base, mergeancestor=collapse,
1267 labels=['dest', 'source'], wc=wctx)
1267 labels=['dest', 'source'], wc=wctx)
1268 if collapse:
1268 if collapse:
1269 copies.duplicatecopies(repo, wctx, rev, dest)
1269 copies.duplicatecopies(repo, wctx, rev, dest)
1270 else:
1270 else:
1271 # If we're not using --collapse, we need to
1271 # If we're not using --collapse, we need to
1272 # duplicate copies between the revision we're
1272 # duplicate copies between the revision we're
1273 # rebasing and its first parent, but *not*
1273 # rebasing and its first parent, but *not*
1274 # duplicate any copies that have already been
1274 # duplicate any copies that have already been
1275 # performed in the destination.
1275 # performed in the destination.
1276 p1rev = repo[rev].p1().rev()
1276 p1rev = repo[rev].p1().rev()
1277 copies.duplicatecopies(repo, wctx, rev, p1rev, skiprev=dest)
1277 copies.duplicatecopies(repo, wctx, rev, p1rev, skiprev=dest)
1278 return stats
1278 return stats
1279
1279
1280 def adjustdest(repo, rev, destmap, state, skipped):
1280 def adjustdest(repo, rev, destmap, state, skipped):
1281 """adjust rebase destination given the current rebase state
1281 """adjust rebase destination given the current rebase state
1282
1282
1283 rev is what is being rebased. Return a list of two revs, which are the
1283 rev is what is being rebased. Return a list of two revs, which are the
1284 adjusted destinations for rev's p1 and p2, respectively. If a parent is
1284 adjusted destinations for rev's p1 and p2, respectively. If a parent is
1285 nullrev, return dest without adjustment for it.
1285 nullrev, return dest without adjustment for it.
1286
1286
1287 For example, when doing rebasing B+E to F, C to G, rebase will first move B
1287 For example, when doing rebasing B+E to F, C to G, rebase will first move B
1288 to B1, and E's destination will be adjusted from F to B1.
1288 to B1, and E's destination will be adjusted from F to B1.
1289
1289
1290 B1 <- written during rebasing B
1290 B1 <- written during rebasing B
1291 |
1291 |
1292 F <- original destination of B, E
1292 F <- original destination of B, E
1293 |
1293 |
1294 | E <- rev, which is being rebased
1294 | E <- rev, which is being rebased
1295 | |
1295 | |
1296 | D <- prev, one parent of rev being checked
1296 | D <- prev, one parent of rev being checked
1297 | |
1297 | |
1298 | x <- skipped, ex. no successor or successor in (::dest)
1298 | x <- skipped, ex. no successor or successor in (::dest)
1299 | |
1299 | |
1300 | C <- rebased as C', different destination
1300 | C <- rebased as C', different destination
1301 | |
1301 | |
1302 | B <- rebased as B1 C'
1302 | B <- rebased as B1 C'
1303 |/ |
1303 |/ |
1304 A G <- destination of C, different
1304 A G <- destination of C, different
1305
1305
1306 Another example about merge changeset, rebase -r C+G+H -d K, rebase will
1306 Another example about merge changeset, rebase -r C+G+H -d K, rebase will
1307 first move C to C1, G to G1, and when it's checking H, the adjusted
1307 first move C to C1, G to G1, and when it's checking H, the adjusted
1308 destinations will be [C1, G1].
1308 destinations will be [C1, G1].
1309
1309
1310 H C1 G1
1310 H C1 G1
1311 /| | /
1311 /| | /
1312 F G |/
1312 F G |/
1313 K | | -> K
1313 K | | -> K
1314 | C D |
1314 | C D |
1315 | |/ |
1315 | |/ |
1316 | B | ...
1316 | B | ...
1317 |/ |/
1317 |/ |/
1318 A A
1318 A A
1319
1319
1320 Besides, adjust dest according to existing rebase information. For example,
1320 Besides, adjust dest according to existing rebase information. For example,
1321
1321
1322 B C D B needs to be rebased on top of C, C needs to be rebased on top
1322 B C D B needs to be rebased on top of C, C needs to be rebased on top
1323 \|/ of D. We will rebase C first.
1323 \|/ of D. We will rebase C first.
1324 A
1324 A
1325
1325
1326 C' After rebasing C, when considering B's destination, use C'
1326 C' After rebasing C, when considering B's destination, use C'
1327 | instead of the original C.
1327 | instead of the original C.
1328 B D
1328 B D
1329 \ /
1329 \ /
1330 A
1330 A
1331 """
1331 """
1332 # pick already rebased revs with same dest from state as interesting source
1332 # pick already rebased revs with same dest from state as interesting source
1333 dest = destmap[rev]
1333 dest = destmap[rev]
1334 source = [s for s, d in state.items()
1334 source = [s for s, d in state.items()
1335 if d > 0 and destmap[s] == dest and s not in skipped]
1335 if d > 0 and destmap[s] == dest and s not in skipped]
1336
1336
1337 result = []
1337 result = []
1338 for prev in repo.changelog.parentrevs(rev):
1338 for prev in repo.changelog.parentrevs(rev):
1339 adjusted = dest
1339 adjusted = dest
1340 if prev != nullrev:
1340 if prev != nullrev:
1341 candidate = repo.revs('max(%ld and (::%d))', source, prev).first()
1341 candidate = repo.revs('max(%ld and (::%d))', source, prev).first()
1342 if candidate is not None:
1342 if candidate is not None:
1343 adjusted = state[candidate]
1343 adjusted = state[candidate]
1344 if adjusted == dest and dest in state:
1344 if adjusted == dest and dest in state:
1345 adjusted = state[dest]
1345 adjusted = state[dest]
1346 if adjusted == revtodo:
1346 if adjusted == revtodo:
1347 # sortsource should produce an order that makes this impossible
1347 # sortsource should produce an order that makes this impossible
1348 raise error.ProgrammingError(
1348 raise error.ProgrammingError(
1349 'rev %d should be rebased already at this time' % dest)
1349 'rev %d should be rebased already at this time' % dest)
1350 result.append(adjusted)
1350 result.append(adjusted)
1351 return result
1351 return result
1352
1352
1353 def _checkobsrebase(repo, ui, rebaseobsrevs, rebaseobsskipped):
1353 def _checkobsrebase(repo, ui, rebaseobsrevs, rebaseobsskipped):
1354 """
1354 """
1355 Abort if rebase will create divergence or rebase is noop because of markers
1355 Abort if rebase will create divergence or rebase is noop because of markers
1356
1356
1357 `rebaseobsrevs`: set of obsolete revision in source
1357 `rebaseobsrevs`: set of obsolete revision in source
1358 `rebaseobsskipped`: set of revisions from source skipped because they have
1358 `rebaseobsskipped`: set of revisions from source skipped because they have
1359 successors in destination or no non-obsolete successor.
1359 successors in destination or no non-obsolete successor.
1360 """
1360 """
1361 # Obsolete node with successors not in dest leads to divergence
1361 # Obsolete node with successors not in dest leads to divergence
1362 divergenceok = ui.configbool('experimental',
1362 divergenceok = ui.configbool('experimental',
1363 'evolution.allowdivergence')
1363 'evolution.allowdivergence')
1364 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
1364 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
1365
1365
1366 if divergencebasecandidates and not divergenceok:
1366 if divergencebasecandidates and not divergenceok:
1367 divhashes = (bytes(repo[r])
1367 divhashes = (bytes(repo[r])
1368 for r in divergencebasecandidates)
1368 for r in divergencebasecandidates)
1369 msg = _("this rebase will cause "
1369 msg = _("this rebase will cause "
1370 "divergences from: %s")
1370 "divergences from: %s")
1371 h = _("to force the rebase please set "
1371 h = _("to force the rebase please set "
1372 "experimental.evolution.allowdivergence=True")
1372 "experimental.evolution.allowdivergence=True")
1373 raise error.Abort(msg % (",".join(divhashes),), hint=h)
1373 raise error.Abort(msg % (",".join(divhashes),), hint=h)
1374
1374
1375 def successorrevs(unfi, rev):
1375 def successorrevs(unfi, rev):
1376 """yield revision numbers for successors of rev"""
1376 """yield revision numbers for successors of rev"""
1377 assert unfi.filtername is None
1377 assert unfi.filtername is None
1378 nodemap = unfi.changelog.nodemap
1378 nodemap = unfi.changelog.nodemap
1379 for s in obsutil.allsuccessors(unfi.obsstore, [unfi[rev].node()]):
1379 for s in obsutil.allsuccessors(unfi.obsstore, [unfi[rev].node()]):
1380 if s in nodemap:
1380 if s in nodemap:
1381 yield nodemap[s]
1381 yield nodemap[s]
1382
1382
1383 def defineparents(repo, rev, destmap, state, skipped, obsskipped):
1383 def defineparents(repo, rev, destmap, state, skipped, obsskipped):
1384 """Return new parents and optionally a merge base for rev being rebased
1384 """Return new parents and optionally a merge base for rev being rebased
1385
1385
1386 The destination specified by "dest" cannot always be used directly because
1386 The destination specified by "dest" cannot always be used directly because
1387 previously rebase result could affect destination. For example,
1387 previously rebase result could affect destination. For example,
1388
1388
1389 D E rebase -r C+D+E -d B
1389 D E rebase -r C+D+E -d B
1390 |/ C will be rebased to C'
1390 |/ C will be rebased to C'
1391 B C D's new destination will be C' instead of B
1391 B C D's new destination will be C' instead of B
1392 |/ E's new destination will be C' instead of B
1392 |/ E's new destination will be C' instead of B
1393 A
1393 A
1394
1394
1395 The new parents of a merge is slightly more complicated. See the comment
1395 The new parents of a merge is slightly more complicated. See the comment
1396 block below.
1396 block below.
1397 """
1397 """
1398 # use unfiltered changelog since successorrevs may return filtered nodes
1398 # use unfiltered changelog since successorrevs may return filtered nodes
1399 assert repo.filtername is None
1399 assert repo.filtername is None
1400 cl = repo.changelog
1400 cl = repo.changelog
1401 isancestor = cl.isancestorrev
1401 isancestor = cl.isancestorrev
1402
1402
1403 dest = destmap[rev]
1403 dest = destmap[rev]
1404 oldps = repo.changelog.parentrevs(rev) # old parents
1404 oldps = repo.changelog.parentrevs(rev) # old parents
1405 newps = [nullrev, nullrev] # new parents
1405 newps = [nullrev, nullrev] # new parents
1406 dests = adjustdest(repo, rev, destmap, state, skipped)
1406 dests = adjustdest(repo, rev, destmap, state, skipped)
1407 bases = list(oldps) # merge base candidates, initially just old parents
1407 bases = list(oldps) # merge base candidates, initially just old parents
1408
1408
1409 if all(r == nullrev for r in oldps[1:]):
1409 if all(r == nullrev for r in oldps[1:]):
1410 # For non-merge changeset, just move p to adjusted dest as requested.
1410 # For non-merge changeset, just move p to adjusted dest as requested.
1411 newps[0] = dests[0]
1411 newps[0] = dests[0]
1412 else:
1412 else:
1413 # For merge changeset, if we move p to dests[i] unconditionally, both
1413 # For merge changeset, if we move p to dests[i] unconditionally, both
1414 # parents may change and the end result looks like "the merge loses a
1414 # parents may change and the end result looks like "the merge loses a
1415 # parent", which is a surprise. This is a limit because "--dest" only
1415 # parent", which is a surprise. This is a limit because "--dest" only
1416 # accepts one dest per src.
1416 # accepts one dest per src.
1417 #
1417 #
1418 # Therefore, only move p with reasonable conditions (in this order):
1418 # Therefore, only move p with reasonable conditions (in this order):
1419 # 1. use dest, if dest is a descendent of (p or one of p's successors)
1419 # 1. use dest, if dest is a descendent of (p or one of p's successors)
1420 # 2. use p's rebased result, if p is rebased (state[p] > 0)
1420 # 2. use p's rebased result, if p is rebased (state[p] > 0)
1421 #
1421 #
1422 # Comparing with adjustdest, the logic here does some additional work:
1422 # Comparing with adjustdest, the logic here does some additional work:
1423 # 1. decide which parents will not be moved towards dest
1423 # 1. decide which parents will not be moved towards dest
1424 # 2. if the above decision is "no", should a parent still be moved
1424 # 2. if the above decision is "no", should a parent still be moved
1425 # because it was rebased?
1425 # because it was rebased?
1426 #
1426 #
1427 # For example:
1427 # For example:
1428 #
1428 #
1429 # C # "rebase -r C -d D" is an error since none of the parents
1429 # C # "rebase -r C -d D" is an error since none of the parents
1430 # /| # can be moved. "rebase -r B+C -d D" will move C's parent
1430 # /| # can be moved. "rebase -r B+C -d D" will move C's parent
1431 # A B D # B (using rule "2."), since B will be rebased.
1431 # A B D # B (using rule "2."), since B will be rebased.
1432 #
1432 #
1433 # The loop tries to be not rely on the fact that a Mercurial node has
1433 # The loop tries to be not rely on the fact that a Mercurial node has
1434 # at most 2 parents.
1434 # at most 2 parents.
1435 for i, p in enumerate(oldps):
1435 for i, p in enumerate(oldps):
1436 np = p # new parent
1436 np = p # new parent
1437 if any(isancestor(x, dests[i]) for x in successorrevs(repo, p)):
1437 if any(isancestor(x, dests[i]) for x in successorrevs(repo, p)):
1438 np = dests[i]
1438 np = dests[i]
1439 elif p in state and state[p] > 0:
1439 elif p in state and state[p] > 0:
1440 np = state[p]
1440 np = state[p]
1441
1441
1442 # "bases" only record "special" merge bases that cannot be
1442 # "bases" only record "special" merge bases that cannot be
1443 # calculated from changelog DAG (i.e. isancestor(p, np) is False).
1443 # calculated from changelog DAG (i.e. isancestor(p, np) is False).
1444 # For example:
1444 # For example:
1445 #
1445 #
1446 # B' # rebase -s B -d D, when B was rebased to B'. dest for C
1446 # B' # rebase -s B -d D, when B was rebased to B'. dest for C
1447 # | C # is B', but merge base for C is B, instead of
1447 # | C # is B', but merge base for C is B, instead of
1448 # D | # changelog.ancestor(C, B') == A. If changelog DAG and
1448 # D | # changelog.ancestor(C, B') == A. If changelog DAG and
1449 # | B # "state" edges are merged (so there will be an edge from
1449 # | B # "state" edges are merged (so there will be an edge from
1450 # |/ # B to B'), the merge base is still ancestor(C, B') in
1450 # |/ # B to B'), the merge base is still ancestor(C, B') in
1451 # A # the merged graph.
1451 # A # the merged graph.
1452 #
1452 #
1453 # Also see https://bz.mercurial-scm.org/show_bug.cgi?id=1950#c8
1453 # Also see https://bz.mercurial-scm.org/show_bug.cgi?id=1950#c8
1454 # which uses "virtual null merge" to explain this situation.
1454 # which uses "virtual null merge" to explain this situation.
1455 if isancestor(p, np):
1455 if isancestor(p, np):
1456 bases[i] = nullrev
1456 bases[i] = nullrev
1457
1457
1458 # If one parent becomes an ancestor of the other, drop the ancestor
1458 # If one parent becomes an ancestor of the other, drop the ancestor
1459 for j, x in enumerate(newps[:i]):
1459 for j, x in enumerate(newps[:i]):
1460 if x == nullrev:
1460 if x == nullrev:
1461 continue
1461 continue
1462 if isancestor(np, x): # CASE-1
1462 if isancestor(np, x): # CASE-1
1463 np = nullrev
1463 np = nullrev
1464 elif isancestor(x, np): # CASE-2
1464 elif isancestor(x, np): # CASE-2
1465 newps[j] = np
1465 newps[j] = np
1466 np = nullrev
1466 np = nullrev
1467 # New parents forming an ancestor relationship does not
1467 # New parents forming an ancestor relationship does not
1468 # mean the old parents have a similar relationship. Do not
1468 # mean the old parents have a similar relationship. Do not
1469 # set bases[x] to nullrev.
1469 # set bases[x] to nullrev.
1470 bases[j], bases[i] = bases[i], bases[j]
1470 bases[j], bases[i] = bases[i], bases[j]
1471
1471
1472 newps[i] = np
1472 newps[i] = np
1473
1473
1474 # "rebasenode" updates to new p1, and the old p1 will be used as merge
1474 # "rebasenode" updates to new p1, and the old p1 will be used as merge
1475 # base. If only p2 changes, merging using unchanged p1 as merge base is
1475 # base. If only p2 changes, merging using unchanged p1 as merge base is
1476 # suboptimal. Therefore swap parents to make the merge sane.
1476 # suboptimal. Therefore swap parents to make the merge sane.
1477 if newps[1] != nullrev and oldps[0] == newps[0]:
1477 if newps[1] != nullrev and oldps[0] == newps[0]:
1478 assert len(newps) == 2 and len(oldps) == 2
1478 assert len(newps) == 2 and len(oldps) == 2
1479 newps.reverse()
1479 newps.reverse()
1480 bases.reverse()
1480 bases.reverse()
1481
1481
1482 # No parent change might be an error because we fail to make rev a
1482 # No parent change might be an error because we fail to make rev a
1483 # descendent of requested dest. This can happen, for example:
1483 # descendent of requested dest. This can happen, for example:
1484 #
1484 #
1485 # C # rebase -r C -d D
1485 # C # rebase -r C -d D
1486 # /| # None of A and B will be changed to D and rebase fails.
1486 # /| # None of A and B will be changed to D and rebase fails.
1487 # A B D
1487 # A B D
1488 if set(newps) == set(oldps) and dest not in newps:
1488 if set(newps) == set(oldps) and dest not in newps:
1489 raise error.Abort(_('cannot rebase %d:%s without '
1489 raise error.Abort(_('cannot rebase %d:%s without '
1490 'moving at least one of its parents')
1490 'moving at least one of its parents')
1491 % (rev, repo[rev]))
1491 % (rev, repo[rev]))
1492
1492
1493 # Source should not be ancestor of dest. The check here guarantees it's
1493 # Source should not be ancestor of dest. The check here guarantees it's
1494 # impossible. With multi-dest, the initial check does not cover complex
1494 # impossible. With multi-dest, the initial check does not cover complex
1495 # cases since we don't have abstractions to dry-run rebase cheaply.
1495 # cases since we don't have abstractions to dry-run rebase cheaply.
1496 if any(p != nullrev and isancestor(rev, p) for p in newps):
1496 if any(p != nullrev and isancestor(rev, p) for p in newps):
1497 raise error.Abort(_('source is ancestor of destination'))
1497 raise error.Abort(_('source is ancestor of destination'))
1498
1498
1499 # "rebasenode" updates to new p1, use the corresponding merge base.
1499 # "rebasenode" updates to new p1, use the corresponding merge base.
1500 if bases[0] != nullrev:
1500 if bases[0] != nullrev:
1501 base = bases[0]
1501 base = bases[0]
1502 else:
1502 else:
1503 base = None
1503 base = None
1504
1504
1505 # Check if the merge will contain unwanted changes. That may happen if
1505 # Check if the merge will contain unwanted changes. That may happen if
1506 # there are multiple special (non-changelog ancestor) merge bases, which
1506 # there are multiple special (non-changelog ancestor) merge bases, which
1507 # cannot be handled well by the 3-way merge algorithm. For example:
1507 # cannot be handled well by the 3-way merge algorithm. For example:
1508 #
1508 #
1509 # F
1509 # F
1510 # /|
1510 # /|
1511 # D E # "rebase -r D+E+F -d Z", when rebasing F, if "D" was chosen
1511 # D E # "rebase -r D+E+F -d Z", when rebasing F, if "D" was chosen
1512 # | | # as merge base, the difference between D and F will include
1512 # | | # as merge base, the difference between D and F will include
1513 # B C # C, so the rebased F will contain C surprisingly. If "E" was
1513 # B C # C, so the rebased F will contain C surprisingly. If "E" was
1514 # |/ # chosen, the rebased F will contain B.
1514 # |/ # chosen, the rebased F will contain B.
1515 # A Z
1515 # A Z
1516 #
1516 #
1517 # But our merge base candidates (D and E in above case) could still be
1517 # But our merge base candidates (D and E in above case) could still be
1518 # better than the default (ancestor(F, Z) == null). Therefore still
1518 # better than the default (ancestor(F, Z) == null). Therefore still
1519 # pick one (so choose p1 above).
1519 # pick one (so choose p1 above).
1520 if sum(1 for b in bases if b != nullrev) > 1:
1520 if sum(1 for b in bases if b != nullrev) > 1:
1521 unwanted = [None, None] # unwanted[i]: unwanted revs if choose bases[i]
1521 unwanted = [None, None] # unwanted[i]: unwanted revs if choose bases[i]
1522 for i, base in enumerate(bases):
1522 for i, base in enumerate(bases):
1523 if base == nullrev:
1523 if base == nullrev:
1524 continue
1524 continue
1525 # Revisions in the side (not chosen as merge base) branch that
1525 # Revisions in the side (not chosen as merge base) branch that
1526 # might contain "surprising" contents
1526 # might contain "surprising" contents
1527 siderevs = list(repo.revs('((%ld-%d) %% (%d+%d))',
1527 siderevs = list(repo.revs('((%ld-%d) %% (%d+%d))',
1528 bases, base, base, dest))
1528 bases, base, base, dest))
1529
1529
1530 # If those revisions are covered by rebaseset, the result is good.
1530 # If those revisions are covered by rebaseset, the result is good.
1531 # A merge in rebaseset would be considered to cover its ancestors.
1531 # A merge in rebaseset would be considered to cover its ancestors.
1532 if siderevs:
1532 if siderevs:
1533 rebaseset = [r for r, d in state.items()
1533 rebaseset = [r for r, d in state.items()
1534 if d > 0 and r not in obsskipped]
1534 if d > 0 and r not in obsskipped]
1535 merges = [r for r in rebaseset
1535 merges = [r for r in rebaseset
1536 if cl.parentrevs(r)[1] != nullrev]
1536 if cl.parentrevs(r)[1] != nullrev]
1537 unwanted[i] = list(repo.revs('%ld - (::%ld) - %ld',
1537 unwanted[i] = list(repo.revs('%ld - (::%ld) - %ld',
1538 siderevs, merges, rebaseset))
1538 siderevs, merges, rebaseset))
1539
1539
1540 # Choose a merge base that has a minimal number of unwanted revs.
1540 # Choose a merge base that has a minimal number of unwanted revs.
1541 l, i = min((len(revs), i)
1541 l, i = min((len(revs), i)
1542 for i, revs in enumerate(unwanted) if revs is not None)
1542 for i, revs in enumerate(unwanted) if revs is not None)
1543 base = bases[i]
1543 base = bases[i]
1544
1544
1545 # newps[0] should match merge base if possible. Currently, if newps[i]
1545 # newps[0] should match merge base if possible. Currently, if newps[i]
1546 # is nullrev, the only case is newps[i] and newps[j] (j < i), one is
1546 # is nullrev, the only case is newps[i] and newps[j] (j < i), one is
1547 # the other's ancestor. In that case, it's fine to not swap newps here.
1547 # the other's ancestor. In that case, it's fine to not swap newps here.
1548 # (see CASE-1 and CASE-2 above)
1548 # (see CASE-1 and CASE-2 above)
1549 if i != 0 and newps[i] != nullrev:
1549 if i != 0 and newps[i] != nullrev:
1550 newps[0], newps[i] = newps[i], newps[0]
1550 newps[0], newps[i] = newps[i], newps[0]
1551
1551
1552 # The merge will include unwanted revisions. Abort now. Revisit this if
1552 # The merge will include unwanted revisions. Abort now. Revisit this if
1553 # we have a more advanced merge algorithm that handles multiple bases.
1553 # we have a more advanced merge algorithm that handles multiple bases.
1554 if l > 0:
1554 if l > 0:
1555 unwanteddesc = _(' or ').join(
1555 unwanteddesc = _(' or ').join(
1556 (', '.join('%d:%s' % (r, repo[r]) for r in revs)
1556 (', '.join('%d:%s' % (r, repo[r]) for r in revs)
1557 for revs in unwanted if revs is not None))
1557 for revs in unwanted if revs is not None))
1558 raise error.Abort(
1558 raise error.Abort(
1559 _('rebasing %d:%s will include unwanted changes from %s')
1559 _('rebasing %d:%s will include unwanted changes from %s')
1560 % (rev, repo[rev], unwanteddesc))
1560 % (rev, repo[rev], unwanteddesc))
1561
1561
1562 repo.ui.debug(" future parents are %d and %d\n" % tuple(newps))
1562 repo.ui.debug(" future parents are %d and %d\n" % tuple(newps))
1563
1563
1564 return newps[0], newps[1], base
1564 return newps[0], newps[1], base
1565
1565
1566 def isagitpatch(repo, patchname):
1566 def isagitpatch(repo, patchname):
1567 'Return true if the given patch is in git format'
1567 'Return true if the given patch is in git format'
1568 mqpatch = os.path.join(repo.mq.path, patchname)
1568 mqpatch = os.path.join(repo.mq.path, patchname)
1569 for line in patch.linereader(open(mqpatch, 'rb')):
1569 for line in patch.linereader(open(mqpatch, 'rb')):
1570 if line.startswith('diff --git'):
1570 if line.startswith('diff --git'):
1571 return True
1571 return True
1572 return False
1572 return False
1573
1573
1574 def updatemq(repo, state, skipped, **opts):
1574 def updatemq(repo, state, skipped, **opts):
1575 'Update rebased mq patches - finalize and then import them'
1575 'Update rebased mq patches - finalize and then import them'
1576 mqrebase = {}
1576 mqrebase = {}
1577 mq = repo.mq
1577 mq = repo.mq
1578 original_series = mq.fullseries[:]
1578 original_series = mq.fullseries[:]
1579 skippedpatches = set()
1579 skippedpatches = set()
1580
1580
1581 for p in mq.applied:
1581 for p in mq.applied:
1582 rev = repo[p.node].rev()
1582 rev = repo[p.node].rev()
1583 if rev in state:
1583 if rev in state:
1584 repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' %
1584 repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' %
1585 (rev, p.name))
1585 (rev, p.name))
1586 mqrebase[rev] = (p.name, isagitpatch(repo, p.name))
1586 mqrebase[rev] = (p.name, isagitpatch(repo, p.name))
1587 else:
1587 else:
1588 # Applied but not rebased, not sure this should happen
1588 # Applied but not rebased, not sure this should happen
1589 skippedpatches.add(p.name)
1589 skippedpatches.add(p.name)
1590
1590
1591 if mqrebase:
1591 if mqrebase:
1592 mq.finish(repo, mqrebase.keys())
1592 mq.finish(repo, mqrebase.keys())
1593
1593
1594 # We must start import from the newest revision
1594 # We must start import from the newest revision
1595 for rev in sorted(mqrebase, reverse=True):
1595 for rev in sorted(mqrebase, reverse=True):
1596 if rev not in skipped:
1596 if rev not in skipped:
1597 name, isgit = mqrebase[rev]
1597 name, isgit = mqrebase[rev]
1598 repo.ui.note(_('updating mq patch %s to %d:%s\n') %
1598 repo.ui.note(_('updating mq patch %s to %d:%s\n') %
1599 (name, state[rev], repo[state[rev]]))
1599 (name, state[rev], repo[state[rev]]))
1600 mq.qimport(repo, (), patchname=name, git=isgit,
1600 mq.qimport(repo, (), patchname=name, git=isgit,
1601 rev=["%d" % state[rev]])
1601 rev=["%d" % state[rev]])
1602 else:
1602 else:
1603 # Rebased and skipped
1603 # Rebased and skipped
1604 skippedpatches.add(mqrebase[rev][0])
1604 skippedpatches.add(mqrebase[rev][0])
1605
1605
1606 # Patches were either applied and rebased and imported in
1606 # Patches were either applied and rebased and imported in
1607 # order, applied and removed or unapplied. Discard the removed
1607 # order, applied and removed or unapplied. Discard the removed
1608 # ones while preserving the original series order and guards.
1608 # ones while preserving the original series order and guards.
1609 newseries = [s for s in original_series
1609 newseries = [s for s in original_series
1610 if mq.guard_re.split(s, 1)[0] not in skippedpatches]
1610 if mq.guard_re.split(s, 1)[0] not in skippedpatches]
1611 mq.fullseries[:] = newseries
1611 mq.fullseries[:] = newseries
1612 mq.seriesdirty = True
1612 mq.seriesdirty = True
1613 mq.savedirty()
1613 mq.savedirty()
1614
1614
1615 def storecollapsemsg(repo, collapsemsg):
1615 def storecollapsemsg(repo, collapsemsg):
1616 'Store the collapse message to allow recovery'
1616 'Store the collapse message to allow recovery'
1617 collapsemsg = collapsemsg or ''
1617 collapsemsg = collapsemsg or ''
1618 f = repo.vfs("last-message.txt", "w")
1618 f = repo.vfs("last-message.txt", "w")
1619 f.write("%s\n" % collapsemsg)
1619 f.write("%s\n" % collapsemsg)
1620 f.close()
1620 f.close()
1621
1621
1622 def clearcollapsemsg(repo):
1622 def clearcollapsemsg(repo):
1623 'Remove collapse message file'
1623 'Remove collapse message file'
1624 repo.vfs.unlinkpath("last-message.txt", ignoremissing=True)
1624 repo.vfs.unlinkpath("last-message.txt", ignoremissing=True)
1625
1625
1626 def restorecollapsemsg(repo, isabort):
1626 def restorecollapsemsg(repo, isabort):
1627 'Restore previously stored collapse message'
1627 'Restore previously stored collapse message'
1628 try:
1628 try:
1629 f = repo.vfs("last-message.txt")
1629 f = repo.vfs("last-message.txt")
1630 collapsemsg = f.readline().strip()
1630 collapsemsg = f.readline().strip()
1631 f.close()
1631 f.close()
1632 except IOError as err:
1632 except IOError as err:
1633 if err.errno != errno.ENOENT:
1633 if err.errno != errno.ENOENT:
1634 raise
1634 raise
1635 if isabort:
1635 if isabort:
1636 # Oh well, just abort like normal
1636 # Oh well, just abort like normal
1637 collapsemsg = ''
1637 collapsemsg = ''
1638 else:
1638 else:
1639 raise error.Abort(_('missing .hg/last-message.txt for rebase'))
1639 raise error.Abort(_('missing .hg/last-message.txt for rebase'))
1640 return collapsemsg
1640 return collapsemsg
1641
1641
1642 def clearstatus(repo):
1642 def clearstatus(repo):
1643 'Remove the status files'
1643 'Remove the status files'
1644 # Make sure the active transaction won't write the state file
1644 # Make sure the active transaction won't write the state file
1645 tr = repo.currenttransaction()
1645 tr = repo.currenttransaction()
1646 if tr:
1646 if tr:
1647 tr.removefilegenerator('rebasestate')
1647 tr.removefilegenerator('rebasestate')
1648 repo.vfs.unlinkpath("rebasestate", ignoremissing=True)
1648 repo.vfs.unlinkpath("rebasestate", ignoremissing=True)
1649
1649
1650 def needupdate(repo, state):
1650 def needupdate(repo, state):
1651 '''check whether we should `update --clean` away from a merge, or if
1651 '''check whether we should `update --clean` away from a merge, or if
1652 somehow the working dir got forcibly updated, e.g. by older hg'''
1652 somehow the working dir got forcibly updated, e.g. by older hg'''
1653 parents = [p.rev() for p in repo[None].parents()]
1653 parents = [p.rev() for p in repo[None].parents()]
1654
1654
1655 # Are we in a merge state at all?
1655 # Are we in a merge state at all?
1656 if len(parents) < 2:
1656 if len(parents) < 2:
1657 return False
1657 return False
1658
1658
1659 # We should be standing on the first as-of-yet unrebased commit.
1659 # We should be standing on the first as-of-yet unrebased commit.
1660 firstunrebased = min([old for old, new in state.iteritems()
1660 firstunrebased = min([old for old, new in state.iteritems()
1661 if new == nullrev])
1661 if new == nullrev])
1662 if firstunrebased in parents:
1662 if firstunrebased in parents:
1663 return True
1663 return True
1664
1664
1665 return False
1665 return False
1666
1666
1667 def sortsource(destmap):
1667 def sortsource(destmap):
1668 """yield source revisions in an order that we only rebase things once
1668 """yield source revisions in an order that we only rebase things once
1669
1669
1670 If source and destination overlaps, we should filter out revisions
1670 If source and destination overlaps, we should filter out revisions
1671 depending on other revisions which hasn't been rebased yet.
1671 depending on other revisions which hasn't been rebased yet.
1672
1672
1673 Yield a sorted list of revisions each time.
1673 Yield a sorted list of revisions each time.
1674
1674
1675 For example, when rebasing A to B, B to C. This function yields [B], then
1675 For example, when rebasing A to B, B to C. This function yields [B], then
1676 [A], indicating B needs to be rebased first.
1676 [A], indicating B needs to be rebased first.
1677
1677
1678 Raise if there is a cycle so the rebase is impossible.
1678 Raise if there is a cycle so the rebase is impossible.
1679 """
1679 """
1680 srcset = set(destmap)
1680 srcset = set(destmap)
1681 while srcset:
1681 while srcset:
1682 srclist = sorted(srcset)
1682 srclist = sorted(srcset)
1683 result = []
1683 result = []
1684 for r in srclist:
1684 for r in srclist:
1685 if destmap[r] not in srcset:
1685 if destmap[r] not in srcset:
1686 result.append(r)
1686 result.append(r)
1687 if not result:
1687 if not result:
1688 raise error.Abort(_('source and destination form a cycle'))
1688 raise error.Abort(_('source and destination form a cycle'))
1689 srcset -= set(result)
1689 srcset -= set(result)
1690 yield result
1690 yield result
1691
1691
1692 def buildstate(repo, destmap, collapse):
1692 def buildstate(repo, destmap, collapse):
1693 '''Define which revisions are going to be rebased and where
1693 '''Define which revisions are going to be rebased and where
1694
1694
1695 repo: repo
1695 repo: repo
1696 destmap: {srcrev: destrev}
1696 destmap: {srcrev: destrev}
1697 '''
1697 '''
1698 rebaseset = destmap.keys()
1698 rebaseset = destmap.keys()
1699 originalwd = repo['.'].rev()
1699 originalwd = repo['.'].rev()
1700
1700
1701 # This check isn't strictly necessary, since mq detects commits over an
1701 # This check isn't strictly necessary, since mq detects commits over an
1702 # applied patch. But it prevents messing up the working directory when
1702 # applied patch. But it prevents messing up the working directory when
1703 # a partially completed rebase is blocked by mq.
1703 # a partially completed rebase is blocked by mq.
1704 if 'qtip' in repo.tags():
1704 if 'qtip' in repo.tags():
1705 mqapplied = set(repo[s.node].rev() for s in repo.mq.applied)
1705 mqapplied = set(repo[s.node].rev() for s in repo.mq.applied)
1706 if set(destmap.values()) & mqapplied:
1706 if set(destmap.values()) & mqapplied:
1707 raise error.Abort(_('cannot rebase onto an applied mq patch'))
1707 raise error.Abort(_('cannot rebase onto an applied mq patch'))
1708
1708
1709 # Get "cycle" error early by exhausting the generator.
1709 # Get "cycle" error early by exhausting the generator.
1710 sortedsrc = list(sortsource(destmap)) # a list of sorted revs
1710 sortedsrc = list(sortsource(destmap)) # a list of sorted revs
1711 if not sortedsrc:
1711 if not sortedsrc:
1712 raise error.Abort(_('no matching revisions'))
1712 raise error.Abort(_('no matching revisions'))
1713
1713
1714 # Only check the first batch of revisions to rebase not depending on other
1714 # Only check the first batch of revisions to rebase not depending on other
1715 # rebaseset. This means "source is ancestor of destination" for the second
1715 # rebaseset. This means "source is ancestor of destination" for the second
1716 # (and following) batches of revisions are not checked here. We rely on
1716 # (and following) batches of revisions are not checked here. We rely on
1717 # "defineparents" to do that check.
1717 # "defineparents" to do that check.
1718 roots = list(repo.set('roots(%ld)', sortedsrc[0]))
1718 roots = list(repo.set('roots(%ld)', sortedsrc[0]))
1719 if not roots:
1719 if not roots:
1720 raise error.Abort(_('no matching revisions'))
1720 raise error.Abort(_('no matching revisions'))
1721 def revof(r):
1721 def revof(r):
1722 return r.rev()
1722 return r.rev()
1723 roots = sorted(roots, key=revof)
1723 roots = sorted(roots, key=revof)
1724 state = dict.fromkeys(rebaseset, revtodo)
1724 state = dict.fromkeys(rebaseset, revtodo)
1725 emptyrebase = (len(sortedsrc) == 1)
1725 emptyrebase = (len(sortedsrc) == 1)
1726 for root in roots:
1726 for root in roots:
1727 dest = repo[destmap[root.rev()]]
1727 dest = repo[destmap[root.rev()]]
1728 commonbase = root.ancestor(dest)
1728 commonbase = root.ancestor(dest)
1729 if commonbase == root:
1729 if commonbase == root:
1730 raise error.Abort(_('source is ancestor of destination'))
1730 raise error.Abort(_('source is ancestor of destination'))
1731 if commonbase == dest:
1731 if commonbase == dest:
1732 wctx = repo[None]
1732 wctx = repo[None]
1733 if dest == wctx.p1():
1733 if dest == wctx.p1():
1734 # when rebasing to '.', it will use the current wd branch name
1734 # when rebasing to '.', it will use the current wd branch name
1735 samebranch = root.branch() == wctx.branch()
1735 samebranch = root.branch() == wctx.branch()
1736 else:
1736 else:
1737 samebranch = root.branch() == dest.branch()
1737 samebranch = root.branch() == dest.branch()
1738 if not collapse and samebranch and dest in root.parents():
1738 if not collapse and samebranch and dest in root.parents():
1739 # mark the revision as done by setting its new revision
1739 # mark the revision as done by setting its new revision
1740 # equal to its old (current) revisions
1740 # equal to its old (current) revisions
1741 state[root.rev()] = root.rev()
1741 state[root.rev()] = root.rev()
1742 repo.ui.debug('source is a child of destination\n')
1742 repo.ui.debug('source is a child of destination\n')
1743 continue
1743 continue
1744
1744
1745 emptyrebase = False
1745 emptyrebase = False
1746 repo.ui.debug('rebase onto %s starting from %s\n' % (dest, root))
1746 repo.ui.debug('rebase onto %s starting from %s\n' % (dest, root))
1747 if emptyrebase:
1747 if emptyrebase:
1748 return None
1748 return None
1749 for rev in sorted(state):
1749 for rev in sorted(state):
1750 parents = [p for p in repo.changelog.parentrevs(rev) if p != nullrev]
1750 parents = [p for p in repo.changelog.parentrevs(rev) if p != nullrev]
1751 # if all parents of this revision are done, then so is this revision
1751 # if all parents of this revision are done, then so is this revision
1752 if parents and all((state.get(p) == p for p in parents)):
1752 if parents and all((state.get(p) == p for p in parents)):
1753 state[rev] = rev
1753 state[rev] = rev
1754 return originalwd, destmap, state
1754 return originalwd, destmap, state
1755
1755
1756 def clearrebased(ui, repo, destmap, state, skipped, collapsedas=None,
1756 def clearrebased(ui, repo, destmap, state, skipped, collapsedas=None,
1757 keepf=False, fm=None, backup=True):
1757 keepf=False, fm=None, backup=True):
1758 """dispose of rebased revision at the end of the rebase
1758 """dispose of rebased revision at the end of the rebase
1759
1759
1760 If `collapsedas` is not None, the rebase was a collapse whose result if the
1760 If `collapsedas` is not None, the rebase was a collapse whose result if the
1761 `collapsedas` node.
1761 `collapsedas` node.
1762
1762
1763 If `keepf` is not True, the rebase has --keep set and no nodes should be
1763 If `keepf` is not True, the rebase has --keep set and no nodes should be
1764 removed (but bookmarks still need to be moved).
1764 removed (but bookmarks still need to be moved).
1765
1765
1766 If `backup` is False, no backup will be stored when stripping rebased
1766 If `backup` is False, no backup will be stored when stripping rebased
1767 revisions.
1767 revisions.
1768 """
1768 """
1769 tonode = repo.changelog.node
1769 tonode = repo.changelog.node
1770 replacements = {}
1770 replacements = {}
1771 moves = {}
1771 moves = {}
1772 stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt)
1772 stripcleanup = not obsolete.isenabled(repo, obsolete.createmarkersopt)
1773
1773
1774 collapsednodes = []
1774 collapsednodes = []
1775 for rev, newrev in sorted(state.items()):
1775 for rev, newrev in sorted(state.items()):
1776 if newrev >= 0 and newrev != rev:
1776 if newrev >= 0 and newrev != rev:
1777 oldnode = tonode(rev)
1777 oldnode = tonode(rev)
1778 newnode = collapsedas or tonode(newrev)
1778 newnode = collapsedas or tonode(newrev)
1779 moves[oldnode] = newnode
1779 moves[oldnode] = newnode
1780 if not keepf:
1780 if not keepf:
1781 succs = None
1781 succs = None
1782 if rev in skipped:
1782 if rev in skipped:
1783 if stripcleanup or not repo[rev].obsolete():
1783 if stripcleanup or not repo[rev].obsolete():
1784 succs = ()
1784 succs = ()
1785 elif collapsedas:
1785 elif collapsedas:
1786 collapsednodes.append(oldnode)
1786 collapsednodes.append(oldnode)
1787 else:
1787 else:
1788 succs = (newnode,)
1788 succs = (newnode,)
1789 if succs is not None:
1789 if succs is not None:
1790 replacements[(oldnode,)] = succs
1790 replacements[(oldnode,)] = succs
1791 if collapsednodes:
1791 if collapsednodes:
1792 replacements[tuple(collapsednodes)] = (collapsedas,)
1792 replacements[tuple(collapsednodes)] = (collapsedas,)
1793 scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup)
1793 scmutil.cleanupnodes(repo, replacements, 'rebase', moves, backup=backup)
1794 if fm:
1794 if fm:
1795 hf = fm.hexfunc
1795 hf = fm.hexfunc
1796 fl = fm.formatlist
1796 fl = fm.formatlist
1797 fd = fm.formatdict
1797 fd = fm.formatdict
1798 changes = {}
1798 changes = {}
1799 for oldns, newn in replacements.iteritems():
1799 for oldns, newn in replacements.iteritems():
1800 for oldn in oldns:
1800 for oldn in oldns:
1801 changes[hf(oldn)] = fl([hf(n) for n in newn], name='node')
1801 changes[hf(oldn)] = fl([hf(n) for n in newn], name='node')
1802 nodechanges = fd(changes, key="oldnode", value="newnodes")
1802 nodechanges = fd(changes, key="oldnode", value="newnodes")
1803 fm.data(nodechanges=nodechanges)
1803 fm.data(nodechanges=nodechanges)
1804
1804
1805 def pullrebase(orig, ui, repo, *args, **opts):
1805 def pullrebase(orig, ui, repo, *args, **opts):
1806 'Call rebase after pull if the latter has been invoked with --rebase'
1806 'Call rebase after pull if the latter has been invoked with --rebase'
1807 ret = None
1807 ret = None
1808 if opts.get(r'rebase'):
1808 if opts.get(r'rebase'):
1809 if ui.configbool('commands', 'rebase.requiredest'):
1809 if ui.configbool('commands', 'rebase.requiredest'):
1810 msg = _('rebase destination required by configuration')
1810 msg = _('rebase destination required by configuration')
1811 hint = _('use hg pull followed by hg rebase -d DEST')
1811 hint = _('use hg pull followed by hg rebase -d DEST')
1812 raise error.Abort(msg, hint=hint)
1812 raise error.Abort(msg, hint=hint)
1813
1813
1814 with repo.wlock(), repo.lock():
1814 with repo.wlock(), repo.lock():
1815 if opts.get(r'update'):
1815 if opts.get(r'update'):
1816 del opts[r'update']
1816 del opts[r'update']
1817 ui.debug('--update and --rebase are not compatible, ignoring '
1817 ui.debug('--update and --rebase are not compatible, ignoring '
1818 'the update flag\n')
1818 'the update flag\n')
1819
1819
1820 cmdutil.checkunfinished(repo)
1820 cmdutil.checkunfinished(repo)
1821 cmdutil.bailifchanged(repo, hint=_('cannot pull with rebase: '
1821 cmdutil.bailifchanged(repo, hint=_('cannot pull with rebase: '
1822 'please commit or shelve your changes first'))
1822 'please commit or shelve your changes first'))
1823
1823
1824 revsprepull = len(repo)
1824 revsprepull = len(repo)
1825 origpostincoming = commands.postincoming
1825 origpostincoming = commands.postincoming
1826 def _dummy(*args, **kwargs):
1826 def _dummy(*args, **kwargs):
1827 pass
1827 pass
1828 commands.postincoming = _dummy
1828 commands.postincoming = _dummy
1829 try:
1829 try:
1830 ret = orig(ui, repo, *args, **opts)
1830 ret = orig(ui, repo, *args, **opts)
1831 finally:
1831 finally:
1832 commands.postincoming = origpostincoming
1832 commands.postincoming = origpostincoming
1833 revspostpull = len(repo)
1833 revspostpull = len(repo)
1834 if revspostpull > revsprepull:
1834 if revspostpull > revsprepull:
1835 # --rev option from pull conflict with rebase own --rev
1835 # --rev option from pull conflict with rebase own --rev
1836 # dropping it
1836 # dropping it
1837 if r'rev' in opts:
1837 if r'rev' in opts:
1838 del opts[r'rev']
1838 del opts[r'rev']
1839 # positional argument from pull conflicts with rebase's own
1839 # positional argument from pull conflicts with rebase's own
1840 # --source.
1840 # --source.
1841 if r'source' in opts:
1841 if r'source' in opts:
1842 del opts[r'source']
1842 del opts[r'source']
1843 # revsprepull is the len of the repo, not revnum of tip.
1843 # revsprepull is the len of the repo, not revnum of tip.
1844 destspace = list(repo.changelog.revs(start=revsprepull))
1844 destspace = list(repo.changelog.revs(start=revsprepull))
1845 opts[r'_destspace'] = destspace
1845 opts[r'_destspace'] = destspace
1846 try:
1846 try:
1847 rebase(ui, repo, **opts)
1847 rebase(ui, repo, **opts)
1848 except error.NoMergeDestAbort:
1848 except error.NoMergeDestAbort:
1849 # we can maybe update instead
1849 # we can maybe update instead
1850 rev, _a, _b = destutil.destupdate(repo)
1850 rev, _a, _b = destutil.destupdate(repo)
1851 if rev == repo['.'].rev():
1851 if rev == repo['.'].rev():
1852 ui.status(_('nothing to rebase\n'))
1852 ui.status(_('nothing to rebase\n'))
1853 else:
1853 else:
1854 ui.status(_('nothing to rebase - updating instead\n'))
1854 ui.status(_('nothing to rebase - updating instead\n'))
1855 # not passing argument to get the bare update behavior
1855 # not passing argument to get the bare update behavior
1856 # with warning and trumpets
1856 # with warning and trumpets
1857 commands.update(ui, repo)
1857 commands.update(ui, repo)
1858 else:
1858 else:
1859 if opts.get(r'tool'):
1859 if opts.get(r'tool'):
1860 raise error.Abort(_('--tool can only be used with --rebase'))
1860 raise error.Abort(_('--tool can only be used with --rebase'))
1861 ret = orig(ui, repo, *args, **opts)
1861 ret = orig(ui, repo, *args, **opts)
1862
1862
1863 return ret
1863 return ret
1864
1864
1865 def _filterobsoleterevs(repo, revs):
1865 def _filterobsoleterevs(repo, revs):
1866 """returns a set of the obsolete revisions in revs"""
1866 """returns a set of the obsolete revisions in revs"""
1867 return set(r for r in revs if repo[r].obsolete())
1867 return set(r for r in revs if repo[r].obsolete())
1868
1868
1869 def _computeobsoletenotrebased(repo, rebaseobsrevs, destmap):
1869 def _computeobsoletenotrebased(repo, rebaseobsrevs, destmap):
1870 """Return (obsoletenotrebased, obsoletewithoutsuccessorindestination).
1870 """Return (obsoletenotrebased, obsoletewithoutsuccessorindestination).
1871
1871
1872 `obsoletenotrebased` is a mapping mapping obsolete => successor for all
1872 `obsoletenotrebased` is a mapping mapping obsolete => successor for all
1873 obsolete nodes to be rebased given in `rebaseobsrevs`.
1873 obsolete nodes to be rebased given in `rebaseobsrevs`.
1874
1874
1875 `obsoletewithoutsuccessorindestination` is a set with obsolete revisions
1875 `obsoletewithoutsuccessorindestination` is a set with obsolete revisions
1876 without a successor in destination.
1876 without a successor in destination.
1877
1877
1878 `obsoleteextinctsuccessors` is a set of obsolete revisions with only
1878 `obsoleteextinctsuccessors` is a set of obsolete revisions with only
1879 obsolete successors.
1879 obsolete successors.
1880 """
1880 """
1881 obsoletenotrebased = {}
1881 obsoletenotrebased = {}
1882 obsoletewithoutsuccessorindestination = set([])
1882 obsoletewithoutsuccessorindestination = set([])
1883 obsoleteextinctsuccessors = set([])
1883 obsoleteextinctsuccessors = set([])
1884
1884
1885 assert repo.filtername is None
1885 assert repo.filtername is None
1886 cl = repo.changelog
1886 cl = repo.changelog
1887 nodemap = cl.nodemap
1887 nodemap = cl.nodemap
1888 extinctrevs = set(repo.revs('extinct()'))
1888 extinctrevs = set(repo.revs('extinct()'))
1889 for srcrev in rebaseobsrevs:
1889 for srcrev in rebaseobsrevs:
1890 srcnode = cl.node(srcrev)
1890 srcnode = cl.node(srcrev)
1891 # XXX: more advanced APIs are required to handle split correctly
1891 # XXX: more advanced APIs are required to handle split correctly
1892 successors = set(obsutil.allsuccessors(repo.obsstore, [srcnode]))
1892 successors = set(obsutil.allsuccessors(repo.obsstore, [srcnode]))
1893 # obsutil.allsuccessors includes node itself
1893 # obsutil.allsuccessors includes node itself
1894 successors.remove(srcnode)
1894 successors.remove(srcnode)
1895 succrevs = {nodemap[s] for s in successors if s in nodemap}
1895 succrevs = {nodemap[s] for s in successors if s in nodemap}
1896 if succrevs.issubset(extinctrevs):
1896 if succrevs.issubset(extinctrevs):
1897 # all successors are extinct
1897 # all successors are extinct
1898 obsoleteextinctsuccessors.add(srcrev)
1898 obsoleteextinctsuccessors.add(srcrev)
1899 if not successors:
1899 if not successors:
1900 # no successor
1900 # no successor
1901 obsoletenotrebased[srcrev] = None
1901 obsoletenotrebased[srcrev] = None
1902 else:
1902 else:
1903 dstrev = destmap[srcrev]
1903 dstrev = destmap[srcrev]
1904 for succrev in succrevs:
1904 for succrev in succrevs:
1905 if cl.isancestorrev(succrev, dstrev):
1905 if cl.isancestorrev(succrev, dstrev):
1906 obsoletenotrebased[srcrev] = succrev
1906 obsoletenotrebased[srcrev] = succrev
1907 break
1907 break
1908 else:
1908 else:
1909 # If 'srcrev' has a successor in rebase set but none in
1909 # If 'srcrev' has a successor in rebase set but none in
1910 # destination (which would be catched above), we shall skip it
1910 # destination (which would be catched above), we shall skip it
1911 # and its descendants to avoid divergence.
1911 # and its descendants to avoid divergence.
1912 if srcrev in extinctrevs or any(s in destmap for s in succrevs):
1912 if srcrev in extinctrevs or any(s in destmap for s in succrevs):
1913 obsoletewithoutsuccessorindestination.add(srcrev)
1913 obsoletewithoutsuccessorindestination.add(srcrev)
1914
1914
1915 return (
1915 return (
1916 obsoletenotrebased,
1916 obsoletenotrebased,
1917 obsoletewithoutsuccessorindestination,
1917 obsoletewithoutsuccessorindestination,
1918 obsoleteextinctsuccessors,
1918 obsoleteextinctsuccessors,
1919 )
1919 )
1920
1920
1921 def summaryhook(ui, repo):
1921 def summaryhook(ui, repo):
1922 if not repo.vfs.exists('rebasestate'):
1922 if not repo.vfs.exists('rebasestate'):
1923 return
1923 return
1924 try:
1924 try:
1925 rbsrt = rebaseruntime(repo, ui, {})
1925 rbsrt = rebaseruntime(repo, ui, {})
1926 rbsrt.restorestatus()
1926 rbsrt.restorestatus()
1927 state = rbsrt.state
1927 state = rbsrt.state
1928 except error.RepoLookupError:
1928 except error.RepoLookupError:
1929 # i18n: column positioning for "hg summary"
1929 # i18n: column positioning for "hg summary"
1930 msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n')
1930 msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n')
1931 ui.write(msg)
1931 ui.write(msg)
1932 return
1932 return
1933 numrebased = len([i for i in state.itervalues() if i >= 0])
1933 numrebased = len([i for i in state.itervalues() if i >= 0])
1934 # i18n: column positioning for "hg summary"
1934 # i18n: column positioning for "hg summary"
1935 ui.write(_('rebase: %s, %s (rebase --continue)\n') %
1935 ui.write(_('rebase: %s, %s (rebase --continue)\n') %
1936 (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased,
1936 (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased,
1937 ui.label(_('%d remaining'), 'rebase.remaining') %
1937 ui.label(_('%d remaining'), 'rebase.remaining') %
1938 (len(state) - numrebased)))
1938 (len(state) - numrebased)))
1939
1939
1940 def uisetup(ui):
1940 def uisetup(ui):
1941 #Replace pull with a decorator to provide --rebase option
1941 #Replace pull with a decorator to provide --rebase option
1942 entry = extensions.wrapcommand(commands.table, 'pull', pullrebase)
1942 entry = extensions.wrapcommand(commands.table, 'pull', pullrebase)
1943 entry[1].append(('', 'rebase', None,
1943 entry[1].append(('', 'rebase', None,
1944 _("rebase working directory to branch head")))
1944 _("rebase working directory to branch head")))
1945 entry[1].append(('t', 'tool', '',
1945 entry[1].append(('t', 'tool', '',
1946 _("specify merge tool for rebase")))
1946 _("specify merge tool for rebase")))
1947 cmdutil.summaryhooks.add('rebase', summaryhook)
1947 cmdutil.summaryhooks.add('rebase', summaryhook)
1948 cmdutil.unfinishedstates.append(
1948 cmdutil.unfinishedstates.append(
1949 ['rebasestate', False, False, _('rebase in progress'),
1949 ['rebasestate', False, False, _('rebase in progress'),
1950 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1950 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1951 cmdutil.afterresolvedstates.append(
1951 cmdutil.afterresolvedstates.append(
1952 ['rebasestate', _('hg rebase --continue')])
1952 ['rebasestate', _('hg rebase --continue')])
@@ -1,503 +1,503 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
10 > EOF
10 > EOF
11
11
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15
15
16 $ touch .hg/rebasestate
16 $ touch .hg/rebasestate
17 $ hg sum
17 $ hg sum
18 parent: -1:000000000000 tip (empty repository)
18 parent: -1:000000000000 tip (empty repository)
19 branch: default
19 branch: default
20 commit: (clean)
20 commit: (clean)
21 update: (current)
21 update: (current)
22 abort: .hg/rebasestate is incomplete
22 abort: .hg/rebasestate is incomplete
23 [255]
23 [255]
24 $ rm .hg/rebasestate
24 $ rm .hg/rebasestate
25
25
26 $ echo c1 > common
26 $ echo c1 > common
27 $ hg add common
27 $ hg add common
28 $ hg ci -m C1
28 $ hg ci -m C1
29
29
30 $ echo c2 >> common
30 $ echo c2 >> common
31 $ hg ci -m C2
31 $ hg ci -m C2
32
32
33 $ echo c3 >> common
33 $ echo c3 >> common
34 $ hg ci -m C3
34 $ hg ci -m C3
35
35
36 $ hg up -q -C 1
36 $ hg up -q -C 1
37
37
38 $ echo l1 >> extra
38 $ echo l1 >> extra
39 $ hg add extra
39 $ hg add extra
40 $ hg ci -m L1
40 $ hg ci -m L1
41 created new head
41 created new head
42
42
43 $ sed -e 's/c2/l2/' common > common.new
43 $ sed -e 's/c2/l2/' common > common.new
44 $ mv common.new common
44 $ mv common.new common
45 $ hg ci -m L2
45 $ hg ci -m L2
46
46
47 $ hg phase --force --secret 2
47 $ hg phase --force --secret 2
48
48
49 $ hg tglog
49 $ hg tglog
50 @ 4:draft 'L2'
50 @ 4:draft 'L2'
51 |
51 |
52 o 3:draft 'L1'
52 o 3:draft 'L1'
53 |
53 |
54 | o 2:secret 'C3'
54 | o 2:secret 'C3'
55 |/
55 |/
56 o 1:draft 'C2'
56 o 1:draft 'C2'
57 |
57 |
58 o 0:draft 'C1'
58 o 0:draft 'C1'
59
59
60
60
61 Conflicting rebase:
61 Conflicting rebase:
62
62
63 $ hg rebase -s 3 -d 2
63 $ hg rebase -s 3 -d 2
64 rebasing 3:3163e20567cc "L1"
64 rebasing 3:3163e20567cc "L1"
65 rebasing 4:46f0b057b5c0 "L2" (tip)
65 rebasing 4:46f0b057b5c0 "L2" (tip)
66 merging common
66 merging common
67 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
67 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
68 unresolved conflicts (see hg resolve, then hg rebase --continue)
68 unresolved conflicts (see hg resolve, then hg rebase --continue)
69 [1]
69 [1]
70
70
71 Insert unsupported advisory merge record:
71 Insert unsupported advisory merge record:
72
72
73 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
73 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
74 $ hg debugmergestate
74 $ hg debugmergestate
75 * version 2 records
75 * version 2 records
76 local: 3e046f2ecedb793b97ed32108086edd1a162f8bc
76 local: 3e046f2ecedb793b97ed32108086edd1a162f8bc
77 other: 46f0b057b5c061d276b91491c22151f78698abd2
77 other: 46f0b057b5c061d276b91491c22151f78698abd2
78 labels:
78 labels:
79 local: dest
79 local: dest
80 other: source
80 other: source
81 unrecognized entry: x advisory record
81 unrecognized entry: x advisory record
82 file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
82 file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
83 file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1)
83 file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1)
84 local path: common (flags "")
84 local path: common (flags "")
85 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
85 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
86 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
86 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
87 $ hg resolve -l
87 $ hg resolve -l
88 U common
88 U common
89
89
90 Insert unsupported mandatory merge record:
90 Insert unsupported mandatory merge record:
91
91
92 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
92 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
93 $ hg debugmergestate
93 $ hg debugmergestate
94 * version 2 records
94 * version 2 records
95 local: 3e046f2ecedb793b97ed32108086edd1a162f8bc
95 local: 3e046f2ecedb793b97ed32108086edd1a162f8bc
96 other: 46f0b057b5c061d276b91491c22151f78698abd2
96 other: 46f0b057b5c061d276b91491c22151f78698abd2
97 labels:
97 labels:
98 local: dest
98 local: dest
99 other: source
99 other: source
100 file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
100 file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
101 file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1)
101 file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1)
102 local path: common (flags "")
102 local path: common (flags "")
103 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
103 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
104 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
104 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
105 unrecognized entry: X mandatory record
105 unrecognized entry: X mandatory record
106 $ hg resolve -l
106 $ hg resolve -l
107 abort: unsupported merge state records: X
107 abort: unsupported merge state records: X
108 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
108 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
109 [255]
109 [255]
110 $ hg resolve -ma
110 $ hg resolve -ma
111 abort: unsupported merge state records: X
111 abort: unsupported merge state records: X
112 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
112 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
113 [255]
113 [255]
114
114
115 Abort (should clear out unsupported merge state):
115 Abort (should clear out unsupported merge state):
116
116
117 $ hg rebase --abort
117 $ hg rebase --abort
118 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
118 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
119 rebase aborted
119 rebase aborted
120 $ hg debugmergestate
120 $ hg debugmergestate
121 no merge state found
121 no merge state found
122
122
123 $ hg tglog
123 $ hg tglog
124 @ 4:draft 'L2'
124 @ 4:draft 'L2'
125 |
125 |
126 o 3:draft 'L1'
126 o 3:draft 'L1'
127 |
127 |
128 | o 2:secret 'C3'
128 | o 2:secret 'C3'
129 |/
129 |/
130 o 1:draft 'C2'
130 o 1:draft 'C2'
131 |
131 |
132 o 0:draft 'C1'
132 o 0:draft 'C1'
133
133
134 Test safety for inconsistent rebase state, which may be created (and
134 Test safety for inconsistent rebase state, which may be created (and
135 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
135 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
136 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
136 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
137
137
138 $ hg rebase -s 3 -d 2
138 $ hg rebase -s 3 -d 2
139 rebasing 3:3163e20567cc "L1"
139 rebasing 3:3163e20567cc "L1"
140 rebasing 4:46f0b057b5c0 "L2" (tip)
140 rebasing 4:46f0b057b5c0 "L2" (tip)
141 merging common
141 merging common
142 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
142 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
143 unresolved conflicts (see hg resolve, then hg rebase --continue)
143 unresolved conflicts (see hg resolve, then hg rebase --continue)
144 [1]
144 [1]
145
145
146 $ mv .hg/rebasestate .hg/rebasestate.back
146 $ mv .hg/rebasestate .hg/rebasestate.back
147 $ hg update --quiet --clean 2
147 $ hg update --quiet --clean 2
148 $ hg --config extensions.mq= strip --quiet "destination()"
148 $ hg --config extensions.mq= strip --quiet "destination()"
149 $ mv .hg/rebasestate.back .hg/rebasestate
149 $ mv .hg/rebasestate.back .hg/rebasestate
150
150
151 $ hg rebase --continue
151 $ hg rebase --continue
152 abort: cannot continue inconsistent rebase
152 abort: cannot continue inconsistent rebase
153 (use "hg rebase --abort" to clear broken state)
153 (use "hg rebase --abort" to clear broken state)
154 [255]
154 [255]
155 $ hg summary | grep '^rebase: '
155 $ hg summary | grep '^rebase: '
156 rebase: (use "hg rebase --abort" to clear broken state)
156 rebase: (use "hg rebase --abort" to clear broken state)
157 $ hg rebase --abort
157 $ hg rebase --abort
158 rebase aborted (no revision is removed, only broken state is cleared)
158 rebase aborted (no revision is removed, only broken state is cleared)
159
159
160 $ cd ..
160 $ cd ..
161
161
162
162
163 Construct new repo:
163 Construct new repo:
164
164
165 $ hg init b
165 $ hg init b
166 $ cd b
166 $ cd b
167
167
168 $ echo a > a
168 $ echo a > a
169 $ hg ci -Am A
169 $ hg ci -Am A
170 adding a
170 adding a
171
171
172 $ echo b > b
172 $ echo b > b
173 $ hg ci -Am B
173 $ hg ci -Am B
174 adding b
174 adding b
175
175
176 $ echo c > c
176 $ echo c > c
177 $ hg ci -Am C
177 $ hg ci -Am C
178 adding c
178 adding c
179
179
180 $ hg up -q 0
180 $ hg up -q 0
181
181
182 $ echo b > b
182 $ echo b > b
183 $ hg ci -Am 'B bis'
183 $ hg ci -Am 'B bis'
184 adding b
184 adding b
185 created new head
185 created new head
186
186
187 $ echo c1 > c
187 $ echo c1 > c
188 $ hg ci -Am C1
188 $ hg ci -Am C1
189 adding c
189 adding c
190
190
191 $ hg phase --force --secret 1
191 $ hg phase --force --secret 1
192 $ hg phase --public 1
192 $ hg phase --public 1
193
193
194 Rebase and abort without generating new changesets:
194 Rebase and abort without generating new changesets:
195
195
196 $ hg tglog
196 $ hg tglog
197 @ 4:draft 'C1'
197 @ 4:draft 'C1'
198 |
198 |
199 o 3:draft 'B bis'
199 o 3:draft 'B bis'
200 |
200 |
201 | o 2:secret 'C'
201 | o 2:secret 'C'
202 | |
202 | |
203 | o 1:public 'B'
203 | o 1:public 'B'
204 |/
204 |/
205 o 0:public 'A'
205 o 0:public 'A'
206
206
207 $ hg rebase -b 4 -d 2
207 $ hg rebase -b 4 -d 2
208 rebasing 3:a6484957d6b9 "B bis"
208 rebasing 3:a6484957d6b9 "B bis"
209 note: rebase of 3:a6484957d6b9 "B bis" created no changes to commit
209 note: not rebasing 3:a6484957d6b9 "B bis", its destination already has all its changes
210 rebasing 4:145842775fec "C1" (tip)
210 rebasing 4:145842775fec "C1" (tip)
211 merging c
211 merging c
212 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
212 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
213 unresolved conflicts (see hg resolve, then hg rebase --continue)
213 unresolved conflicts (see hg resolve, then hg rebase --continue)
214 [1]
214 [1]
215
215
216 $ hg tglog
216 $ hg tglog
217 @ 4:draft 'C1'
217 @ 4:draft 'C1'
218 |
218 |
219 o 3:draft 'B bis'
219 o 3:draft 'B bis'
220 |
220 |
221 | @ 2:secret 'C'
221 | @ 2:secret 'C'
222 | |
222 | |
223 | o 1:public 'B'
223 | o 1:public 'B'
224 |/
224 |/
225 o 0:public 'A'
225 o 0:public 'A'
226
226
227 $ hg rebase -a
227 $ hg rebase -a
228 rebase aborted
228 rebase aborted
229
229
230 $ hg tglog
230 $ hg tglog
231 @ 4:draft 'C1'
231 @ 4:draft 'C1'
232 |
232 |
233 o 3:draft 'B bis'
233 o 3:draft 'B bis'
234 |
234 |
235 | o 2:secret 'C'
235 | o 2:secret 'C'
236 | |
236 | |
237 | o 1:public 'B'
237 | o 1:public 'B'
238 |/
238 |/
239 o 0:public 'A'
239 o 0:public 'A'
240
240
241
241
242 $ cd ..
242 $ cd ..
243
243
244 rebase abort should not leave working copy in a merge state if tip-1 is public
244 rebase abort should not leave working copy in a merge state if tip-1 is public
245 (issue4082)
245 (issue4082)
246
246
247 $ hg init abortpublic
247 $ hg init abortpublic
248 $ cd abortpublic
248 $ cd abortpublic
249 $ echo a > a && hg ci -Aqm a
249 $ echo a > a && hg ci -Aqm a
250 $ hg book master
250 $ hg book master
251 $ hg book foo
251 $ hg book foo
252 $ echo b > b && hg ci -Aqm b
252 $ echo b > b && hg ci -Aqm b
253 $ hg up -q master
253 $ hg up -q master
254 $ echo c > c && hg ci -Aqm c
254 $ echo c > c && hg ci -Aqm c
255 $ hg phase -p -r .
255 $ hg phase -p -r .
256 $ hg up -q foo
256 $ hg up -q foo
257 $ echo C > c && hg ci -Aqm C
257 $ echo C > c && hg ci -Aqm C
258 $ hg log -G --template "{rev} {desc} {bookmarks}"
258 $ hg log -G --template "{rev} {desc} {bookmarks}"
259 @ 3 C foo
259 @ 3 C foo
260 |
260 |
261 | o 2 c master
261 | o 2 c master
262 | |
262 | |
263 o | 1 b
263 o | 1 b
264 |/
264 |/
265 o 0 a
265 o 0 a
266
266
267
267
268 $ hg rebase -d master -r foo
268 $ hg rebase -d master -r foo
269 rebasing 3:6c0f977a22d8 "C" (foo tip)
269 rebasing 3:6c0f977a22d8 "C" (foo tip)
270 merging c
270 merging c
271 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
271 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
272 unresolved conflicts (see hg resolve, then hg rebase --continue)
272 unresolved conflicts (see hg resolve, then hg rebase --continue)
273 [1]
273 [1]
274 $ hg rebase --abort
274 $ hg rebase --abort
275 rebase aborted
275 rebase aborted
276 $ hg log -G --template "{rev} {desc} {bookmarks}"
276 $ hg log -G --template "{rev} {desc} {bookmarks}"
277 @ 3 C foo
277 @ 3 C foo
278 |
278 |
279 | o 2 c master
279 | o 2 c master
280 | |
280 | |
281 o | 1 b
281 o | 1 b
282 |/
282 |/
283 o 0 a
283 o 0 a
284
284
285 $ cd ..
285 $ cd ..
286
286
287 Make sure we don't clobber changes in the working directory when the
287 Make sure we don't clobber changes in the working directory when the
288 user has somehow managed to update to a different revision (issue4009)
288 user has somehow managed to update to a different revision (issue4009)
289
289
290 $ hg init noupdate
290 $ hg init noupdate
291 $ cd noupdate
291 $ cd noupdate
292 $ hg book @
292 $ hg book @
293 $ echo original > a
293 $ echo original > a
294 $ hg add a
294 $ hg add a
295 $ hg commit -m a
295 $ hg commit -m a
296 $ echo x > b
296 $ echo x > b
297 $ hg add b
297 $ hg add b
298 $ hg commit -m b1
298 $ hg commit -m b1
299 $ hg up 0
299 $ hg up 0
300 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
300 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
301 (leaving bookmark @)
301 (leaving bookmark @)
302 $ hg book foo
302 $ hg book foo
303 $ echo y > b
303 $ echo y > b
304 $ hg add b
304 $ hg add b
305 $ hg commit -m b2
305 $ hg commit -m b2
306 created new head
306 created new head
307
307
308 $ hg rebase -d @ -b foo --tool=internal:fail
308 $ hg rebase -d @ -b foo --tool=internal:fail
309 rebasing 2:070cf4580bb5 "b2" (foo tip)
309 rebasing 2:070cf4580bb5 "b2" (foo tip)
310 unresolved conflicts (see hg resolve, then hg rebase --continue)
310 unresolved conflicts (see hg resolve, then hg rebase --continue)
311 [1]
311 [1]
312
312
313 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
313 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
314 $ hg up -C 0 # user does other stuff in the repo
314 $ hg up -C 0 # user does other stuff in the repo
315 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
315 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
316
316
317 $ mv rebasestate .hg/ # user upgrades to 2.7
317 $ mv rebasestate .hg/ # user upgrades to 2.7
318
318
319 $ echo new > a
319 $ echo new > a
320 $ hg up 1 # user gets an error saying to run hg rebase --abort
320 $ hg up 1 # user gets an error saying to run hg rebase --abort
321 abort: rebase in progress
321 abort: rebase in progress
322 (use 'hg rebase --continue' or 'hg rebase --abort')
322 (use 'hg rebase --continue' or 'hg rebase --abort')
323 [255]
323 [255]
324
324
325 $ cat a
325 $ cat a
326 new
326 new
327 $ hg rebase --abort
327 $ hg rebase --abort
328 rebase aborted
328 rebase aborted
329 $ cat a
329 $ cat a
330 new
330 new
331
331
332 $ cd ..
332 $ cd ..
333
333
334 test aborting an interrupted series (issue5084)
334 test aborting an interrupted series (issue5084)
335 $ hg init interrupted
335 $ hg init interrupted
336 $ cd interrupted
336 $ cd interrupted
337 $ touch base
337 $ touch base
338 $ hg add base
338 $ hg add base
339 $ hg commit -m base
339 $ hg commit -m base
340 $ touch a
340 $ touch a
341 $ hg add a
341 $ hg add a
342 $ hg commit -m a
342 $ hg commit -m a
343 $ echo 1 > a
343 $ echo 1 > a
344 $ hg commit -m 1
344 $ hg commit -m 1
345 $ touch b
345 $ touch b
346 $ hg add b
346 $ hg add b
347 $ hg commit -m b
347 $ hg commit -m b
348 $ echo 2 >> a
348 $ echo 2 >> a
349 $ hg commit -m c
349 $ hg commit -m c
350 $ touch d
350 $ touch d
351 $ hg add d
351 $ hg add d
352 $ hg commit -m d
352 $ hg commit -m d
353 $ hg co -q 1
353 $ hg co -q 1
354 $ hg rm a
354 $ hg rm a
355 $ hg commit -m no-a
355 $ hg commit -m no-a
356 created new head
356 created new head
357 $ hg co 0
357 $ hg co 0
358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
358 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 $ hg log -G --template "{rev} {desc} {bookmarks}"
359 $ hg log -G --template "{rev} {desc} {bookmarks}"
360 o 6 no-a
360 o 6 no-a
361 |
361 |
362 | o 5 d
362 | o 5 d
363 | |
363 | |
364 | o 4 c
364 | o 4 c
365 | |
365 | |
366 | o 3 b
366 | o 3 b
367 | |
367 | |
368 | o 2 1
368 | o 2 1
369 |/
369 |/
370 o 1 a
370 o 1 a
371 |
371 |
372 @ 0 base
372 @ 0 base
373
373
374 $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
374 $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
375 rebasing 3:3a71550954f1 "b"
375 rebasing 3:3a71550954f1 "b"
376 rebasing 4:e80b69427d80 "c"
376 rebasing 4:e80b69427d80 "c"
377 abort: ^C
377 abort: ^C
378 [255]
378 [255]
379
379
380 New operations are blocked with the correct state message
380 New operations are blocked with the correct state message
381
381
382 $ find .hg -name '*state' -prune | sort
382 $ find .hg -name '*state' -prune | sort
383 .hg/dirstate
383 .hg/dirstate
384 .hg/merge/state
384 .hg/merge/state
385 .hg/rebasestate
385 .hg/rebasestate
386 .hg/undo.backup.dirstate
386 .hg/undo.backup.dirstate
387 .hg/undo.dirstate
387 .hg/undo.dirstate
388 .hg/updatestate
388 .hg/updatestate
389
389
390 $ hg rebase -s 3 -d tip
390 $ hg rebase -s 3 -d tip
391 abort: rebase in progress
391 abort: rebase in progress
392 (use 'hg rebase --continue' or 'hg rebase --abort')
392 (use 'hg rebase --continue' or 'hg rebase --abort')
393 [255]
393 [255]
394 $ hg up .
394 $ hg up .
395 abort: rebase in progress
395 abort: rebase in progress
396 (use 'hg rebase --continue' or 'hg rebase --abort')
396 (use 'hg rebase --continue' or 'hg rebase --abort')
397 [255]
397 [255]
398 $ hg up -C .
398 $ hg up -C .
399 abort: rebase in progress
399 abort: rebase in progress
400 (use 'hg rebase --continue' or 'hg rebase --abort')
400 (use 'hg rebase --continue' or 'hg rebase --abort')
401 [255]
401 [255]
402
402
403 $ hg graft 3
403 $ hg graft 3
404 abort: rebase in progress
404 abort: rebase in progress
405 (use 'hg rebase --continue' or 'hg rebase --abort')
405 (use 'hg rebase --continue' or 'hg rebase --abort')
406 [255]
406 [255]
407
407
408 $ hg rebase --abort
408 $ hg rebase --abort
409 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
409 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
410 rebase aborted
410 rebase aborted
411 $ hg log -G --template "{rev} {desc} {bookmarks}"
411 $ hg log -G --template "{rev} {desc} {bookmarks}"
412 o 6 no-a
412 o 6 no-a
413 |
413 |
414 | o 5 d
414 | o 5 d
415 | |
415 | |
416 | o 4 c
416 | o 4 c
417 | |
417 | |
418 | o 3 b
418 | o 3 b
419 | |
419 | |
420 | o 2 1
420 | o 2 1
421 |/
421 |/
422 o 1 a
422 o 1 a
423 |
423 |
424 @ 0 base
424 @ 0 base
425
425
426 $ hg summary
426 $ hg summary
427 parent: 0:df4f53cec30a
427 parent: 0:df4f53cec30a
428 base
428 base
429 branch: default
429 branch: default
430 commit: (clean)
430 commit: (clean)
431 update: 6 new changesets (update)
431 update: 6 new changesets (update)
432 phases: 7 draft
432 phases: 7 draft
433
433
434 $ cd ..
434 $ cd ..
435 On the other hand, make sure we *do* clobber changes whenever we
435 On the other hand, make sure we *do* clobber changes whenever we
436 haven't somehow managed to update the repo to a different revision
436 haven't somehow managed to update the repo to a different revision
437 during a rebase (issue4661)
437 during a rebase (issue4661)
438
438
439 $ hg ini yesupdate
439 $ hg ini yesupdate
440 $ cd yesupdate
440 $ cd yesupdate
441 $ echo "initial data" > foo.txt
441 $ echo "initial data" > foo.txt
442 $ hg add
442 $ hg add
443 adding foo.txt
443 adding foo.txt
444 $ hg ci -m "initial checkin"
444 $ hg ci -m "initial checkin"
445 $ echo "change 1" > foo.txt
445 $ echo "change 1" > foo.txt
446 $ hg ci -m "change 1"
446 $ hg ci -m "change 1"
447 $ hg up 0
447 $ hg up 0
448 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
448 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
449 $ echo "conflicting change 1" > foo.txt
449 $ echo "conflicting change 1" > foo.txt
450 $ hg ci -m "conflicting 1"
450 $ hg ci -m "conflicting 1"
451 created new head
451 created new head
452 $ echo "conflicting change 2" > foo.txt
452 $ echo "conflicting change 2" > foo.txt
453 $ hg ci -m "conflicting 2"
453 $ hg ci -m "conflicting 2"
454
454
455 $ hg rebase -d 1 --tool 'internal:fail'
455 $ hg rebase -d 1 --tool 'internal:fail'
456 rebasing 2:e4ea5cdc9789 "conflicting 1"
456 rebasing 2:e4ea5cdc9789 "conflicting 1"
457 unresolved conflicts (see hg resolve, then hg rebase --continue)
457 unresolved conflicts (see hg resolve, then hg rebase --continue)
458 [1]
458 [1]
459 $ hg rebase --abort
459 $ hg rebase --abort
460 rebase aborted
460 rebase aborted
461 $ hg summary
461 $ hg summary
462 parent: 3:b16646383533 tip
462 parent: 3:b16646383533 tip
463 conflicting 2
463 conflicting 2
464 branch: default
464 branch: default
465 commit: (clean)
465 commit: (clean)
466 update: 1 new changesets, 2 branch heads (merge)
466 update: 1 new changesets, 2 branch heads (merge)
467 phases: 4 draft
467 phases: 4 draft
468 $ cd ..
468 $ cd ..
469
469
470 test aborting a rebase succeeds after rebasing with skipped commits onto a
470 test aborting a rebase succeeds after rebasing with skipped commits onto a
471 public changeset (issue4896)
471 public changeset (issue4896)
472
472
473 $ hg init succeedonpublic
473 $ hg init succeedonpublic
474 $ cd succeedonpublic
474 $ cd succeedonpublic
475 $ echo 'content' > root
475 $ echo 'content' > root
476 $ hg commit -A -m 'root' -q
476 $ hg commit -A -m 'root' -q
477
477
478 set up public branch
478 set up public branch
479 $ echo 'content' > disappear
479 $ echo 'content' > disappear
480 $ hg commit -A -m 'disappear public' -q
480 $ hg commit -A -m 'disappear public' -q
481 commit will cause merge conflict on rebase
481 commit will cause merge conflict on rebase
482 $ echo '' > root
482 $ echo '' > root
483 $ hg commit -m 'remove content public' -q
483 $ hg commit -m 'remove content public' -q
484 $ hg phase --public
484 $ hg phase --public
485
485
486 setup the draft branch that will be rebased onto public commit
486 setup the draft branch that will be rebased onto public commit
487 $ hg up -r 0 -q
487 $ hg up -r 0 -q
488 $ echo 'content' > disappear
488 $ echo 'content' > disappear
489 commit will disappear
489 commit will disappear
490 $ hg commit -A -m 'disappear draft' -q
490 $ hg commit -A -m 'disappear draft' -q
491 $ echo 'addedcontADDEDentadded' > root
491 $ echo 'addedcontADDEDentadded' > root
492 commit will cause merge conflict on rebase
492 commit will cause merge conflict on rebase
493 $ hg commit -m 'add content draft' -q
493 $ hg commit -m 'add content draft' -q
494
494
495 $ hg rebase -d 'public()' --tool :merge -q
495 $ hg rebase -d 'public()' --tool :merge -q
496 note: rebase of 3:0682fd3dabf5 "disappear draft" created no changes to commit
496 note: not rebasing 3:0682fd3dabf5 "disappear draft", its destination already has all its changes
497 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
497 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
498 unresolved conflicts (see hg resolve, then hg rebase --continue)
498 unresolved conflicts (see hg resolve, then hg rebase --continue)
499 [1]
499 [1]
500 $ hg rebase --abort
500 $ hg rebase --abort
501 rebase aborted
501 rebase aborted
502 $ cd ..
502 $ cd ..
503
503
@@ -1,483 +1,483 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > mq=
4 > mq=
5 >
5 >
6 > [phases]
6 > [phases]
7 > publish=False
7 > publish=False
8 >
8 >
9 > [alias]
9 > [alias]
10 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
10 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
11 > theads = heads --template "{rev}: '{desc}' {branches}\n"
11 > theads = heads --template "{rev}: '{desc}' {branches}\n"
12 > EOF
12 > EOF
13
13
14 $ hg init a
14 $ hg init a
15 $ cd a
15 $ cd a
16
16
17 $ echo a > a
17 $ echo a > a
18 $ hg ci -Am A
18 $ hg ci -Am A
19 adding a
19 adding a
20
20
21 $ hg branch branch1
21 $ hg branch branch1
22 marked working directory as branch branch1
22 marked working directory as branch branch1
23 (branches are permanent and global, did you want a bookmark?)
23 (branches are permanent and global, did you want a bookmark?)
24 $ hg ci -m 'branch1'
24 $ hg ci -m 'branch1'
25
25
26 $ echo b > b
26 $ echo b > b
27 $ hg ci -Am B
27 $ hg ci -Am B
28 adding b
28 adding b
29
29
30 $ hg up -q 0
30 $ hg up -q 0
31
31
32 $ hg branch branch2
32 $ hg branch branch2
33 marked working directory as branch branch2
33 marked working directory as branch branch2
34 $ hg ci -m 'branch2'
34 $ hg ci -m 'branch2'
35
35
36 $ echo c > C
36 $ echo c > C
37 $ hg ci -Am C
37 $ hg ci -Am C
38 adding C
38 adding C
39
39
40 $ hg up -q 2
40 $ hg up -q 2
41
41
42 $ hg branch -f branch2
42 $ hg branch -f branch2
43 marked working directory as branch branch2
43 marked working directory as branch branch2
44 $ echo d > d
44 $ echo d > d
45 $ hg ci -Am D
45 $ hg ci -Am D
46 adding d
46 adding d
47 created new head
47 created new head
48
48
49 $ echo e > e
49 $ echo e > e
50 $ hg ci -Am E
50 $ hg ci -Am E
51 adding e
51 adding e
52
52
53 $ hg update default
53 $ hg update default
54 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
54 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
55
55
56 $ hg branch branch3
56 $ hg branch branch3
57 marked working directory as branch branch3
57 marked working directory as branch branch3
58 $ hg ci -m 'branch3'
58 $ hg ci -m 'branch3'
59
59
60 $ echo f > f
60 $ echo f > f
61 $ hg ci -Am F
61 $ hg ci -Am F
62 adding f
62 adding f
63
63
64 $ cd ..
64 $ cd ..
65
65
66
66
67 Rebase part of branch2 (5-6) onto branch3 (8):
67 Rebase part of branch2 (5-6) onto branch3 (8):
68
68
69 $ hg clone -q -u . a a1
69 $ hg clone -q -u . a a1
70 $ cd a1
70 $ cd a1
71
71
72 $ hg tglog
72 $ hg tglog
73 @ 8: 'F' branch3
73 @ 8: 'F' branch3
74 |
74 |
75 o 7: 'branch3' branch3
75 o 7: 'branch3' branch3
76 |
76 |
77 | o 6: 'E' branch2
77 | o 6: 'E' branch2
78 | |
78 | |
79 | o 5: 'D' branch2
79 | o 5: 'D' branch2
80 | |
80 | |
81 | | o 4: 'C' branch2
81 | | o 4: 'C' branch2
82 | | |
82 | | |
83 +---o 3: 'branch2' branch2
83 +---o 3: 'branch2' branch2
84 | |
84 | |
85 | o 2: 'B' branch1
85 | o 2: 'B' branch1
86 | |
86 | |
87 | o 1: 'branch1' branch1
87 | o 1: 'branch1' branch1
88 |/
88 |/
89 o 0: 'A'
89 o 0: 'A'
90
90
91 $ hg branches
91 $ hg branches
92 branch3 8:4666b71e8e32
92 branch3 8:4666b71e8e32
93 branch2 6:5097051d331d
93 branch2 6:5097051d331d
94 branch1 2:0a03079c47fd (inactive)
94 branch1 2:0a03079c47fd (inactive)
95 default 0:1994f17a630e (inactive)
95 default 0:1994f17a630e (inactive)
96
96
97 $ hg theads
97 $ hg theads
98 8: 'F' branch3
98 8: 'F' branch3
99 6: 'E' branch2
99 6: 'E' branch2
100 4: 'C' branch2
100 4: 'C' branch2
101 2: 'B' branch1
101 2: 'B' branch1
102 0: 'A'
102 0: 'A'
103
103
104 $ hg rebase -s 5 -d 8
104 $ hg rebase -s 5 -d 8
105 rebasing 5:635859577d0b "D"
105 rebasing 5:635859577d0b "D"
106 rebasing 6:5097051d331d "E"
106 rebasing 6:5097051d331d "E"
107 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/635859577d0b-89160bff-rebase.hg
107 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/635859577d0b-89160bff-rebase.hg
108
108
109 $ hg branches
109 $ hg branches
110 branch3 8:466cdfb14b62
110 branch3 8:466cdfb14b62
111 branch2 4:e4fdb121d036
111 branch2 4:e4fdb121d036
112 branch1 2:0a03079c47fd
112 branch1 2:0a03079c47fd
113 default 0:1994f17a630e (inactive)
113 default 0:1994f17a630e (inactive)
114
114
115 $ hg theads
115 $ hg theads
116 8: 'E' branch3
116 8: 'E' branch3
117 4: 'C' branch2
117 4: 'C' branch2
118 2: 'B' branch1
118 2: 'B' branch1
119 0: 'A'
119 0: 'A'
120
120
121 $ hg tglog
121 $ hg tglog
122 o 8: 'E' branch3
122 o 8: 'E' branch3
123 |
123 |
124 o 7: 'D' branch3
124 o 7: 'D' branch3
125 |
125 |
126 @ 6: 'F' branch3
126 @ 6: 'F' branch3
127 |
127 |
128 o 5: 'branch3' branch3
128 o 5: 'branch3' branch3
129 |
129 |
130 | o 4: 'C' branch2
130 | o 4: 'C' branch2
131 | |
131 | |
132 | o 3: 'branch2' branch2
132 | o 3: 'branch2' branch2
133 |/
133 |/
134 | o 2: 'B' branch1
134 | o 2: 'B' branch1
135 | |
135 | |
136 | o 1: 'branch1' branch1
136 | o 1: 'branch1' branch1
137 |/
137 |/
138 o 0: 'A'
138 o 0: 'A'
139
139
140 $ cd ..
140 $ cd ..
141
141
142
142
143 Rebase head of branch3 (8) onto branch2 (6):
143 Rebase head of branch3 (8) onto branch2 (6):
144
144
145 $ hg clone -q -u . a a2
145 $ hg clone -q -u . a a2
146 $ cd a2
146 $ cd a2
147
147
148 $ hg tglog
148 $ hg tglog
149 @ 8: 'F' branch3
149 @ 8: 'F' branch3
150 |
150 |
151 o 7: 'branch3' branch3
151 o 7: 'branch3' branch3
152 |
152 |
153 | o 6: 'E' branch2
153 | o 6: 'E' branch2
154 | |
154 | |
155 | o 5: 'D' branch2
155 | o 5: 'D' branch2
156 | |
156 | |
157 | | o 4: 'C' branch2
157 | | o 4: 'C' branch2
158 | | |
158 | | |
159 +---o 3: 'branch2' branch2
159 +---o 3: 'branch2' branch2
160 | |
160 | |
161 | o 2: 'B' branch1
161 | o 2: 'B' branch1
162 | |
162 | |
163 | o 1: 'branch1' branch1
163 | o 1: 'branch1' branch1
164 |/
164 |/
165 o 0: 'A'
165 o 0: 'A'
166
166
167 $ hg rebase -s 8 -d 6
167 $ hg rebase -s 8 -d 6
168 rebasing 8:4666b71e8e32 "F" (tip)
168 rebasing 8:4666b71e8e32 "F" (tip)
169 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/4666b71e8e32-fc1c4e96-rebase.hg
169 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/4666b71e8e32-fc1c4e96-rebase.hg
170
170
171 $ hg branches
171 $ hg branches
172 branch2 8:6b4bdc1b5ac0
172 branch2 8:6b4bdc1b5ac0
173 branch3 7:653b9feb4616
173 branch3 7:653b9feb4616
174 branch1 2:0a03079c47fd (inactive)
174 branch1 2:0a03079c47fd (inactive)
175 default 0:1994f17a630e (inactive)
175 default 0:1994f17a630e (inactive)
176
176
177 $ hg theads
177 $ hg theads
178 8: 'F' branch2
178 8: 'F' branch2
179 7: 'branch3' branch3
179 7: 'branch3' branch3
180 4: 'C' branch2
180 4: 'C' branch2
181 2: 'B' branch1
181 2: 'B' branch1
182 0: 'A'
182 0: 'A'
183
183
184 $ hg tglog
184 $ hg tglog
185 @ 8: 'F' branch2
185 @ 8: 'F' branch2
186 |
186 |
187 | o 7: 'branch3' branch3
187 | o 7: 'branch3' branch3
188 | |
188 | |
189 o | 6: 'E' branch2
189 o | 6: 'E' branch2
190 | |
190 | |
191 o | 5: 'D' branch2
191 o | 5: 'D' branch2
192 | |
192 | |
193 | | o 4: 'C' branch2
193 | | o 4: 'C' branch2
194 | | |
194 | | |
195 | | o 3: 'branch2' branch2
195 | | o 3: 'branch2' branch2
196 | |/
196 | |/
197 o | 2: 'B' branch1
197 o | 2: 'B' branch1
198 | |
198 | |
199 o | 1: 'branch1' branch1
199 o | 1: 'branch1' branch1
200 |/
200 |/
201 o 0: 'A'
201 o 0: 'A'
202
202
203 $ hg verify -q
203 $ hg verify -q
204
204
205 $ cd ..
205 $ cd ..
206
206
207
207
208 Rebase entire branch3 (7-8) onto branch2 (6):
208 Rebase entire branch3 (7-8) onto branch2 (6):
209
209
210 $ hg clone -q -u . a a3
210 $ hg clone -q -u . a a3
211 $ cd a3
211 $ cd a3
212
212
213 $ hg tglog
213 $ hg tglog
214 @ 8: 'F' branch3
214 @ 8: 'F' branch3
215 |
215 |
216 o 7: 'branch3' branch3
216 o 7: 'branch3' branch3
217 |
217 |
218 | o 6: 'E' branch2
218 | o 6: 'E' branch2
219 | |
219 | |
220 | o 5: 'D' branch2
220 | o 5: 'D' branch2
221 | |
221 | |
222 | | o 4: 'C' branch2
222 | | o 4: 'C' branch2
223 | | |
223 | | |
224 +---o 3: 'branch2' branch2
224 +---o 3: 'branch2' branch2
225 | |
225 | |
226 | o 2: 'B' branch1
226 | o 2: 'B' branch1
227 | |
227 | |
228 | o 1: 'branch1' branch1
228 | o 1: 'branch1' branch1
229 |/
229 |/
230 o 0: 'A'
230 o 0: 'A'
231
231
232 $ hg rebase -s 7 -d 6
232 $ hg rebase -s 7 -d 6
233 rebasing 7:653b9feb4616 "branch3"
233 rebasing 7:653b9feb4616 "branch3"
234 note: rebase of 7:653b9feb4616 "branch3" created no changes to commit
234 note: not rebasing 7:653b9feb4616 "branch3", its destination already has all its changes
235 rebasing 8:4666b71e8e32 "F" (tip)
235 rebasing 8:4666b71e8e32 "F" (tip)
236 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/653b9feb4616-3c88de16-rebase.hg
236 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/653b9feb4616-3c88de16-rebase.hg
237
237
238 $ hg branches
238 $ hg branches
239 branch2 7:6b4bdc1b5ac0
239 branch2 7:6b4bdc1b5ac0
240 branch1 2:0a03079c47fd (inactive)
240 branch1 2:0a03079c47fd (inactive)
241 default 0:1994f17a630e (inactive)
241 default 0:1994f17a630e (inactive)
242
242
243 $ hg theads
243 $ hg theads
244 7: 'F' branch2
244 7: 'F' branch2
245 4: 'C' branch2
245 4: 'C' branch2
246 2: 'B' branch1
246 2: 'B' branch1
247 0: 'A'
247 0: 'A'
248
248
249 $ hg tglog
249 $ hg tglog
250 @ 7: 'F' branch2
250 @ 7: 'F' branch2
251 |
251 |
252 o 6: 'E' branch2
252 o 6: 'E' branch2
253 |
253 |
254 o 5: 'D' branch2
254 o 5: 'D' branch2
255 |
255 |
256 | o 4: 'C' branch2
256 | o 4: 'C' branch2
257 | |
257 | |
258 | o 3: 'branch2' branch2
258 | o 3: 'branch2' branch2
259 | |
259 | |
260 o | 2: 'B' branch1
260 o | 2: 'B' branch1
261 | |
261 | |
262 o | 1: 'branch1' branch1
262 o | 1: 'branch1' branch1
263 |/
263 |/
264 o 0: 'A'
264 o 0: 'A'
265
265
266 $ hg verify -q
266 $ hg verify -q
267
267
268 Stripping multiple branches in one go bypasses the fast-case code to
268 Stripping multiple branches in one go bypasses the fast-case code to
269 update the branch cache.
269 update the branch cache.
270
270
271 $ hg strip 2
271 $ hg strip 2
272 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
272 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
273 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/0a03079c47fd-11b7c407-backup.hg
273 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/0a03079c47fd-11b7c407-backup.hg
274
274
275 $ hg tglog
275 $ hg tglog
276 o 3: 'C' branch2
276 o 3: 'C' branch2
277 |
277 |
278 o 2: 'branch2' branch2
278 o 2: 'branch2' branch2
279 |
279 |
280 | @ 1: 'branch1' branch1
280 | @ 1: 'branch1' branch1
281 |/
281 |/
282 o 0: 'A'
282 o 0: 'A'
283
283
284
284
285 $ hg branches
285 $ hg branches
286 branch2 3:e4fdb121d036
286 branch2 3:e4fdb121d036
287 branch1 1:63379ac49655
287 branch1 1:63379ac49655
288 default 0:1994f17a630e (inactive)
288 default 0:1994f17a630e (inactive)
289
289
290 $ hg theads
290 $ hg theads
291 3: 'C' branch2
291 3: 'C' branch2
292 1: 'branch1' branch1
292 1: 'branch1' branch1
293 0: 'A'
293 0: 'A'
294
294
295 Fast path branchcache code should not be invoked if branches stripped is not
295 Fast path branchcache code should not be invoked if branches stripped is not
296 the same as branches remaining.
296 the same as branches remaining.
297
297
298 $ hg init b
298 $ hg init b
299 $ cd b
299 $ cd b
300
300
301 $ hg branch branch1
301 $ hg branch branch1
302 marked working directory as branch branch1
302 marked working directory as branch branch1
303 (branches are permanent and global, did you want a bookmark?)
303 (branches are permanent and global, did you want a bookmark?)
304 $ hg ci -m 'branch1'
304 $ hg ci -m 'branch1'
305
305
306 $ hg branch branch2
306 $ hg branch branch2
307 marked working directory as branch branch2
307 marked working directory as branch branch2
308 $ hg ci -m 'branch2'
308 $ hg ci -m 'branch2'
309
309
310 $ hg branch -f branch1
310 $ hg branch -f branch1
311 marked working directory as branch branch1
311 marked working directory as branch branch1
312
312
313 $ echo a > A
313 $ echo a > A
314 $ hg ci -Am A
314 $ hg ci -Am A
315 adding A
315 adding A
316 created new head
316 created new head
317
317
318 $ hg tglog
318 $ hg tglog
319 @ 2: 'A' branch1
319 @ 2: 'A' branch1
320 |
320 |
321 o 1: 'branch2' branch2
321 o 1: 'branch2' branch2
322 |
322 |
323 o 0: 'branch1' branch1
323 o 0: 'branch1' branch1
324
324
325
325
326 $ hg theads
326 $ hg theads
327 2: 'A' branch1
327 2: 'A' branch1
328 1: 'branch2' branch2
328 1: 'branch2' branch2
329
329
330 $ hg strip 2
330 $ hg strip 2
331 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
331 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
332 saved backup bundle to $TESTTMP/a3/b/.hg/strip-backup/a5b4b27ed7b4-a3b6984e-backup.hg
332 saved backup bundle to $TESTTMP/a3/b/.hg/strip-backup/a5b4b27ed7b4-a3b6984e-backup.hg
333
333
334 $ hg theads
334 $ hg theads
335 1: 'branch2' branch2
335 1: 'branch2' branch2
336 0: 'branch1' branch1
336 0: 'branch1' branch1
337
337
338
338
339 Make sure requesting to strip a revision already stripped does not confuse things.
339 Make sure requesting to strip a revision already stripped does not confuse things.
340 Try both orders.
340 Try both orders.
341
341
342 $ cd ..
342 $ cd ..
343
343
344 $ hg init c
344 $ hg init c
345 $ cd c
345 $ cd c
346
346
347 $ echo a > a
347 $ echo a > a
348 $ hg ci -Am A
348 $ hg ci -Am A
349 adding a
349 adding a
350 $ echo b > b
350 $ echo b > b
351 $ hg ci -Am B
351 $ hg ci -Am B
352 adding b
352 adding b
353 $ echo c > c
353 $ echo c > c
354 $ hg ci -Am C
354 $ hg ci -Am C
355 adding c
355 adding c
356 $ echo d > d
356 $ echo d > d
357 $ hg ci -Am D
357 $ hg ci -Am D
358 adding d
358 adding d
359 $ echo e > e
359 $ echo e > e
360 $ hg ci -Am E
360 $ hg ci -Am E
361 adding e
361 adding e
362
362
363 $ hg tglog
363 $ hg tglog
364 @ 4: 'E'
364 @ 4: 'E'
365 |
365 |
366 o 3: 'D'
366 o 3: 'D'
367 |
367 |
368 o 2: 'C'
368 o 2: 'C'
369 |
369 |
370 o 1: 'B'
370 o 1: 'B'
371 |
371 |
372 o 0: 'A'
372 o 0: 'A'
373
373
374
374
375 $ hg strip 3 4
375 $ hg strip 3 4
376 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
376 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
377 saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/67a385d4e6f2-b9243789-backup.hg
377 saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/67a385d4e6f2-b9243789-backup.hg
378
378
379 $ hg theads
379 $ hg theads
380 2: 'C'
380 2: 'C'
381
381
382 $ hg strip 2 1
382 $ hg strip 2 1
383 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
383 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
384 saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/6c81ed0049f8-a687065f-backup.hg
384 saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/6c81ed0049f8-a687065f-backup.hg
385
385
386 $ hg theads
386 $ hg theads
387 0: 'A'
387 0: 'A'
388
388
389 Make sure rebase does not break for phase/filter related reason
389 Make sure rebase does not break for phase/filter related reason
390 ----------------------------------------------------------------
390 ----------------------------------------------------------------
391 (issue3858)
391 (issue3858)
392
392
393 $ cd ..
393 $ cd ..
394
394
395 $ cat >> $HGRCPATH << EOF
395 $ cat >> $HGRCPATH << EOF
396 > [ui]
396 > [ui]
397 > logtemplate={rev} {desc} {phase}\n
397 > logtemplate={rev} {desc} {phase}\n
398 > EOF
398 > EOF
399
399
400
400
401 $ hg init c4
401 $ hg init c4
402 $ cd c4
402 $ cd c4
403
403
404 $ echo a > a
404 $ echo a > a
405 $ hg ci -Am A
405 $ hg ci -Am A
406 adding a
406 adding a
407 $ echo b > b
407 $ echo b > b
408 $ hg ci -Am B
408 $ hg ci -Am B
409 adding b
409 adding b
410 $ hg up 0
410 $ hg up 0
411 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
411 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
412 $ echo c > c
412 $ echo c > c
413 $ hg ci -Am C
413 $ hg ci -Am C
414 adding c
414 adding c
415 created new head
415 created new head
416 $ hg up 1
416 $ hg up 1
417 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
417 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
418 $ hg merge
418 $ hg merge
419 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
419 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
420 (branch merge, don't forget to commit)
420 (branch merge, don't forget to commit)
421 $ hg ci -m d
421 $ hg ci -m d
422 $ hg up 2
422 $ hg up 2
423 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
423 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
424 $ echo e > e
424 $ echo e > e
425 $ hg ci -Am E
425 $ hg ci -Am E
426 adding e
426 adding e
427 created new head
427 created new head
428 $ hg merge 3
428 $ hg merge 3
429 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
429 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
430 (branch merge, don't forget to commit)
430 (branch merge, don't forget to commit)
431 $ hg ci -m F
431 $ hg ci -m F
432 $ hg up 3
432 $ hg up 3
433 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
433 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
434 $ echo g > g
434 $ echo g > g
435 $ hg ci -Am G
435 $ hg ci -Am G
436 adding g
436 adding g
437 created new head
437 created new head
438 $ echo h > h
438 $ echo h > h
439 $ hg ci -Am H
439 $ hg ci -Am H
440 adding h
440 adding h
441 $ hg up 5
441 $ hg up 5
442 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
442 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
443 $ echo i > i
443 $ echo i > i
444 $ hg ci -Am I
444 $ hg ci -Am I
445 adding i
445 adding i
446
446
447 Turn most changeset public
447 Turn most changeset public
448
448
449 $ hg ph -p 7
449 $ hg ph -p 7
450
450
451 $ hg heads
451 $ hg heads
452 8 I draft
452 8 I draft
453 7 H public
453 7 H public
454 $ hg log -G
454 $ hg log -G
455 @ 8 I draft
455 @ 8 I draft
456 |
456 |
457 | o 7 H public
457 | o 7 H public
458 | |
458 | |
459 | o 6 G public
459 | o 6 G public
460 | |
460 | |
461 o | 5 F draft
461 o | 5 F draft
462 |\|
462 |\|
463 o | 4 E draft
463 o | 4 E draft
464 | |
464 | |
465 | o 3 d public
465 | o 3 d public
466 |/|
466 |/|
467 o | 2 C public
467 o | 2 C public
468 | |
468 | |
469 | o 1 B public
469 | o 1 B public
470 |/
470 |/
471 o 0 A public
471 o 0 A public
472
472
473
473
474 $ cat > $TESTTMP/checkeditform.sh <<EOF
474 $ cat > $TESTTMP/checkeditform.sh <<EOF
475 > env | grep HGEDITFORM
475 > env | grep HGEDITFORM
476 > true
476 > true
477 > EOF
477 > EOF
478 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --dest 7 --source 5 -e
478 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --dest 7 --source 5 -e
479 rebasing 5:361a99976cc9 "F"
479 rebasing 5:361a99976cc9 "F"
480 HGEDITFORM=rebase.merge
480 HGEDITFORM=rebase.merge
481 rebasing 8:326cfedc031c "I" (tip)
481 rebasing 8:326cfedc031c "I" (tip)
482 HGEDITFORM=rebase.normal
482 HGEDITFORM=rebase.normal
483 saved backup bundle to $TESTTMP/a3/c4/.hg/strip-backup/361a99976cc9-35e980d0-rebase.hg
483 saved backup bundle to $TESTTMP/a3/c4/.hg/strip-backup/361a99976cc9-35e980d0-rebase.hg
@@ -1,819 +1,819 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > mq=
4 > mq=
5 > drawdag=$TESTDIR/drawdag.py
5 > drawdag=$TESTDIR/drawdag.py
6 >
6 >
7 > [phases]
7 > [phases]
8 > publish=False
8 > publish=False
9 >
9 >
10 > [alias]
10 > [alias]
11 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
11 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
12 > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
12 > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
13 > EOF
13 > EOF
14
14
15 Highest phase of source commits is used:
15 Highest phase of source commits is used:
16
16
17 $ hg init phase
17 $ hg init phase
18 $ cd phase
18 $ cd phase
19 $ hg debugdrawdag << 'EOF'
19 $ hg debugdrawdag << 'EOF'
20 > D
20 > D
21 > |
21 > |
22 > F C
22 > F C
23 > | |
23 > | |
24 > E B
24 > E B
25 > |/
25 > |/
26 > A
26 > A
27 > EOF
27 > EOF
28
28
29 $ hg phase --force --secret D
29 $ hg phase --force --secret D
30
30
31 $ cat > $TESTTMP/editor.sh <<EOF
31 $ cat > $TESTTMP/editor.sh <<EOF
32 > echo "==== before editing"
32 > echo "==== before editing"
33 > cat \$1
33 > cat \$1
34 > echo "===="
34 > echo "===="
35 > echo "edited manually" >> \$1
35 > echo "edited manually" >> \$1
36 > EOF
36 > EOF
37 $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --dest F
37 $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --dest F
38 rebasing 1:112478962961 "B" (B)
38 rebasing 1:112478962961 "B" (B)
39 rebasing 3:26805aba1e60 "C" (C)
39 rebasing 3:26805aba1e60 "C" (C)
40 rebasing 5:f585351a92f8 "D" (D tip)
40 rebasing 5:f585351a92f8 "D" (D tip)
41 ==== before editing
41 ==== before editing
42 Collapsed revision
42 Collapsed revision
43 * B
43 * B
44 * C
44 * C
45 * D
45 * D
46
46
47
47
48 HG: Enter commit message. Lines beginning with 'HG:' are removed.
48 HG: Enter commit message. Lines beginning with 'HG:' are removed.
49 HG: Leave message empty to abort commit.
49 HG: Leave message empty to abort commit.
50 HG: --
50 HG: --
51 HG: user: test
51 HG: user: test
52 HG: branch 'default'
52 HG: branch 'default'
53 HG: added B
53 HG: added B
54 HG: added C
54 HG: added C
55 HG: added D
55 HG: added D
56 ====
56 ====
57 saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
57 saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg
58
58
59 $ hg tglogp
59 $ hg tglogp
60 o 3: 92fa5f5fe108 secret 'Collapsed revision
60 o 3: 92fa5f5fe108 secret 'Collapsed revision
61 | * B
61 | * B
62 | * C
62 | * C
63 | * D
63 | * D
64 |
64 |
65 |
65 |
66 | edited manually'
66 | edited manually'
67 o 2: 64a8289d2492 draft 'F'
67 o 2: 64a8289d2492 draft 'F'
68 |
68 |
69 o 1: 7fb047a69f22 draft 'E'
69 o 1: 7fb047a69f22 draft 'E'
70 |
70 |
71 o 0: 426bada5c675 draft 'A'
71 o 0: 426bada5c675 draft 'A'
72
72
73 $ hg manifest --rev tip
73 $ hg manifest --rev tip
74 A
74 A
75 B
75 B
76 C
76 C
77 D
77 D
78 E
78 E
79 F
79 F
80
80
81 $ cd ..
81 $ cd ..
82
82
83
83
84 Merge gets linearized:
84 Merge gets linearized:
85
85
86 $ hg init linearized-merge
86 $ hg init linearized-merge
87 $ cd linearized-merge
87 $ cd linearized-merge
88
88
89 $ hg debugdrawdag << 'EOF'
89 $ hg debugdrawdag << 'EOF'
90 > F D
90 > F D
91 > |/|
91 > |/|
92 > C B
92 > C B
93 > |/
93 > |/
94 > A
94 > A
95 > EOF
95 > EOF
96
96
97 $ hg phase --force --secret D
97 $ hg phase --force --secret D
98 $ hg rebase --source B --collapse --dest F
98 $ hg rebase --source B --collapse --dest F
99 rebasing 1:112478962961 "B" (B)
99 rebasing 1:112478962961 "B" (B)
100 rebasing 3:4e4f9194f9f1 "D" (D)
100 rebasing 3:4e4f9194f9f1 "D" (D)
101 saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
101 saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg
102
102
103 $ hg tglog
103 $ hg tglog
104 o 3: 5bdc08b7da2b 'Collapsed revision
104 o 3: 5bdc08b7da2b 'Collapsed revision
105 | * B
105 | * B
106 | * D'
106 | * D'
107 o 2: afc707c82df0 'F'
107 o 2: afc707c82df0 'F'
108 |
108 |
109 o 1: dc0947a82db8 'C'
109 o 1: dc0947a82db8 'C'
110 |
110 |
111 o 0: 426bada5c675 'A'
111 o 0: 426bada5c675 'A'
112
112
113 $ hg manifest --rev tip
113 $ hg manifest --rev tip
114 A
114 A
115 B
115 B
116 C
116 C
117 F
117 F
118
118
119 $ cd ..
119 $ cd ..
120
120
121 Custom message:
121 Custom message:
122
122
123 $ hg init message
123 $ hg init message
124 $ cd message
124 $ cd message
125
125
126 $ hg debugdrawdag << 'EOF'
126 $ hg debugdrawdag << 'EOF'
127 > C
127 > C
128 > |
128 > |
129 > D B
129 > D B
130 > |/
130 > |/
131 > A
131 > A
132 > EOF
132 > EOF
133
133
134
134
135 $ hg rebase --base B -m 'custom message'
135 $ hg rebase --base B -m 'custom message'
136 abort: message can only be specified with collapse
136 abort: message can only be specified with collapse
137 [255]
137 [255]
138
138
139 $ cat > $TESTTMP/checkeditform.sh <<EOF
139 $ cat > $TESTTMP/checkeditform.sh <<EOF
140 > env | grep HGEDITFORM
140 > env | grep HGEDITFORM
141 > true
141 > true
142 > EOF
142 > EOF
143 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D
143 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D
144 rebasing 1:112478962961 "B" (B)
144 rebasing 1:112478962961 "B" (B)
145 rebasing 3:26805aba1e60 "C" (C tip)
145 rebasing 3:26805aba1e60 "C" (C tip)
146 HGEDITFORM=rebase.collapse
146 HGEDITFORM=rebase.collapse
147 saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg
147 saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg
148
148
149 $ hg tglog
149 $ hg tglog
150 o 2: 2f197b9a08f3 'custom message'
150 o 2: 2f197b9a08f3 'custom message'
151 |
151 |
152 o 1: b18e25de2cf5 'D'
152 o 1: b18e25de2cf5 'D'
153 |
153 |
154 o 0: 426bada5c675 'A'
154 o 0: 426bada5c675 'A'
155
155
156 $ hg manifest --rev tip
156 $ hg manifest --rev tip
157 A
157 A
158 B
158 B
159 C
159 C
160 D
160 D
161
161
162 $ cd ..
162 $ cd ..
163
163
164 Rebase and collapse - more than one external (fail):
164 Rebase and collapse - more than one external (fail):
165
165
166 $ hg init multiple-external-parents
166 $ hg init multiple-external-parents
167 $ cd multiple-external-parents
167 $ cd multiple-external-parents
168
168
169 $ hg debugdrawdag << 'EOF'
169 $ hg debugdrawdag << 'EOF'
170 > G
170 > G
171 > |\
171 > |\
172 > | F
172 > | F
173 > | |
173 > | |
174 > D E
174 > D E
175 > |\|
175 > |\|
176 > H C B
176 > H C B
177 > \|/
177 > \|/
178 > A
178 > A
179 > EOF
179 > EOF
180
180
181 $ hg rebase -s C --dest H --collapse
181 $ hg rebase -s C --dest H --collapse
182 abort: unable to collapse on top of 3, there is more than one external parent: 1, 6
182 abort: unable to collapse on top of 3, there is more than one external parent: 1, 6
183 [255]
183 [255]
184
184
185 Rebase and collapse - E onto H:
185 Rebase and collapse - E onto H:
186
186
187 $ hg rebase -s E --dest I --collapse # root (E) is not a merge
187 $ hg rebase -s E --dest I --collapse # root (E) is not a merge
188 abort: unknown revision 'I'!
188 abort: unknown revision 'I'!
189 [255]
189 [255]
190
190
191 $ hg tglog
191 $ hg tglog
192 o 7: 64e264db77f0 'G'
192 o 7: 64e264db77f0 'G'
193 |\
193 |\
194 | o 6: 11abe3fb10b8 'F'
194 | o 6: 11abe3fb10b8 'F'
195 | |
195 | |
196 | o 5: 49cb92066bfd 'E'
196 | o 5: 49cb92066bfd 'E'
197 | |
197 | |
198 o | 4: 4e4f9194f9f1 'D'
198 o | 4: 4e4f9194f9f1 'D'
199 |\|
199 |\|
200 | | o 3: 575c4b5ec114 'H'
200 | | o 3: 575c4b5ec114 'H'
201 | | |
201 | | |
202 o---+ 2: dc0947a82db8 'C'
202 o---+ 2: dc0947a82db8 'C'
203 / /
203 / /
204 o / 1: 112478962961 'B'
204 o / 1: 112478962961 'B'
205 |/
205 |/
206 o 0: 426bada5c675 'A'
206 o 0: 426bada5c675 'A'
207
207
208 $ hg manifest --rev tip
208 $ hg manifest --rev tip
209 A
209 A
210 B
210 B
211 C
211 C
212 E
212 E
213 F
213 F
214
214
215 $ cd ..
215 $ cd ..
216
216
217
217
218
218
219
219
220 Test that branchheads cache is updated correctly when doing a strip in which
220 Test that branchheads cache is updated correctly when doing a strip in which
221 the parent of the ancestor node to be stripped does not become a head and also,
221 the parent of the ancestor node to be stripped does not become a head and also,
222 the parent of a node that is a child of the node stripped becomes a head (node
222 the parent of a node that is a child of the node stripped becomes a head (node
223 3). The code is now much simpler and we could just test a simpler scenario
223 3). The code is now much simpler and we could just test a simpler scenario
224 We keep it the test this way in case new complexity is injected.
224 We keep it the test this way in case new complexity is injected.
225
225
226 Create repo b:
226 Create repo b:
227
227
228 $ hg init branch-heads
228 $ hg init branch-heads
229 $ cd branch-heads
229 $ cd branch-heads
230
230
231 $ hg debugdrawdag << 'EOF'
231 $ hg debugdrawdag << 'EOF'
232 > G
232 > G
233 > |\
233 > |\
234 > | F
234 > | F
235 > | |
235 > | |
236 > D E
236 > D E
237 > |\|
237 > |\|
238 > H C B
238 > H C B
239 > \|/
239 > \|/
240 > A
240 > A
241 > EOF
241 > EOF
242
242
243 $ hg heads --template="{rev}:{node} {branch}\n"
243 $ hg heads --template="{rev}:{node} {branch}\n"
244 7:64e264db77f061f16d9132b70c5a58e2461fb630 default
244 7:64e264db77f061f16d9132b70c5a58e2461fb630 default
245 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
245 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
246
246
247 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
247 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
248 64e264db77f061f16d9132b70c5a58e2461fb630 7
248 64e264db77f061f16d9132b70c5a58e2461fb630 7
249 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
249 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
250 64e264db77f061f16d9132b70c5a58e2461fb630 o default
250 64e264db77f061f16d9132b70c5a58e2461fb630 o default
251
251
252 $ hg strip 4
252 $ hg strip 4
253 saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg
253 saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg
254
254
255 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
255 $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
256 11abe3fb10b8689b560681094b17fe161871d043 5
256 11abe3fb10b8689b560681094b17fe161871d043 5
257 dc0947a82db884575bb76ea10ac97b08536bfa03 o default
257 dc0947a82db884575bb76ea10ac97b08536bfa03 o default
258 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
258 575c4b5ec114d64b681d33f8792853568bfb2b2c o default
259 11abe3fb10b8689b560681094b17fe161871d043 o default
259 11abe3fb10b8689b560681094b17fe161871d043 o default
260
260
261 $ hg heads --template="{rev}:{node} {branch}\n"
261 $ hg heads --template="{rev}:{node} {branch}\n"
262 5:11abe3fb10b8689b560681094b17fe161871d043 default
262 5:11abe3fb10b8689b560681094b17fe161871d043 default
263 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
263 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default
264 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default
264 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default
265
265
266 $ cd ..
266 $ cd ..
267
267
268
268
269
269
270 Preserves external parent
270 Preserves external parent
271
271
272 $ hg init external-parent
272 $ hg init external-parent
273 $ cd external-parent
273 $ cd external-parent
274
274
275 $ hg debugdrawdag << 'EOF'
275 $ hg debugdrawdag << 'EOF'
276 > H
276 > H
277 > |\
277 > |\
278 > | G
278 > | G
279 > | |
279 > | |
280 > | F # F/E = F\n
280 > | F # F/E = F\n
281 > | |
281 > | |
282 > D E # D/D = D\n
282 > D E # D/D = D\n
283 > |\|
283 > |\|
284 > I C B
284 > I C B
285 > \|/
285 > \|/
286 > A
286 > A
287 > EOF
287 > EOF
288
288
289 $ hg rebase -s F --dest I --collapse # root (F) is not a merge
289 $ hg rebase -s F --dest I --collapse # root (F) is not a merge
290 rebasing 6:c82b08f646f1 "F" (F)
290 rebasing 6:c82b08f646f1 "F" (F)
291 rebasing 7:a6db7fa104e1 "G" (G)
291 rebasing 7:a6db7fa104e1 "G" (G)
292 rebasing 8:e1d201b72d91 "H" (H tip)
292 rebasing 8:e1d201b72d91 "H" (H tip)
293 saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg
293 saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg
294
294
295 $ hg tglog
295 $ hg tglog
296 o 6: 681daa3e686d 'Collapsed revision
296 o 6: 681daa3e686d 'Collapsed revision
297 |\ * F
297 |\ * F
298 | | * G
298 | | * G
299 | | * H'
299 | | * H'
300 | | o 5: 49cb92066bfd 'E'
300 | | o 5: 49cb92066bfd 'E'
301 | | |
301 | | |
302 | o | 4: 09143c0bf13e 'D'
302 | o | 4: 09143c0bf13e 'D'
303 | |\|
303 | |\|
304 o | | 3: 08ebfeb61bac 'I'
304 o | | 3: 08ebfeb61bac 'I'
305 | | |
305 | | |
306 | o | 2: dc0947a82db8 'C'
306 | o | 2: dc0947a82db8 'C'
307 |/ /
307 |/ /
308 | o 1: 112478962961 'B'
308 | o 1: 112478962961 'B'
309 |/
309 |/
310 o 0: 426bada5c675 'A'
310 o 0: 426bada5c675 'A'
311
311
312 $ hg manifest --rev tip
312 $ hg manifest --rev tip
313 A
313 A
314 C
314 C
315 D
315 D
316 E
316 E
317 F
317 F
318 G
318 G
319 I
319 I
320
320
321 $ hg up tip -q
321 $ hg up tip -q
322 $ cat E
322 $ cat E
323 F
323 F
324
324
325 $ cd ..
325 $ cd ..
326
326
327 Rebasing from multiple bases:
327 Rebasing from multiple bases:
328
328
329 $ hg init multiple-bases
329 $ hg init multiple-bases
330 $ cd multiple-bases
330 $ cd multiple-bases
331 $ hg debugdrawdag << 'EOF'
331 $ hg debugdrawdag << 'EOF'
332 > C B
332 > C B
333 > D |/
333 > D |/
334 > |/
334 > |/
335 > A
335 > A
336 > EOF
336 > EOF
337 $ hg rebase --collapse -r 'B+C' -d D
337 $ hg rebase --collapse -r 'B+C' -d D
338 rebasing 1:fc2b737bb2e5 "B" (B)
338 rebasing 1:fc2b737bb2e5 "B" (B)
339 rebasing 2:dc0947a82db8 "C" (C)
339 rebasing 2:dc0947a82db8 "C" (C)
340 saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg
340 saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg
341 $ hg tglog
341 $ hg tglog
342 o 2: 2127ae44d291 'Collapsed revision
342 o 2: 2127ae44d291 'Collapsed revision
343 | * B
343 | * B
344 | * C'
344 | * C'
345 o 1: b18e25de2cf5 'D'
345 o 1: b18e25de2cf5 'D'
346 |
346 |
347 o 0: 426bada5c675 'A'
347 o 0: 426bada5c675 'A'
348
348
349 $ cd ..
349 $ cd ..
350
350
351 With non-contiguous commits:
351 With non-contiguous commits:
352
352
353 $ hg init non-contiguous
353 $ hg init non-contiguous
354 $ cd non-contiguous
354 $ cd non-contiguous
355 $ cat >> .hg/hgrc <<EOF
355 $ cat >> .hg/hgrc <<EOF
356 > [experimental]
356 > [experimental]
357 > evolution=all
357 > evolution=all
358 > EOF
358 > EOF
359
359
360 $ hg debugdrawdag << 'EOF'
360 $ hg debugdrawdag << 'EOF'
361 > F
361 > F
362 > |
362 > |
363 > E
363 > E
364 > |
364 > |
365 > D
365 > D
366 > |
366 > |
367 > C
367 > C
368 > |
368 > |
369 > B G
369 > B G
370 > |/
370 > |/
371 > A
371 > A
372 > EOF
372 > EOF
373
373
374 BROKEN: should be allowed
374 BROKEN: should be allowed
375 $ hg rebase --collapse -r 'B+D+F' -d G
375 $ hg rebase --collapse -r 'B+D+F' -d G
376 abort: unable to collapse on top of 2, there is more than one external parent: 3, 5
376 abort: unable to collapse on top of 2, there is more than one external parent: 3, 5
377 [255]
377 [255]
378 $ cd ..
378 $ cd ..
379
379
380
380
381 $ hg init multiple-external-parents-2
381 $ hg init multiple-external-parents-2
382 $ cd multiple-external-parents-2
382 $ cd multiple-external-parents-2
383 $ hg debugdrawdag << 'EOF'
383 $ hg debugdrawdag << 'EOF'
384 > D G
384 > D G
385 > |\ /|
385 > |\ /|
386 > B C E F
386 > B C E F
387 > \| |/
387 > \| |/
388 > \ H /
388 > \ H /
389 > \|/
389 > \|/
390 > A
390 > A
391 > EOF
391 > EOF
392
392
393 $ hg rebase --collapse -d H -s 'B+F'
393 $ hg rebase --collapse -d H -s 'B+F'
394 abort: unable to collapse on top of 5, there is more than one external parent: 1, 3
394 abort: unable to collapse on top of 5, there is more than one external parent: 1, 3
395 [255]
395 [255]
396 $ cd ..
396 $ cd ..
397
397
398 With internal merge:
398 With internal merge:
399
399
400 $ hg init internal-merge
400 $ hg init internal-merge
401 $ cd internal-merge
401 $ cd internal-merge
402
402
403 $ hg debugdrawdag << 'EOF'
403 $ hg debugdrawdag << 'EOF'
404 > E
404 > E
405 > |\
405 > |\
406 > C D
406 > C D
407 > |/
407 > |/
408 > F B
408 > F B
409 > |/
409 > |/
410 > A
410 > A
411 > EOF
411 > EOF
412
412
413
413
414 $ hg rebase -s B --collapse --dest F
414 $ hg rebase -s B --collapse --dest F
415 rebasing 1:112478962961 "B" (B)
415 rebasing 1:112478962961 "B" (B)
416 rebasing 3:26805aba1e60 "C" (C)
416 rebasing 3:26805aba1e60 "C" (C)
417 rebasing 4:be0ef73c17ad "D" (D)
417 rebasing 4:be0ef73c17ad "D" (D)
418 rebasing 5:02c4367d6973 "E" (E tip)
418 rebasing 5:02c4367d6973 "E" (E tip)
419 saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg
419 saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg
420
420
421 $ hg tglog
421 $ hg tglog
422 o 2: c0512a1797b0 'Collapsed revision
422 o 2: c0512a1797b0 'Collapsed revision
423 | * B
423 | * B
424 | * C
424 | * C
425 | * D
425 | * D
426 | * E'
426 | * E'
427 o 1: 8908a377a434 'F'
427 o 1: 8908a377a434 'F'
428 |
428 |
429 o 0: 426bada5c675 'A'
429 o 0: 426bada5c675 'A'
430
430
431 $ hg manifest --rev tip
431 $ hg manifest --rev tip
432 A
432 A
433 B
433 B
434 C
434 C
435 D
435 D
436 F
436 F
437 $ cd ..
437 $ cd ..
438
438
439 Interactions between collapse and keepbranches
439 Interactions between collapse and keepbranches
440 $ hg init e
440 $ hg init e
441 $ cd e
441 $ cd e
442 $ echo 'a' > a
442 $ echo 'a' > a
443 $ hg ci -Am 'A'
443 $ hg ci -Am 'A'
444 adding a
444 adding a
445
445
446 $ hg branch 'one'
446 $ hg branch 'one'
447 marked working directory as branch one
447 marked working directory as branch one
448 (branches are permanent and global, did you want a bookmark?)
448 (branches are permanent and global, did you want a bookmark?)
449 $ echo 'b' > b
449 $ echo 'b' > b
450 $ hg ci -Am 'B'
450 $ hg ci -Am 'B'
451 adding b
451 adding b
452
452
453 $ hg branch 'two'
453 $ hg branch 'two'
454 marked working directory as branch two
454 marked working directory as branch two
455 $ echo 'c' > c
455 $ echo 'c' > c
456 $ hg ci -Am 'C'
456 $ hg ci -Am 'C'
457 adding c
457 adding c
458
458
459 $ hg up -q 0
459 $ hg up -q 0
460 $ echo 'd' > d
460 $ echo 'd' > d
461 $ hg ci -Am 'D'
461 $ hg ci -Am 'D'
462 adding d
462 adding d
463
463
464 $ hg tglog
464 $ hg tglog
465 @ 3: 41acb9dca9eb 'D'
465 @ 3: 41acb9dca9eb 'D'
466 |
466 |
467 | o 2: 8ac4a08debf1 'C' two
467 | o 2: 8ac4a08debf1 'C' two
468 | |
468 | |
469 | o 1: 1ba175478953 'B' one
469 | o 1: 1ba175478953 'B' one
470 |/
470 |/
471 o 0: 1994f17a630e 'A'
471 o 0: 1994f17a630e 'A'
472
472
473 $ hg rebase --keepbranches --collapse -s 1 -d 3
473 $ hg rebase --keepbranches --collapse -s 1 -d 3
474 abort: cannot collapse multiple named branches
474 abort: cannot collapse multiple named branches
475 [255]
475 [255]
476
476
477 $ repeatchange() {
477 $ repeatchange() {
478 > hg checkout $1
478 > hg checkout $1
479 > hg cp d z
479 > hg cp d z
480 > echo blah >> z
480 > echo blah >> z
481 > hg commit -Am "$2" --user "$3"
481 > hg commit -Am "$2" --user "$3"
482 > }
482 > }
483 $ repeatchange 3 "E" "user1"
483 $ repeatchange 3 "E" "user1"
484 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
484 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
485 $ repeatchange 3 "E" "user2"
485 $ repeatchange 3 "E" "user2"
486 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
486 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
487 created new head
487 created new head
488 $ hg tglog
488 $ hg tglog
489 @ 5: fbfb97b1089a 'E'
489 @ 5: fbfb97b1089a 'E'
490 |
490 |
491 | o 4: f338eb3c2c7c 'E'
491 | o 4: f338eb3c2c7c 'E'
492 |/
492 |/
493 o 3: 41acb9dca9eb 'D'
493 o 3: 41acb9dca9eb 'D'
494 |
494 |
495 | o 2: 8ac4a08debf1 'C' two
495 | o 2: 8ac4a08debf1 'C' two
496 | |
496 | |
497 | o 1: 1ba175478953 'B' one
497 | o 1: 1ba175478953 'B' one
498 |/
498 |/
499 o 0: 1994f17a630e 'A'
499 o 0: 1994f17a630e 'A'
500
500
501 $ hg rebase -s 5 -d 4
501 $ hg rebase -s 5 -d 4
502 rebasing 5:fbfb97b1089a "E" (tip)
502 rebasing 5:fbfb97b1089a "E" (tip)
503 note: rebase of 5:fbfb97b1089a "E" (tip) created no changes to commit
503 note: not rebasing 5:fbfb97b1089a "E" (tip), its destination already has all its changes
504 saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-rebase.hg
504 saved backup bundle to $TESTTMP/e/.hg/strip-backup/fbfb97b1089a-553e1d85-rebase.hg
505 $ hg tglog
505 $ hg tglog
506 @ 4: f338eb3c2c7c 'E'
506 @ 4: f338eb3c2c7c 'E'
507 |
507 |
508 o 3: 41acb9dca9eb 'D'
508 o 3: 41acb9dca9eb 'D'
509 |
509 |
510 | o 2: 8ac4a08debf1 'C' two
510 | o 2: 8ac4a08debf1 'C' two
511 | |
511 | |
512 | o 1: 1ba175478953 'B' one
512 | o 1: 1ba175478953 'B' one
513 |/
513 |/
514 o 0: 1994f17a630e 'A'
514 o 0: 1994f17a630e 'A'
515
515
516 $ hg export tip
516 $ hg export tip
517 # HG changeset patch
517 # HG changeset patch
518 # User user1
518 # User user1
519 # Date 0 0
519 # Date 0 0
520 # Thu Jan 01 00:00:00 1970 +0000
520 # Thu Jan 01 00:00:00 1970 +0000
521 # Node ID f338eb3c2c7cc5b5915676a2376ba7ac558c5213
521 # Node ID f338eb3c2c7cc5b5915676a2376ba7ac558c5213
522 # Parent 41acb9dca9eb976e84cd21fcb756b4afa5a35c09
522 # Parent 41acb9dca9eb976e84cd21fcb756b4afa5a35c09
523 E
523 E
524
524
525 diff -r 41acb9dca9eb -r f338eb3c2c7c z
525 diff -r 41acb9dca9eb -r f338eb3c2c7c z
526 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
526 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
527 +++ b/z Thu Jan 01 00:00:00 1970 +0000
527 +++ b/z Thu Jan 01 00:00:00 1970 +0000
528 @@ -0,0 +1,2 @@
528 @@ -0,0 +1,2 @@
529 +d
529 +d
530 +blah
530 +blah
531
531
532 $ cd ..
532 $ cd ..
533
533
534 Rebase, collapse and copies
534 Rebase, collapse and copies
535
535
536 $ hg init copies
536 $ hg init copies
537 $ cd copies
537 $ cd copies
538 $ hg unbundle "$TESTDIR/bundles/renames.hg"
538 $ hg unbundle "$TESTDIR/bundles/renames.hg"
539 adding changesets
539 adding changesets
540 adding manifests
540 adding manifests
541 adding file changes
541 adding file changes
542 added 4 changesets with 11 changes to 7 files (+1 heads)
542 added 4 changesets with 11 changes to 7 files (+1 heads)
543 new changesets f447d5abf5ea:338e84e2e558 (4 drafts)
543 new changesets f447d5abf5ea:338e84e2e558 (4 drafts)
544 (run 'hg heads' to see heads, 'hg merge' to merge)
544 (run 'hg heads' to see heads, 'hg merge' to merge)
545 $ hg up -q tip
545 $ hg up -q tip
546 $ hg tglog
546 $ hg tglog
547 @ 3: 338e84e2e558 'move2'
547 @ 3: 338e84e2e558 'move2'
548 |
548 |
549 o 2: 6e7340ee38c0 'move1'
549 o 2: 6e7340ee38c0 'move1'
550 |
550 |
551 | o 1: 1352765a01d4 'change'
551 | o 1: 1352765a01d4 'change'
552 |/
552 |/
553 o 0: f447d5abf5ea 'add'
553 o 0: f447d5abf5ea 'add'
554
554
555 $ hg rebase --collapse -d 1
555 $ hg rebase --collapse -d 1
556 rebasing 2:6e7340ee38c0 "move1"
556 rebasing 2:6e7340ee38c0 "move1"
557 merging a and d to d
557 merging a and d to d
558 merging b and e to e
558 merging b and e to e
559 merging c and f to f
559 merging c and f to f
560 rebasing 3:338e84e2e558 "move2" (tip)
560 rebasing 3:338e84e2e558 "move2" (tip)
561 merging f and c to c
561 merging f and c to c
562 merging e and g to g
562 merging e and g to g
563 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg
563 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg
564 $ hg st
564 $ hg st
565 $ hg st --copies --change tip
565 $ hg st --copies --change tip
566 A d
566 A d
567 a
567 a
568 A g
568 A g
569 b
569 b
570 R b
570 R b
571 $ hg up tip -q
571 $ hg up tip -q
572 $ cat c
572 $ cat c
573 c
573 c
574 c
574 c
575 $ cat d
575 $ cat d
576 a
576 a
577 a
577 a
578 $ cat g
578 $ cat g
579 b
579 b
580 b
580 b
581 $ hg log -r . --template "{file_copies}\n"
581 $ hg log -r . --template "{file_copies}\n"
582 d (a)g (b)
582 d (a)g (b)
583
583
584 Test collapsing a middle revision in-place
584 Test collapsing a middle revision in-place
585
585
586 $ hg tglog
586 $ hg tglog
587 @ 2: 64b456429f67 'Collapsed revision
587 @ 2: 64b456429f67 'Collapsed revision
588 | * move1
588 | * move1
589 | * move2'
589 | * move2'
590 o 1: 1352765a01d4 'change'
590 o 1: 1352765a01d4 'change'
591 |
591 |
592 o 0: f447d5abf5ea 'add'
592 o 0: f447d5abf5ea 'add'
593
593
594 $ hg rebase --collapse -r 1 -d 0
594 $ hg rebase --collapse -r 1 -d 0
595 abort: can't remove original changesets with unrebased descendants
595 abort: can't remove original changesets with unrebased descendants
596 (use --keep to keep original changesets)
596 (use --keep to keep original changesets)
597 [255]
597 [255]
598
598
599 Test collapsing in place
599 Test collapsing in place
600
600
601 $ hg rebase --collapse -b . -d 0
601 $ hg rebase --collapse -b . -d 0
602 rebasing 1:1352765a01d4 "change"
602 rebasing 1:1352765a01d4 "change"
603 rebasing 2:64b456429f67 "Collapsed revision" (tip)
603 rebasing 2:64b456429f67 "Collapsed revision" (tip)
604 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg
604 saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg
605 $ hg st --change tip --copies
605 $ hg st --change tip --copies
606 M a
606 M a
607 M c
607 M c
608 A d
608 A d
609 a
609 a
610 A g
610 A g
611 b
611 b
612 R b
612 R b
613 $ hg up tip -q
613 $ hg up tip -q
614 $ cat a
614 $ cat a
615 a
615 a
616 a
616 a
617 $ cat c
617 $ cat c
618 c
618 c
619 c
619 c
620 $ cat d
620 $ cat d
621 a
621 a
622 a
622 a
623 $ cat g
623 $ cat g
624 b
624 b
625 b
625 b
626 $ cd ..
626 $ cd ..
627
627
628
628
629 Test stripping a revision with another child
629 Test stripping a revision with another child
630
630
631 $ hg init f
631 $ hg init f
632 $ cd f
632 $ cd f
633
633
634 $ hg debugdrawdag << 'EOF'
634 $ hg debugdrawdag << 'EOF'
635 > C B
635 > C B
636 > |/
636 > |/
637 > A
637 > A
638 > EOF
638 > EOF
639
639
640 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
640 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
641 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C
641 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C
642 1:112478962961147124edd43549aedd1a335e44bf default: B
642 1:112478962961147124edd43549aedd1a335e44bf default: B
643
643
644 $ hg strip C
644 $ hg strip C
645 saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg
645 saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg
646
646
647 $ hg tglog
647 $ hg tglog
648 o 1: 112478962961 'B'
648 o 1: 112478962961 'B'
649 |
649 |
650 o 0: 426bada5c675 'A'
650 o 0: 426bada5c675 'A'
651
651
652
652
653
653
654 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
654 $ hg heads --template="{rev}:{node} {branch}: {desc}\n"
655 1:112478962961147124edd43549aedd1a335e44bf default: B
655 1:112478962961147124edd43549aedd1a335e44bf default: B
656
656
657 $ cd ..
657 $ cd ..
658
658
659 Test collapsing changes that add then remove a file
659 Test collapsing changes that add then remove a file
660
660
661 $ hg init collapseaddremove
661 $ hg init collapseaddremove
662 $ cd collapseaddremove
662 $ cd collapseaddremove
663
663
664 $ touch base
664 $ touch base
665 $ hg commit -Am base
665 $ hg commit -Am base
666 adding base
666 adding base
667 $ touch a
667 $ touch a
668 $ hg commit -Am a
668 $ hg commit -Am a
669 adding a
669 adding a
670 $ hg rm a
670 $ hg rm a
671 $ touch b
671 $ touch b
672 $ hg commit -Am b
672 $ hg commit -Am b
673 adding b
673 adding b
674 $ hg book foo
674 $ hg book foo
675 $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
675 $ hg rebase -d 0 -r "1::2" --collapse -m collapsed
676 rebasing 1:6d8d9f24eec3 "a"
676 rebasing 1:6d8d9f24eec3 "a"
677 rebasing 2:1cc73eca5ecc "b" (foo tip)
677 rebasing 2:1cc73eca5ecc "b" (foo tip)
678 saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
678 saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg
679 $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
679 $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
680 @ 1: 'collapsed' foo
680 @ 1: 'collapsed' foo
681 |
681 |
682 o 0: 'base'
682 o 0: 'base'
683
683
684 $ hg manifest --rev tip
684 $ hg manifest --rev tip
685 b
685 b
686 base
686 base
687
687
688 $ cd ..
688 $ cd ..
689
689
690 Test that rebase --collapse will remember message after
690 Test that rebase --collapse will remember message after
691 running into merge conflict and invoking rebase --continue.
691 running into merge conflict and invoking rebase --continue.
692
692
693 $ hg init collapse_remember_message
693 $ hg init collapse_remember_message
694 $ cd collapse_remember_message
694 $ cd collapse_remember_message
695 $ hg debugdrawdag << 'EOF'
695 $ hg debugdrawdag << 'EOF'
696 > C B # B/A = B\n
696 > C B # B/A = B\n
697 > |/ # C/A = C\n
697 > |/ # C/A = C\n
698 > A
698 > A
699 > EOF
699 > EOF
700 $ hg rebase --collapse -m "new message" -b B -d C
700 $ hg rebase --collapse -m "new message" -b B -d C
701 rebasing 1:81e5401e4d37 "B" (B)
701 rebasing 1:81e5401e4d37 "B" (B)
702 merging A
702 merging A
703 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
703 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
704 unresolved conflicts (see hg resolve, then hg rebase --continue)
704 unresolved conflicts (see hg resolve, then hg rebase --continue)
705 [1]
705 [1]
706 $ rm A.orig
706 $ rm A.orig
707 $ hg resolve --mark A
707 $ hg resolve --mark A
708 (no more unresolved files)
708 (no more unresolved files)
709 continue: hg rebase --continue
709 continue: hg rebase --continue
710 $ hg rebase --continue
710 $ hg rebase --continue
711 rebasing 1:81e5401e4d37 "B" (B)
711 rebasing 1:81e5401e4d37 "B" (B)
712 saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg
712 saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg
713 $ hg log
713 $ hg log
714 changeset: 2:17186933e123
714 changeset: 2:17186933e123
715 tag: tip
715 tag: tip
716 user: test
716 user: test
717 date: Thu Jan 01 00:00:00 1970 +0000
717 date: Thu Jan 01 00:00:00 1970 +0000
718 summary: new message
718 summary: new message
719
719
720 changeset: 1:043039e9df84
720 changeset: 1:043039e9df84
721 tag: C
721 tag: C
722 user: test
722 user: test
723 date: Thu Jan 01 00:00:00 1970 +0000
723 date: Thu Jan 01 00:00:00 1970 +0000
724 summary: C
724 summary: C
725
725
726 changeset: 0:426bada5c675
726 changeset: 0:426bada5c675
727 tag: A
727 tag: A
728 user: test
728 user: test
729 date: Thu Jan 01 00:00:00 1970 +0000
729 date: Thu Jan 01 00:00:00 1970 +0000
730 summary: A
730 summary: A
731
731
732 $ cd ..
732 $ cd ..
733
733
734 Test aborted editor on final message
734 Test aborted editor on final message
735
735
736 $ HGMERGE=:merge3
736 $ HGMERGE=:merge3
737 $ export HGMERGE
737 $ export HGMERGE
738 $ hg init aborted-editor
738 $ hg init aborted-editor
739 $ cd aborted-editor
739 $ cd aborted-editor
740 $ hg debugdrawdag << 'EOF'
740 $ hg debugdrawdag << 'EOF'
741 > C # D/A = D\n
741 > C # D/A = D\n
742 > | # C/A = C\n
742 > | # C/A = C\n
743 > B D # B/A = B\n
743 > B D # B/A = B\n
744 > |/ # A/A = A\n
744 > |/ # A/A = A\n
745 > A
745 > A
746 > EOF
746 > EOF
747 $ hg rebase --collapse -t internal:merge3 -s B -d D
747 $ hg rebase --collapse -t internal:merge3 -s B -d D
748 rebasing 1:f899f3910ce7 "B" (B)
748 rebasing 1:f899f3910ce7 "B" (B)
749 merging A
749 merging A
750 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
750 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
751 unresolved conflicts (see hg resolve, then hg rebase --continue)
751 unresolved conflicts (see hg resolve, then hg rebase --continue)
752 [1]
752 [1]
753 $ hg tglog
753 $ hg tglog
754 o 3: 63668d570d21 'C'
754 o 3: 63668d570d21 'C'
755 |
755 |
756 | @ 2: 82b8abf9c185 'D'
756 | @ 2: 82b8abf9c185 'D'
757 | |
757 | |
758 @ | 1: f899f3910ce7 'B'
758 @ | 1: f899f3910ce7 'B'
759 |/
759 |/
760 o 0: 4a2df7238c3b 'A'
760 o 0: 4a2df7238c3b 'A'
761
761
762 $ cat A
762 $ cat A
763 <<<<<<< dest: 82b8abf9c185 D - test: D
763 <<<<<<< dest: 82b8abf9c185 D - test: D
764 D
764 D
765 ||||||| base
765 ||||||| base
766 A
766 A
767 =======
767 =======
768 B
768 B
769 >>>>>>> source: f899f3910ce7 B - test: B
769 >>>>>>> source: f899f3910ce7 B - test: B
770 $ echo BC > A
770 $ echo BC > A
771 $ hg resolve -m
771 $ hg resolve -m
772 (no more unresolved files)
772 (no more unresolved files)
773 continue: hg rebase --continue
773 continue: hg rebase --continue
774 $ hg rebase --continue
774 $ hg rebase --continue
775 rebasing 1:f899f3910ce7 "B" (B)
775 rebasing 1:f899f3910ce7 "B" (B)
776 rebasing 3:63668d570d21 "C" (C tip)
776 rebasing 3:63668d570d21 "C" (C tip)
777 merging A
777 merging A
778 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
778 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
779 unresolved conflicts (see hg resolve, then hg rebase --continue)
779 unresolved conflicts (see hg resolve, then hg rebase --continue)
780 [1]
780 [1]
781 $ hg tglog
781 $ hg tglog
782 @ 3: 63668d570d21 'C'
782 @ 3: 63668d570d21 'C'
783 |
783 |
784 | @ 2: 82b8abf9c185 'D'
784 | @ 2: 82b8abf9c185 'D'
785 | |
785 | |
786 o | 1: f899f3910ce7 'B'
786 o | 1: f899f3910ce7 'B'
787 |/
787 |/
788 o 0: 4a2df7238c3b 'A'
788 o 0: 4a2df7238c3b 'A'
789
789
790 $ cat A
790 $ cat A
791 <<<<<<< dest: 82b8abf9c185 D - test: D
791 <<<<<<< dest: 82b8abf9c185 D - test: D
792 BC
792 BC
793 ||||||| base
793 ||||||| base
794 B
794 B
795 =======
795 =======
796 C
796 C
797 >>>>>>> source: 63668d570d21 C tip - test: C
797 >>>>>>> source: 63668d570d21 C tip - test: C
798 $ echo BD > A
798 $ echo BD > A
799 $ hg resolve -m
799 $ hg resolve -m
800 (no more unresolved files)
800 (no more unresolved files)
801 continue: hg rebase --continue
801 continue: hg rebase --continue
802 $ HGEDITOR=false hg rebase --continue --config ui.interactive=1
802 $ HGEDITOR=false hg rebase --continue --config ui.interactive=1
803 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
803 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
804 rebasing 3:63668d570d21 "C" (C tip)
804 rebasing 3:63668d570d21 "C" (C tip)
805 abort: edit failed: false exited with status 1
805 abort: edit failed: false exited with status 1
806 [255]
806 [255]
807 $ hg tglog
807 $ hg tglog
808 o 3: 63668d570d21 'C'
808 o 3: 63668d570d21 'C'
809 |
809 |
810 | @ 2: 82b8abf9c185 'D'
810 | @ 2: 82b8abf9c185 'D'
811 | |
811 | |
812 o | 1: f899f3910ce7 'B'
812 o | 1: f899f3910ce7 'B'
813 |/
813 |/
814 o 0: 4a2df7238c3b 'A'
814 o 0: 4a2df7238c3b 'A'
815
815
816 $ hg rebase --continue
816 $ hg rebase --continue
817 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
817 already rebased 1:f899f3910ce7 "B" (B) as 82b8abf9c185
818 already rebased 3:63668d570d21 "C" (C tip) as 82b8abf9c185
818 already rebased 3:63668d570d21 "C" (C tip) as 82b8abf9c185
819 saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg
819 saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg
@@ -1,317 +1,317 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [alias]
5 > [alias]
6 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
6 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
7 >
7 >
8 > [extensions]
8 > [extensions]
9 > drawdag=$TESTDIR/drawdag.py
9 > drawdag=$TESTDIR/drawdag.py
10 > EOF
10 > EOF
11
11
12 Rebasing D onto B detaching from C (one commit):
12 Rebasing D onto B detaching from C (one commit):
13
13
14 $ hg init a1
14 $ hg init a1
15 $ cd a1
15 $ cd a1
16
16
17 $ hg debugdrawdag <<EOF
17 $ hg debugdrawdag <<EOF
18 > D
18 > D
19 > |
19 > |
20 > C B
20 > C B
21 > |/
21 > |/
22 > A
22 > A
23 > EOF
23 > EOF
24 $ hg phase --force --secret D
24 $ hg phase --force --secret D
25
25
26 $ hg rebase -s D -d B
26 $ hg rebase -s D -d B
27 rebasing 3:e7b3f00ed42e "D" (D tip)
27 rebasing 3:e7b3f00ed42e "D" (D tip)
28 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/e7b3f00ed42e-6f368371-rebase.hg
28 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/e7b3f00ed42e-6f368371-rebase.hg
29
29
30 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
30 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
31 o 3:secret 'D'
31 o 3:secret 'D'
32 |
32 |
33 | o 2:draft 'C'
33 | o 2:draft 'C'
34 | |
34 | |
35 o | 1:draft 'B'
35 o | 1:draft 'B'
36 |/
36 |/
37 o 0:draft 'A'
37 o 0:draft 'A'
38
38
39 $ hg manifest --rev tip
39 $ hg manifest --rev tip
40 A
40 A
41 B
41 B
42 D
42 D
43
43
44 $ cd ..
44 $ cd ..
45
45
46
46
47 Rebasing D onto B detaching from C (two commits):
47 Rebasing D onto B detaching from C (two commits):
48
48
49 $ hg init a2
49 $ hg init a2
50 $ cd a2
50 $ cd a2
51
51
52 $ hg debugdrawdag <<EOF
52 $ hg debugdrawdag <<EOF
53 > E
53 > E
54 > |
54 > |
55 > D
55 > D
56 > |
56 > |
57 > C B
57 > C B
58 > |/
58 > |/
59 > A
59 > A
60 > EOF
60 > EOF
61
61
62 $ hg rebase -s D -d B
62 $ hg rebase -s D -d B
63 rebasing 3:e7b3f00ed42e "D" (D)
63 rebasing 3:e7b3f00ed42e "D" (D)
64 rebasing 4:69a34c08022a "E" (E tip)
64 rebasing 4:69a34c08022a "E" (E tip)
65 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
65 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
66
66
67 $ hg tglog
67 $ hg tglog
68 o 4: ee79e0744528 'E'
68 o 4: ee79e0744528 'E'
69 |
69 |
70 o 3: 10530e1d72d9 'D'
70 o 3: 10530e1d72d9 'D'
71 |
71 |
72 | o 2: dc0947a82db8 'C'
72 | o 2: dc0947a82db8 'C'
73 | |
73 | |
74 o | 1: 112478962961 'B'
74 o | 1: 112478962961 'B'
75 |/
75 |/
76 o 0: 426bada5c675 'A'
76 o 0: 426bada5c675 'A'
77
77
78 $ hg manifest --rev tip
78 $ hg manifest --rev tip
79 A
79 A
80 B
80 B
81 D
81 D
82 E
82 E
83
83
84 $ cd ..
84 $ cd ..
85
85
86 Rebasing C onto B using detach (same as not using it):
86 Rebasing C onto B using detach (same as not using it):
87
87
88 $ hg init a3
88 $ hg init a3
89 $ cd a3
89 $ cd a3
90
90
91 $ hg debugdrawdag <<EOF
91 $ hg debugdrawdag <<EOF
92 > D
92 > D
93 > |
93 > |
94 > C B
94 > C B
95 > |/
95 > |/
96 > A
96 > A
97 > EOF
97 > EOF
98
98
99 $ hg rebase -s C -d B
99 $ hg rebase -s C -d B
100 rebasing 2:dc0947a82db8 "C" (C)
100 rebasing 2:dc0947a82db8 "C" (C)
101 rebasing 3:e7b3f00ed42e "D" (D tip)
101 rebasing 3:e7b3f00ed42e "D" (D tip)
102 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/dc0947a82db8-b8481714-rebase.hg
102 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/dc0947a82db8-b8481714-rebase.hg
103
103
104 $ hg tglog
104 $ hg tglog
105 o 3: 7375f3dbfb0f 'D'
105 o 3: 7375f3dbfb0f 'D'
106 |
106 |
107 o 2: bbfdd6cb49aa 'C'
107 o 2: bbfdd6cb49aa 'C'
108 |
108 |
109 o 1: 112478962961 'B'
109 o 1: 112478962961 'B'
110 |
110 |
111 o 0: 426bada5c675 'A'
111 o 0: 426bada5c675 'A'
112
112
113 $ hg manifest --rev tip
113 $ hg manifest --rev tip
114 A
114 A
115 B
115 B
116 C
116 C
117 D
117 D
118
118
119 $ cd ..
119 $ cd ..
120
120
121
121
122 Rebasing D onto B detaching from C and collapsing:
122 Rebasing D onto B detaching from C and collapsing:
123
123
124 $ hg init a4
124 $ hg init a4
125 $ cd a4
125 $ cd a4
126
126
127 $ hg debugdrawdag <<EOF
127 $ hg debugdrawdag <<EOF
128 > E
128 > E
129 > |
129 > |
130 > D
130 > D
131 > |
131 > |
132 > C B
132 > C B
133 > |/
133 > |/
134 > A
134 > A
135 > EOF
135 > EOF
136 $ hg phase --force --secret E
136 $ hg phase --force --secret E
137
137
138 $ hg rebase --collapse -s D -d B
138 $ hg rebase --collapse -s D -d B
139 rebasing 3:e7b3f00ed42e "D" (D)
139 rebasing 3:e7b3f00ed42e "D" (D)
140 rebasing 4:69a34c08022a "E" (E tip)
140 rebasing 4:69a34c08022a "E" (E tip)
141 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
141 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/e7b3f00ed42e-a2ec7cea-rebase.hg
142
142
143 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
143 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
144 o 3:secret 'Collapsed revision
144 o 3:secret 'Collapsed revision
145 | * D
145 | * D
146 | * E'
146 | * E'
147 | o 2:draft 'C'
147 | o 2:draft 'C'
148 | |
148 | |
149 o | 1:draft 'B'
149 o | 1:draft 'B'
150 |/
150 |/
151 o 0:draft 'A'
151 o 0:draft 'A'
152
152
153 $ hg manifest --rev tip
153 $ hg manifest --rev tip
154 A
154 A
155 B
155 B
156 D
156 D
157 E
157 E
158
158
159 $ cd ..
159 $ cd ..
160
160
161 Rebasing across null as ancestor
161 Rebasing across null as ancestor
162 $ hg init a5
162 $ hg init a5
163 $ cd a5
163 $ cd a5
164
164
165 $ hg debugdrawdag <<EOF
165 $ hg debugdrawdag <<EOF
166 > E
166 > E
167 > |
167 > |
168 > D
168 > D
169 > |
169 > |
170 > C
170 > C
171 > |
171 > |
172 > A B
172 > A B
173 > EOF
173 > EOF
174
174
175 $ hg rebase -s C -d B
175 $ hg rebase -s C -d B
176 rebasing 2:dc0947a82db8 "C" (C)
176 rebasing 2:dc0947a82db8 "C" (C)
177 rebasing 3:e7b3f00ed42e "D" (D)
177 rebasing 3:e7b3f00ed42e "D" (D)
178 rebasing 4:69a34c08022a "E" (E tip)
178 rebasing 4:69a34c08022a "E" (E tip)
179 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/dc0947a82db8-3eefec98-rebase.hg
179 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/dc0947a82db8-3eefec98-rebase.hg
180
180
181 $ hg tglog
181 $ hg tglog
182 o 4: e3d0c70d606d 'E'
182 o 4: e3d0c70d606d 'E'
183 |
183 |
184 o 3: e9153d36a1af 'D'
184 o 3: e9153d36a1af 'D'
185 |
185 |
186 o 2: a7ac28b870a8 'C'
186 o 2: a7ac28b870a8 'C'
187 |
187 |
188 o 1: fc2b737bb2e5 'B'
188 o 1: fc2b737bb2e5 'B'
189
189
190 o 0: 426bada5c675 'A'
190 o 0: 426bada5c675 'A'
191
191
192 $ hg rebase -d 1 -s 3
192 $ hg rebase -d 1 -s 3
193 rebasing 3:e9153d36a1af "D"
193 rebasing 3:e9153d36a1af "D"
194 rebasing 4:e3d0c70d606d "E" (tip)
194 rebasing 4:e3d0c70d606d "E" (tip)
195 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/e9153d36a1af-db7388ed-rebase.hg
195 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/e9153d36a1af-db7388ed-rebase.hg
196 $ hg tglog
196 $ hg tglog
197 o 4: 2c24e540eccd 'E'
197 o 4: 2c24e540eccd 'E'
198 |
198 |
199 o 3: 73f786ed52ff 'D'
199 o 3: 73f786ed52ff 'D'
200 |
200 |
201 | o 2: a7ac28b870a8 'C'
201 | o 2: a7ac28b870a8 'C'
202 |/
202 |/
203 o 1: fc2b737bb2e5 'B'
203 o 1: fc2b737bb2e5 'B'
204
204
205 o 0: 426bada5c675 'A'
205 o 0: 426bada5c675 'A'
206
206
207 $ cd ..
207 $ cd ..
208
208
209 Verify that target is not selected as external rev (issue3085)
209 Verify that target is not selected as external rev (issue3085)
210
210
211 $ hg init a6
211 $ hg init a6
212 $ cd a6
212 $ cd a6
213
213
214 $ hg debugdrawdag <<EOF
214 $ hg debugdrawdag <<EOF
215 > H
215 > H
216 > | G
216 > | G
217 > |/|
217 > |/|
218 > F E
218 > F E
219 > |/
219 > |/
220 > A
220 > A
221 > EOF
221 > EOF
222 $ hg up -q G
222 $ hg up -q G
223
223
224 $ echo "I" >> E
224 $ echo "I" >> E
225 $ hg ci -m "I"
225 $ hg ci -m "I"
226 $ hg tag --local I
226 $ hg tag --local I
227 $ hg merge H
227 $ hg merge H
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 (branch merge, don't forget to commit)
229 (branch merge, don't forget to commit)
230 $ hg ci -m "Merge"
230 $ hg ci -m "Merge"
231 $ echo "J" >> F
231 $ echo "J" >> F
232 $ hg ci -m "J"
232 $ hg ci -m "J"
233 $ hg tglog
233 $ hg tglog
234 @ 7: c6aaf0d259c0 'J'
234 @ 7: c6aaf0d259c0 'J'
235 |
235 |
236 o 6: 0cfbc7e8faaf 'Merge'
236 o 6: 0cfbc7e8faaf 'Merge'
237 |\
237 |\
238 | o 5: b92d164ad3cb 'I'
238 | o 5: b92d164ad3cb 'I'
239 | |
239 | |
240 o | 4: 4ea5b230dea3 'H'
240 o | 4: 4ea5b230dea3 'H'
241 | |
241 | |
242 | o 3: c6001eacfde5 'G'
242 | o 3: c6001eacfde5 'G'
243 |/|
243 |/|
244 o | 2: 8908a377a434 'F'
244 o | 2: 8908a377a434 'F'
245 | |
245 | |
246 | o 1: 7fb047a69f22 'E'
246 | o 1: 7fb047a69f22 'E'
247 |/
247 |/
248 o 0: 426bada5c675 'A'
248 o 0: 426bada5c675 'A'
249
249
250 $ hg rebase -s I -d H --collapse --config ui.merge=internal:other
250 $ hg rebase -s I -d H --collapse --config ui.merge=internal:other
251 rebasing 5:b92d164ad3cb "I" (I)
251 rebasing 5:b92d164ad3cb "I" (I)
252 rebasing 6:0cfbc7e8faaf "Merge"
252 rebasing 6:0cfbc7e8faaf "Merge"
253 rebasing 7:c6aaf0d259c0 "J" (tip)
253 rebasing 7:c6aaf0d259c0 "J" (tip)
254 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/b92d164ad3cb-88fd7ab7-rebase.hg
254 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/b92d164ad3cb-88fd7ab7-rebase.hg
255
255
256 $ hg tglog
256 $ hg tglog
257 @ 5: 65079693dac4 'Collapsed revision
257 @ 5: 65079693dac4 'Collapsed revision
258 | * I
258 | * I
259 | * Merge
259 | * Merge
260 | * J'
260 | * J'
261 o 4: 4ea5b230dea3 'H'
261 o 4: 4ea5b230dea3 'H'
262 |
262 |
263 | o 3: c6001eacfde5 'G'
263 | o 3: c6001eacfde5 'G'
264 |/|
264 |/|
265 o | 2: 8908a377a434 'F'
265 o | 2: 8908a377a434 'F'
266 | |
266 | |
267 | o 1: 7fb047a69f22 'E'
267 | o 1: 7fb047a69f22 'E'
268 |/
268 |/
269 o 0: 426bada5c675 'A'
269 o 0: 426bada5c675 'A'
270
270
271
271
272 $ hg log --rev tip
272 $ hg log --rev tip
273 changeset: 5:65079693dac4
273 changeset: 5:65079693dac4
274 tag: tip
274 tag: tip
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: Collapsed revision
277 summary: Collapsed revision
278
278
279
279
280 $ cd ..
280 $ cd ..
281
281
282 Ensure --continue restores a correct state (issue3046) and phase:
282 Ensure --continue restores a correct state (issue3046) and phase:
283 $ hg init a7
283 $ hg init a7
284 $ cd a7
284 $ cd a7
285
285
286 $ hg debugdrawdag <<EOF
286 $ hg debugdrawdag <<EOF
287 > C B
287 > C B
288 > |/
288 > |/
289 > A
289 > A
290 > EOF
290 > EOF
291 $ hg up -q C
291 $ hg up -q C
292 $ echo 'B2' > B
292 $ echo 'B2' > B
293 $ hg ci -A -m 'B2'
293 $ hg ci -A -m 'B2'
294 adding B
294 adding B
295 $ hg phase --force --secret .
295 $ hg phase --force --secret .
296 $ hg rebase -s . -d B --config ui.merge=internal:merge
296 $ hg rebase -s . -d B --config ui.merge=internal:merge
297 rebasing 3:17b4880d2402 "B2" (tip)
297 rebasing 3:17b4880d2402 "B2" (tip)
298 merging B
298 merging B
299 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
299 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
300 unresolved conflicts (see hg resolve, then hg rebase --continue)
300 unresolved conflicts (see hg resolve, then hg rebase --continue)
301 [1]
301 [1]
302 $ hg resolve --all -t internal:local
302 $ hg resolve --all -t internal:local
303 (no more unresolved files)
303 (no more unresolved files)
304 continue: hg rebase --continue
304 continue: hg rebase --continue
305 $ hg rebase -c
305 $ hg rebase -c
306 rebasing 3:17b4880d2402 "B2" (tip)
306 rebasing 3:17b4880d2402 "B2" (tip)
307 note: rebase of 3:17b4880d2402 "B2" (tip) created no changes to commit
307 note: not rebasing 3:17b4880d2402 "B2" (tip), its destination already has all its changes
308 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/17b4880d2402-1ae1f6cc-rebase.hg
308 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/17b4880d2402-1ae1f6cc-rebase.hg
309 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
309 $ hg log -G --template "{rev}:{phase} '{desc}' {branches}\n"
310 o 2:draft 'C'
310 o 2:draft 'C'
311 |
311 |
312 | @ 1:draft 'B'
312 | @ 1:draft 'B'
313 |/
313 |/
314 o 0:draft 'A'
314 o 0:draft 'A'
315
315
316
316
317 $ cd ..
317 $ cd ..
@@ -1,207 +1,207 b''
1 $ cat >> $HGRCPATH<<EOF
1 $ cat >> $HGRCPATH<<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
4 > drawdag=$TESTDIR/drawdag.py
5 > EOF
5 > EOF
6
6
7 $ hg init non-merge
7 $ hg init non-merge
8 $ cd non-merge
8 $ cd non-merge
9 $ hg debugdrawdag<<'EOS'
9 $ hg debugdrawdag<<'EOS'
10 > F
10 > F
11 > |
11 > |
12 > E
12 > E
13 > |
13 > |
14 > D
14 > D
15 > |
15 > |
16 > B C
16 > B C
17 > |/
17 > |/
18 > A
18 > A
19 > EOS
19 > EOS
20
20
21 $ for i in C D E F; do
21 $ for i in C D E F; do
22 > hg bookmark -r $i -i BOOK-$i
22 > hg bookmark -r $i -i BOOK-$i
23 > done
23 > done
24
24
25 $ hg debugdrawdag<<'EOS'
25 $ hg debugdrawdag<<'EOS'
26 > E
26 > E
27 > |
27 > |
28 > D
28 > D
29 > |
29 > |
30 > B
30 > B
31 > EOS
31 > EOS
32
32
33 $ hg log -G -T '{rev} {desc} {bookmarks}'
33 $ hg log -G -T '{rev} {desc} {bookmarks}'
34 o 7 E
34 o 7 E
35 |
35 |
36 o 6 D
36 o 6 D
37 |
37 |
38 | o 5 F BOOK-F
38 | o 5 F BOOK-F
39 | |
39 | |
40 | o 4 E BOOK-E
40 | o 4 E BOOK-E
41 | |
41 | |
42 | o 3 D BOOK-D
42 | o 3 D BOOK-D
43 | |
43 | |
44 | o 2 C BOOK-C
44 | o 2 C BOOK-C
45 | |
45 | |
46 o | 1 B
46 o | 1 B
47 |/
47 |/
48 o 0 A
48 o 0 A
49
49
50 With --keep, bookmark should move
50 With --keep, bookmark should move
51
51
52 $ hg rebase -r 3+4 -d E --keep
52 $ hg rebase -r 3+4 -d E --keep
53 rebasing 3:e7b3f00ed42e "D" (BOOK-D)
53 rebasing 3:e7b3f00ed42e "D" (BOOK-D)
54 note: rebase of 3:e7b3f00ed42e "D" (BOOK-D) created no changes to commit
54 note: not rebasing 3:e7b3f00ed42e "D" (BOOK-D), its destination already has all its changes
55 rebasing 4:69a34c08022a "E" (BOOK-E)
55 rebasing 4:69a34c08022a "E" (BOOK-E)
56 note: rebase of 4:69a34c08022a "E" (BOOK-E) created no changes to commit
56 note: not rebasing 4:69a34c08022a "E" (BOOK-E), its destination already has all its changes
57 $ hg log -G -T '{rev} {desc} {bookmarks}'
57 $ hg log -G -T '{rev} {desc} {bookmarks}'
58 o 7 E BOOK-D BOOK-E
58 o 7 E BOOK-D BOOK-E
59 |
59 |
60 o 6 D
60 o 6 D
61 |
61 |
62 | o 5 F BOOK-F
62 | o 5 F BOOK-F
63 | |
63 | |
64 | o 4 E
64 | o 4 E
65 | |
65 | |
66 | o 3 D
66 | o 3 D
67 | |
67 | |
68 | o 2 C BOOK-C
68 | o 2 C BOOK-C
69 | |
69 | |
70 o | 1 B
70 o | 1 B
71 |/
71 |/
72 o 0 A
72 o 0 A
73
73
74 Move D and E back for the next test
74 Move D and E back for the next test
75
75
76 $ hg bookmark BOOK-D -fqir 3
76 $ hg bookmark BOOK-D -fqir 3
77 $ hg bookmark BOOK-E -fqir 4
77 $ hg bookmark BOOK-E -fqir 4
78
78
79 Bookmark is usually an indication of a head. For changes that are introduced by
79 Bookmark is usually an indication of a head. For changes that are introduced by
80 an ancestor of bookmark B, after moving B to B-NEW, the changes are ideally
80 an ancestor of bookmark B, after moving B to B-NEW, the changes are ideally
81 still introduced by an ancestor of changeset on B-NEW. In the below case,
81 still introduced by an ancestor of changeset on B-NEW. In the below case,
82 "BOOK-D", and "BOOK-E" include changes introduced by "C".
82 "BOOK-D", and "BOOK-E" include changes introduced by "C".
83
83
84 $ hg rebase -s 2 -d E
84 $ hg rebase -s 2 -d E
85 rebasing 2:dc0947a82db8 "C" (BOOK-C C)
85 rebasing 2:dc0947a82db8 "C" (BOOK-C C)
86 rebasing 3:e7b3f00ed42e "D" (BOOK-D)
86 rebasing 3:e7b3f00ed42e "D" (BOOK-D)
87 note: rebase of 3:e7b3f00ed42e "D" (BOOK-D) created no changes to commit
87 note: not rebasing 3:e7b3f00ed42e "D" (BOOK-D), its destination already has all its changes
88 rebasing 4:69a34c08022a "E" (BOOK-E)
88 rebasing 4:69a34c08022a "E" (BOOK-E)
89 note: rebase of 4:69a34c08022a "E" (BOOK-E) created no changes to commit
89 note: not rebasing 4:69a34c08022a "E" (BOOK-E), its destination already has all its changes
90 rebasing 5:6b2aeab91270 "F" (BOOK-F F)
90 rebasing 5:6b2aeab91270 "F" (BOOK-F F)
91 saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg
91 saved backup bundle to $TESTTMP/non-merge/.hg/strip-backup/dc0947a82db8-52bb4973-rebase.hg
92 $ hg log -G -T '{rev} {desc} {bookmarks}'
92 $ hg log -G -T '{rev} {desc} {bookmarks}'
93 o 5 F BOOK-F
93 o 5 F BOOK-F
94 |
94 |
95 o 4 C BOOK-C BOOK-D BOOK-E
95 o 4 C BOOK-C BOOK-D BOOK-E
96 |
96 |
97 o 3 E
97 o 3 E
98 |
98 |
99 o 2 D
99 o 2 D
100 |
100 |
101 o 1 B
101 o 1 B
102 |
102 |
103 o 0 A
103 o 0 A
104
104
105 Merge and its ancestors all become empty
105 Merge and its ancestors all become empty
106
106
107 $ hg init $TESTTMP/merge1
107 $ hg init $TESTTMP/merge1
108 $ cd $TESTTMP/merge1
108 $ cd $TESTTMP/merge1
109
109
110 $ hg debugdrawdag<<'EOS'
110 $ hg debugdrawdag<<'EOS'
111 > E
111 > E
112 > /|
112 > /|
113 > B C D
113 > B C D
114 > \|/
114 > \|/
115 > A
115 > A
116 > EOS
116 > EOS
117
117
118 $ for i in C D E; do
118 $ for i in C D E; do
119 > hg bookmark -r $i -i BOOK-$i
119 > hg bookmark -r $i -i BOOK-$i
120 > done
120 > done
121
121
122 $ hg debugdrawdag<<'EOS'
122 $ hg debugdrawdag<<'EOS'
123 > H
123 > H
124 > |
124 > |
125 > D
125 > D
126 > |
126 > |
127 > C
127 > C
128 > |
128 > |
129 > B
129 > B
130 > EOS
130 > EOS
131
131
132 $ hg rebase -r '(A::)-(B::)-A' -d H
132 $ hg rebase -r '(A::)-(B::)-A' -d H
133 rebasing 2:dc0947a82db8 "C" (BOOK-C)
133 rebasing 2:dc0947a82db8 "C" (BOOK-C)
134 note: rebase of 2:dc0947a82db8 "C" (BOOK-C) created no changes to commit
134 note: not rebasing 2:dc0947a82db8 "C" (BOOK-C), its destination already has all its changes
135 rebasing 3:b18e25de2cf5 "D" (BOOK-D)
135 rebasing 3:b18e25de2cf5 "D" (BOOK-D)
136 note: rebase of 3:b18e25de2cf5 "D" (BOOK-D) created no changes to commit
136 note: not rebasing 3:b18e25de2cf5 "D" (BOOK-D), its destination already has all its changes
137 rebasing 4:86a1f6686812 "E" (BOOK-E E)
137 rebasing 4:86a1f6686812 "E" (BOOK-E E)
138 note: rebase of 4:86a1f6686812 "E" (BOOK-E E) created no changes to commit
138 note: not rebasing 4:86a1f6686812 "E" (BOOK-E E), its destination already has all its changes
139 saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg
139 saved backup bundle to $TESTTMP/merge1/.hg/strip-backup/b18e25de2cf5-1fd0a4ba-rebase.hg
140
140
141 $ hg log -G -T '{rev} {desc} {bookmarks}'
141 $ hg log -G -T '{rev} {desc} {bookmarks}'
142 o 4 H BOOK-C BOOK-D BOOK-E
142 o 4 H BOOK-C BOOK-D BOOK-E
143 |
143 |
144 o 3 D
144 o 3 D
145 |
145 |
146 o 2 C
146 o 2 C
147 |
147 |
148 o 1 B
148 o 1 B
149 |
149 |
150 o 0 A
150 o 0 A
151
151
152 Part of ancestors of a merge become empty
152 Part of ancestors of a merge become empty
153
153
154 $ hg init $TESTTMP/merge2
154 $ hg init $TESTTMP/merge2
155 $ cd $TESTTMP/merge2
155 $ cd $TESTTMP/merge2
156
156
157 $ hg debugdrawdag<<'EOS'
157 $ hg debugdrawdag<<'EOS'
158 > G
158 > G
159 > /|
159 > /|
160 > E F
160 > E F
161 > | |
161 > | |
162 > B C D
162 > B C D
163 > \|/
163 > \|/
164 > A
164 > A
165 > EOS
165 > EOS
166
166
167 $ for i in C D E F G; do
167 $ for i in C D E F G; do
168 > hg bookmark -r $i -i BOOK-$i
168 > hg bookmark -r $i -i BOOK-$i
169 > done
169 > done
170
170
171 $ hg debugdrawdag<<'EOS'
171 $ hg debugdrawdag<<'EOS'
172 > H
172 > H
173 > |
173 > |
174 > F
174 > F
175 > |
175 > |
176 > C
176 > C
177 > |
177 > |
178 > B
178 > B
179 > EOS
179 > EOS
180
180
181 $ hg rebase -r '(A::)-(B::)-A' -d H
181 $ hg rebase -r '(A::)-(B::)-A' -d H
182 rebasing 2:dc0947a82db8 "C" (BOOK-C)
182 rebasing 2:dc0947a82db8 "C" (BOOK-C)
183 note: rebase of 2:dc0947a82db8 "C" (BOOK-C) created no changes to commit
183 note: not rebasing 2:dc0947a82db8 "C" (BOOK-C), its destination already has all its changes
184 rebasing 3:b18e25de2cf5 "D" (BOOK-D D)
184 rebasing 3:b18e25de2cf5 "D" (BOOK-D D)
185 rebasing 4:03ca77807e91 "E" (BOOK-E E)
185 rebasing 4:03ca77807e91 "E" (BOOK-E E)
186 rebasing 5:ad6717a6a58e "F" (BOOK-F)
186 rebasing 5:ad6717a6a58e "F" (BOOK-F)
187 note: rebase of 5:ad6717a6a58e "F" (BOOK-F) created no changes to commit
187 note: not rebasing 5:ad6717a6a58e "F" (BOOK-F), its destination already has all its changes
188 rebasing 6:c58e8bdac1f4 "G" (BOOK-G G)
188 rebasing 6:c58e8bdac1f4 "G" (BOOK-G G)
189 saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg
189 saved backup bundle to $TESTTMP/merge2/.hg/strip-backup/b18e25de2cf5-2d487005-rebase.hg
190
190
191 $ hg log -G -T '{rev} {desc} {bookmarks}'
191 $ hg log -G -T '{rev} {desc} {bookmarks}'
192 o 7 G BOOK-G
192 o 7 G BOOK-G
193 |\
193 |\
194 | o 6 E BOOK-E
194 | o 6 E BOOK-E
195 | |
195 | |
196 o | 5 D BOOK-D BOOK-F
196 o | 5 D BOOK-D BOOK-F
197 |/
197 |/
198 o 4 H BOOK-C
198 o 4 H BOOK-C
199 |
199 |
200 o 3 F
200 o 3 F
201 |
201 |
202 o 2 C
202 o 2 C
203 |
203 |
204 o 1 B
204 o 1 B
205 |
205 |
206 o 0 A
206 o 0 A
207
207
@@ -1,480 +1,480 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
10 > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
10 > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n"
11 > EOF
11 > EOF
12
12
13
13
14 $ hg init a
14 $ hg init a
15 $ cd a
15 $ cd a
16
16
17 $ echo A > A
17 $ echo A > A
18 $ hg ci -Am A
18 $ hg ci -Am A
19 adding A
19 adding A
20
20
21 $ echo B > B
21 $ echo B > B
22 $ hg ci -Am B
22 $ hg ci -Am B
23 adding B
23 adding B
24
24
25 $ echo C >> A
25 $ echo C >> A
26 $ hg ci -m C
26 $ hg ci -m C
27
27
28 $ hg up -q -C 0
28 $ hg up -q -C 0
29
29
30 $ echo D >> A
30 $ echo D >> A
31 $ hg ci -m D
31 $ hg ci -m D
32 created new head
32 created new head
33
33
34 $ echo E > E
34 $ echo E > E
35 $ hg ci -Am E
35 $ hg ci -Am E
36 adding E
36 adding E
37
37
38 $ cd ..
38 $ cd ..
39
39
40
40
41 Changes during an interruption - continue:
41 Changes during an interruption - continue:
42
42
43 $ hg clone -q -u . a a1
43 $ hg clone -q -u . a a1
44 $ cd a1
44 $ cd a1
45
45
46 $ hg tglog
46 $ hg tglog
47 @ 4: ae36e8e3dfd7 'E'
47 @ 4: ae36e8e3dfd7 'E'
48 |
48 |
49 o 3: 46b37eabc604 'D'
49 o 3: 46b37eabc604 'D'
50 |
50 |
51 | o 2: 965c486023db 'C'
51 | o 2: 965c486023db 'C'
52 | |
52 | |
53 | o 1: 27547f69f254 'B'
53 | o 1: 27547f69f254 'B'
54 |/
54 |/
55 o 0: 4a2df7238c3b 'A'
55 o 0: 4a2df7238c3b 'A'
56
56
57 Rebasing B onto E:
57 Rebasing B onto E:
58
58
59 $ hg rebase -s 1 -d 4
59 $ hg rebase -s 1 -d 4
60 rebasing 1:27547f69f254 "B"
60 rebasing 1:27547f69f254 "B"
61 rebasing 2:965c486023db "C"
61 rebasing 2:965c486023db "C"
62 merging A
62 merging A
63 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
63 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
64 unresolved conflicts (see hg resolve, then hg rebase --continue)
64 unresolved conflicts (see hg resolve, then hg rebase --continue)
65 [1]
65 [1]
66
66
67 Force a commit on C during the interruption:
67 Force a commit on C during the interruption:
68
68
69 $ hg up -q -C 2 --config 'extensions.rebase=!'
69 $ hg up -q -C 2 --config 'extensions.rebase=!'
70
70
71 $ echo 'Extra' > Extra
71 $ echo 'Extra' > Extra
72 $ hg add Extra
72 $ hg add Extra
73 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
73 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
74
74
75 Force this commit onto secret phase
75 Force this commit onto secret phase
76
76
77 $ hg phase --force --secret 6
77 $ hg phase --force --secret 6
78
78
79 $ hg tglogp
79 $ hg tglogp
80 @ 6: deb5d2f93d8b secret 'Extra'
80 @ 6: deb5d2f93d8b secret 'Extra'
81 |
81 |
82 | o 5: 45396c49d53b draft 'B'
82 | o 5: 45396c49d53b draft 'B'
83 | |
83 | |
84 | o 4: ae36e8e3dfd7 draft 'E'
84 | o 4: ae36e8e3dfd7 draft 'E'
85 | |
85 | |
86 | o 3: 46b37eabc604 draft 'D'
86 | o 3: 46b37eabc604 draft 'D'
87 | |
87 | |
88 o | 2: 965c486023db draft 'C'
88 o | 2: 965c486023db draft 'C'
89 | |
89 | |
90 o | 1: 27547f69f254 draft 'B'
90 o | 1: 27547f69f254 draft 'B'
91 |/
91 |/
92 o 0: 4a2df7238c3b draft 'A'
92 o 0: 4a2df7238c3b draft 'A'
93
93
94 Resume the rebasing:
94 Resume the rebasing:
95
95
96 $ hg rebase --continue
96 $ hg rebase --continue
97 already rebased 1:27547f69f254 "B" as 45396c49d53b
97 already rebased 1:27547f69f254 "B" as 45396c49d53b
98 rebasing 2:965c486023db "C"
98 rebasing 2:965c486023db "C"
99 merging A
99 merging A
100 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
100 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
101 unresolved conflicts (see hg resolve, then hg rebase --continue)
101 unresolved conflicts (see hg resolve, then hg rebase --continue)
102 [1]
102 [1]
103
103
104 Solve the conflict and go on:
104 Solve the conflict and go on:
105
105
106 $ echo 'conflict solved' > A
106 $ echo 'conflict solved' > A
107 $ rm A.orig
107 $ rm A.orig
108 $ hg resolve -m A
108 $ hg resolve -m A
109 (no more unresolved files)
109 (no more unresolved files)
110 continue: hg rebase --continue
110 continue: hg rebase --continue
111
111
112 $ hg rebase --continue
112 $ hg rebase --continue
113 already rebased 1:27547f69f254 "B" as 45396c49d53b
113 already rebased 1:27547f69f254 "B" as 45396c49d53b
114 rebasing 2:965c486023db "C"
114 rebasing 2:965c486023db "C"
115 warning: orphaned descendants detected, not stripping 27547f69f254, 965c486023db
115 warning: orphaned descendants detected, not stripping 27547f69f254, 965c486023db
116
116
117 $ hg tglogp
117 $ hg tglogp
118 o 7: d2d25e26288e draft 'C'
118 o 7: d2d25e26288e draft 'C'
119 |
119 |
120 | o 6: deb5d2f93d8b secret 'Extra'
120 | o 6: deb5d2f93d8b secret 'Extra'
121 | |
121 | |
122 o | 5: 45396c49d53b draft 'B'
122 o | 5: 45396c49d53b draft 'B'
123 | |
123 | |
124 @ | 4: ae36e8e3dfd7 draft 'E'
124 @ | 4: ae36e8e3dfd7 draft 'E'
125 | |
125 | |
126 o | 3: 46b37eabc604 draft 'D'
126 o | 3: 46b37eabc604 draft 'D'
127 | |
127 | |
128 | o 2: 965c486023db draft 'C'
128 | o 2: 965c486023db draft 'C'
129 | |
129 | |
130 | o 1: 27547f69f254 draft 'B'
130 | o 1: 27547f69f254 draft 'B'
131 |/
131 |/
132 o 0: 4a2df7238c3b draft 'A'
132 o 0: 4a2df7238c3b draft 'A'
133
133
134 $ cd ..
134 $ cd ..
135
135
136
136
137 Changes during an interruption - abort:
137 Changes during an interruption - abort:
138
138
139 $ hg clone -q -u . a a2
139 $ hg clone -q -u . a a2
140 $ cd a2
140 $ cd a2
141
141
142 $ hg tglog
142 $ hg tglog
143 @ 4: ae36e8e3dfd7 'E'
143 @ 4: ae36e8e3dfd7 'E'
144 |
144 |
145 o 3: 46b37eabc604 'D'
145 o 3: 46b37eabc604 'D'
146 |
146 |
147 | o 2: 965c486023db 'C'
147 | o 2: 965c486023db 'C'
148 | |
148 | |
149 | o 1: 27547f69f254 'B'
149 | o 1: 27547f69f254 'B'
150 |/
150 |/
151 o 0: 4a2df7238c3b 'A'
151 o 0: 4a2df7238c3b 'A'
152
152
153 Rebasing B onto E:
153 Rebasing B onto E:
154
154
155 $ hg rebase -s 1 -d 4
155 $ hg rebase -s 1 -d 4
156 rebasing 1:27547f69f254 "B"
156 rebasing 1:27547f69f254 "B"
157 rebasing 2:965c486023db "C"
157 rebasing 2:965c486023db "C"
158 merging A
158 merging A
159 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
159 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
160 unresolved conflicts (see hg resolve, then hg rebase --continue)
160 unresolved conflicts (see hg resolve, then hg rebase --continue)
161 [1]
161 [1]
162
162
163 Force a commit on B' during the interruption:
163 Force a commit on B' during the interruption:
164
164
165 $ hg up -q -C 5 --config 'extensions.rebase=!'
165 $ hg up -q -C 5 --config 'extensions.rebase=!'
166
166
167 $ echo 'Extra' > Extra
167 $ echo 'Extra' > Extra
168 $ hg add Extra
168 $ hg add Extra
169 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
169 $ hg ci -m 'Extra' --config 'extensions.rebase=!'
170
170
171 $ hg tglog
171 $ hg tglog
172 @ 6: 402ee3642b59 'Extra'
172 @ 6: 402ee3642b59 'Extra'
173 |
173 |
174 o 5: 45396c49d53b 'B'
174 o 5: 45396c49d53b 'B'
175 |
175 |
176 o 4: ae36e8e3dfd7 'E'
176 o 4: ae36e8e3dfd7 'E'
177 |
177 |
178 o 3: 46b37eabc604 'D'
178 o 3: 46b37eabc604 'D'
179 |
179 |
180 | o 2: 965c486023db 'C'
180 | o 2: 965c486023db 'C'
181 | |
181 | |
182 | o 1: 27547f69f254 'B'
182 | o 1: 27547f69f254 'B'
183 |/
183 |/
184 o 0: 4a2df7238c3b 'A'
184 o 0: 4a2df7238c3b 'A'
185
185
186 Abort the rebasing:
186 Abort the rebasing:
187
187
188 $ hg rebase --abort
188 $ hg rebase --abort
189 warning: new changesets detected on destination branch, can't strip
189 warning: new changesets detected on destination branch, can't strip
190 rebase aborted
190 rebase aborted
191
191
192 $ hg tglog
192 $ hg tglog
193 @ 6: 402ee3642b59 'Extra'
193 @ 6: 402ee3642b59 'Extra'
194 |
194 |
195 o 5: 45396c49d53b 'B'
195 o 5: 45396c49d53b 'B'
196 |
196 |
197 o 4: ae36e8e3dfd7 'E'
197 o 4: ae36e8e3dfd7 'E'
198 |
198 |
199 o 3: 46b37eabc604 'D'
199 o 3: 46b37eabc604 'D'
200 |
200 |
201 | o 2: 965c486023db 'C'
201 | o 2: 965c486023db 'C'
202 | |
202 | |
203 | o 1: 27547f69f254 'B'
203 | o 1: 27547f69f254 'B'
204 |/
204 |/
205 o 0: 4a2df7238c3b 'A'
205 o 0: 4a2df7238c3b 'A'
206
206
207 $ cd ..
207 $ cd ..
208
208
209 Changes during an interruption - abort (again):
209 Changes during an interruption - abort (again):
210
210
211 $ hg clone -q -u . a a3
211 $ hg clone -q -u . a a3
212 $ cd a3
212 $ cd a3
213
213
214 $ hg tglogp
214 $ hg tglogp
215 @ 4: ae36e8e3dfd7 draft 'E'
215 @ 4: ae36e8e3dfd7 draft 'E'
216 |
216 |
217 o 3: 46b37eabc604 draft 'D'
217 o 3: 46b37eabc604 draft 'D'
218 |
218 |
219 | o 2: 965c486023db draft 'C'
219 | o 2: 965c486023db draft 'C'
220 | |
220 | |
221 | o 1: 27547f69f254 draft 'B'
221 | o 1: 27547f69f254 draft 'B'
222 |/
222 |/
223 o 0: 4a2df7238c3b draft 'A'
223 o 0: 4a2df7238c3b draft 'A'
224
224
225 Rebasing B onto E:
225 Rebasing B onto E:
226
226
227 $ hg rebase -s 1 -d 4
227 $ hg rebase -s 1 -d 4
228 rebasing 1:27547f69f254 "B"
228 rebasing 1:27547f69f254 "B"
229 rebasing 2:965c486023db "C"
229 rebasing 2:965c486023db "C"
230 merging A
230 merging A
231 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
231 warning: conflicts while merging A! (edit, then use 'hg resolve --mark')
232 unresolved conflicts (see hg resolve, then hg rebase --continue)
232 unresolved conflicts (see hg resolve, then hg rebase --continue)
233 [1]
233 [1]
234
234
235 Change phase on B and B'
235 Change phase on B and B'
236
236
237 $ hg up -q -C 5 --config 'extensions.rebase=!'
237 $ hg up -q -C 5 --config 'extensions.rebase=!'
238 $ hg phase --public 1
238 $ hg phase --public 1
239 $ hg phase --public 5
239 $ hg phase --public 5
240 $ hg phase --secret -f 2
240 $ hg phase --secret -f 2
241
241
242 $ hg tglogp
242 $ hg tglogp
243 @ 5: 45396c49d53b public 'B'
243 @ 5: 45396c49d53b public 'B'
244 |
244 |
245 o 4: ae36e8e3dfd7 public 'E'
245 o 4: ae36e8e3dfd7 public 'E'
246 |
246 |
247 o 3: 46b37eabc604 public 'D'
247 o 3: 46b37eabc604 public 'D'
248 |
248 |
249 | o 2: 965c486023db secret 'C'
249 | o 2: 965c486023db secret 'C'
250 | |
250 | |
251 | o 1: 27547f69f254 public 'B'
251 | o 1: 27547f69f254 public 'B'
252 |/
252 |/
253 o 0: 4a2df7238c3b public 'A'
253 o 0: 4a2df7238c3b public 'A'
254
254
255 Abort the rebasing:
255 Abort the rebasing:
256
256
257 $ hg rebase --abort
257 $ hg rebase --abort
258 warning: can't clean up public changesets 45396c49d53b
258 warning: can't clean up public changesets 45396c49d53b
259 rebase aborted
259 rebase aborted
260
260
261 $ hg tglogp
261 $ hg tglogp
262 @ 5: 45396c49d53b public 'B'
262 @ 5: 45396c49d53b public 'B'
263 |
263 |
264 o 4: ae36e8e3dfd7 public 'E'
264 o 4: ae36e8e3dfd7 public 'E'
265 |
265 |
266 o 3: 46b37eabc604 public 'D'
266 o 3: 46b37eabc604 public 'D'
267 |
267 |
268 | o 2: 965c486023db secret 'C'
268 | o 2: 965c486023db secret 'C'
269 | |
269 | |
270 | o 1: 27547f69f254 public 'B'
270 | o 1: 27547f69f254 public 'B'
271 |/
271 |/
272 o 0: 4a2df7238c3b public 'A'
272 o 0: 4a2df7238c3b public 'A'
273
273
274 Test rebase interrupted by hooks
274 Test rebase interrupted by hooks
275
275
276 $ hg up 2
276 $ hg up 2
277 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
277 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
278 $ echo F > F
278 $ echo F > F
279 $ hg add F
279 $ hg add F
280 $ hg ci -m F
280 $ hg ci -m F
281
281
282 $ cd ..
282 $ cd ..
283
283
284 (precommit version)
284 (precommit version)
285
285
286 $ cp -R a3 hook-precommit
286 $ cp -R a3 hook-precommit
287 $ cd hook-precommit
287 $ cd hook-precommit
288 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.precommit=hg status | grep "M A"'
288 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.precommit=hg status | grep "M A"'
289 rebasing 2:965c486023db "C"
289 rebasing 2:965c486023db "C"
290 M A
290 M A
291 rebasing 6:a0b2430ebfb8 "F" (tip)
291 rebasing 6:a0b2430ebfb8 "F" (tip)
292 abort: precommit hook exited with status 1
292 abort: precommit hook exited with status 1
293 [255]
293 [255]
294 $ hg tglogp
294 $ hg tglogp
295 @ 7: 401ccec5e39f secret 'C'
295 @ 7: 401ccec5e39f secret 'C'
296 |
296 |
297 | @ 6: a0b2430ebfb8 secret 'F'
297 | @ 6: a0b2430ebfb8 secret 'F'
298 | |
298 | |
299 o | 5: 45396c49d53b public 'B'
299 o | 5: 45396c49d53b public 'B'
300 | |
300 | |
301 o | 4: ae36e8e3dfd7 public 'E'
301 o | 4: ae36e8e3dfd7 public 'E'
302 | |
302 | |
303 o | 3: 46b37eabc604 public 'D'
303 o | 3: 46b37eabc604 public 'D'
304 | |
304 | |
305 | o 2: 965c486023db secret 'C'
305 | o 2: 965c486023db secret 'C'
306 | |
306 | |
307 | o 1: 27547f69f254 public 'B'
307 | o 1: 27547f69f254 public 'B'
308 |/
308 |/
309 o 0: 4a2df7238c3b public 'A'
309 o 0: 4a2df7238c3b public 'A'
310
310
311 $ hg rebase --continue
311 $ hg rebase --continue
312 already rebased 2:965c486023db "C" as 401ccec5e39f
312 already rebased 2:965c486023db "C" as 401ccec5e39f
313 rebasing 6:a0b2430ebfb8 "F"
313 rebasing 6:a0b2430ebfb8 "F"
314 saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
314 saved backup bundle to $TESTTMP/hook-precommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
315 $ hg tglogp
315 $ hg tglogp
316 @ 6: 6e92a149ac6b secret 'F'
316 @ 6: 6e92a149ac6b secret 'F'
317 |
317 |
318 o 5: 401ccec5e39f secret 'C'
318 o 5: 401ccec5e39f secret 'C'
319 |
319 |
320 o 4: 45396c49d53b public 'B'
320 o 4: 45396c49d53b public 'B'
321 |
321 |
322 o 3: ae36e8e3dfd7 public 'E'
322 o 3: ae36e8e3dfd7 public 'E'
323 |
323 |
324 o 2: 46b37eabc604 public 'D'
324 o 2: 46b37eabc604 public 'D'
325 |
325 |
326 | o 1: 27547f69f254 public 'B'
326 | o 1: 27547f69f254 public 'B'
327 |/
327 |/
328 o 0: 4a2df7238c3b public 'A'
328 o 0: 4a2df7238c3b public 'A'
329
329
330 $ cd ..
330 $ cd ..
331
331
332 (pretxncommit version)
332 (pretxncommit version)
333
333
334 $ cp -R a3 hook-pretxncommit
334 $ cp -R a3 hook-pretxncommit
335 $ cd hook-pretxncommit
335 $ cd hook-pretxncommit
336 $ hg rebase --source 2 --dest 5 --tool internal:other \
336 $ hg rebase --source 2 --dest 5 --tool internal:other \
337 > --config 'hooks.tonative.pretxncommit=True' --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"'
337 > --config 'hooks.tonative.pretxncommit=True' --config 'hooks.pretxncommit=hg log -r $HG_NODE | grep "summary: C"'
338 rebasing 2:965c486023db "C"
338 rebasing 2:965c486023db "C"
339 summary: C
339 summary: C
340 rebasing 6:a0b2430ebfb8 "F" (tip)
340 rebasing 6:a0b2430ebfb8 "F" (tip)
341 transaction abort!
341 transaction abort!
342 rollback completed
342 rollback completed
343 abort: pretxncommit hook exited with status 1
343 abort: pretxncommit hook exited with status 1
344 [255]
344 [255]
345 $ hg tglogp
345 $ hg tglogp
346 @ 7: 401ccec5e39f secret 'C'
346 @ 7: 401ccec5e39f secret 'C'
347 |
347 |
348 | @ 6: a0b2430ebfb8 secret 'F'
348 | @ 6: a0b2430ebfb8 secret 'F'
349 | |
349 | |
350 o | 5: 45396c49d53b public 'B'
350 o | 5: 45396c49d53b public 'B'
351 | |
351 | |
352 o | 4: ae36e8e3dfd7 public 'E'
352 o | 4: ae36e8e3dfd7 public 'E'
353 | |
353 | |
354 o | 3: 46b37eabc604 public 'D'
354 o | 3: 46b37eabc604 public 'D'
355 | |
355 | |
356 | o 2: 965c486023db secret 'C'
356 | o 2: 965c486023db secret 'C'
357 | |
357 | |
358 | o 1: 27547f69f254 public 'B'
358 | o 1: 27547f69f254 public 'B'
359 |/
359 |/
360 o 0: 4a2df7238c3b public 'A'
360 o 0: 4a2df7238c3b public 'A'
361
361
362 $ hg rebase --continue
362 $ hg rebase --continue
363 already rebased 2:965c486023db "C" as 401ccec5e39f
363 already rebased 2:965c486023db "C" as 401ccec5e39f
364 rebasing 6:a0b2430ebfb8 "F"
364 rebasing 6:a0b2430ebfb8 "F"
365 saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
365 saved backup bundle to $TESTTMP/hook-pretxncommit/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
366 $ hg tglogp
366 $ hg tglogp
367 @ 6: 6e92a149ac6b secret 'F'
367 @ 6: 6e92a149ac6b secret 'F'
368 |
368 |
369 o 5: 401ccec5e39f secret 'C'
369 o 5: 401ccec5e39f secret 'C'
370 |
370 |
371 o 4: 45396c49d53b public 'B'
371 o 4: 45396c49d53b public 'B'
372 |
372 |
373 o 3: ae36e8e3dfd7 public 'E'
373 o 3: ae36e8e3dfd7 public 'E'
374 |
374 |
375 o 2: 46b37eabc604 public 'D'
375 o 2: 46b37eabc604 public 'D'
376 |
376 |
377 | o 1: 27547f69f254 public 'B'
377 | o 1: 27547f69f254 public 'B'
378 |/
378 |/
379 o 0: 4a2df7238c3b public 'A'
379 o 0: 4a2df7238c3b public 'A'
380
380
381 $ cd ..
381 $ cd ..
382
382
383 (pretxnclose version)
383 (pretxnclose version)
384
384
385 $ cp -R a3 hook-pretxnclose
385 $ cp -R a3 hook-pretxnclose
386 $ cd hook-pretxnclose
386 $ cd hook-pretxnclose
387 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxnclose=hg log -r tip | grep "summary: C"'
387 $ hg rebase --source 2 --dest 5 --tool internal:other --config 'hooks.pretxnclose=hg log -r tip | grep "summary: C"'
388 rebasing 2:965c486023db "C"
388 rebasing 2:965c486023db "C"
389 summary: C
389 summary: C
390 rebasing 6:a0b2430ebfb8 "F" (tip)
390 rebasing 6:a0b2430ebfb8 "F" (tip)
391 transaction abort!
391 transaction abort!
392 rollback completed
392 rollback completed
393 abort: pretxnclose hook exited with status 1
393 abort: pretxnclose hook exited with status 1
394 [255]
394 [255]
395 $ hg tglogp
395 $ hg tglogp
396 @ 7: 401ccec5e39f secret 'C'
396 @ 7: 401ccec5e39f secret 'C'
397 |
397 |
398 | @ 6: a0b2430ebfb8 secret 'F'
398 | @ 6: a0b2430ebfb8 secret 'F'
399 | |
399 | |
400 o | 5: 45396c49d53b public 'B'
400 o | 5: 45396c49d53b public 'B'
401 | |
401 | |
402 o | 4: ae36e8e3dfd7 public 'E'
402 o | 4: ae36e8e3dfd7 public 'E'
403 | |
403 | |
404 o | 3: 46b37eabc604 public 'D'
404 o | 3: 46b37eabc604 public 'D'
405 | |
405 | |
406 | o 2: 965c486023db secret 'C'
406 | o 2: 965c486023db secret 'C'
407 | |
407 | |
408 | o 1: 27547f69f254 public 'B'
408 | o 1: 27547f69f254 public 'B'
409 |/
409 |/
410 o 0: 4a2df7238c3b public 'A'
410 o 0: 4a2df7238c3b public 'A'
411
411
412 $ hg rebase --continue
412 $ hg rebase --continue
413 already rebased 2:965c486023db "C" as 401ccec5e39f
413 already rebased 2:965c486023db "C" as 401ccec5e39f
414 rebasing 6:a0b2430ebfb8 "F"
414 rebasing 6:a0b2430ebfb8 "F"
415 saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
415 saved backup bundle to $TESTTMP/hook-pretxnclose/.hg/strip-backup/965c486023db-aa6250e7-rebase.hg
416 $ hg tglogp
416 $ hg tglogp
417 @ 6: 6e92a149ac6b secret 'F'
417 @ 6: 6e92a149ac6b secret 'F'
418 |
418 |
419 o 5: 401ccec5e39f secret 'C'
419 o 5: 401ccec5e39f secret 'C'
420 |
420 |
421 o 4: 45396c49d53b public 'B'
421 o 4: 45396c49d53b public 'B'
422 |
422 |
423 o 3: ae36e8e3dfd7 public 'E'
423 o 3: ae36e8e3dfd7 public 'E'
424 |
424 |
425 o 2: 46b37eabc604 public 'D'
425 o 2: 46b37eabc604 public 'D'
426 |
426 |
427 | o 1: 27547f69f254 public 'B'
427 | o 1: 27547f69f254 public 'B'
428 |/
428 |/
429 o 0: 4a2df7238c3b public 'A'
429 o 0: 4a2df7238c3b public 'A'
430
430
431 $ cd ..
431 $ cd ..
432
432
433 Make sure merge state is cleaned up after a no-op rebase merge (issue5494)
433 Make sure merge state is cleaned up after a no-op rebase merge (issue5494)
434 $ hg init repo
434 $ hg init repo
435 $ cd repo
435 $ cd repo
436 $ echo a > a
436 $ echo a > a
437 $ hg commit -qAm base
437 $ hg commit -qAm base
438 $ echo b >> a
438 $ echo b >> a
439 $ hg commit -qm b
439 $ hg commit -qm b
440 $ hg up '.^'
440 $ hg up '.^'
441 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
442 $ echo c >> a
442 $ echo c >> a
443 $ hg commit -qm c
443 $ hg commit -qm c
444 $ hg rebase -s 1 -d 2 --noninteractive
444 $ hg rebase -s 1 -d 2 --noninteractive
445 rebasing 1:fdaca8533b86 "b"
445 rebasing 1:fdaca8533b86 "b"
446 merging a
446 merging a
447 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
447 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
448 unresolved conflicts (see hg resolve, then hg rebase --continue)
448 unresolved conflicts (see hg resolve, then hg rebase --continue)
449 [1]
449 [1]
450 $ echo a > a
450 $ echo a > a
451 $ echo c >> a
451 $ echo c >> a
452 $ hg resolve --mark a
452 $ hg resolve --mark a
453 (no more unresolved files)
453 (no more unresolved files)
454 continue: hg rebase --continue
454 continue: hg rebase --continue
455 $ hg rebase --continue
455 $ hg rebase --continue
456 rebasing 1:fdaca8533b86 "b"
456 rebasing 1:fdaca8533b86 "b"
457 note: rebase of 1:fdaca8533b86 "b" created no changes to commit
457 note: not rebasing 1:fdaca8533b86 "b", its destination already has all its changes
458 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
458 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
459 $ hg resolve --list
459 $ hg resolve --list
460 $ test -d .hg/merge
460 $ test -d .hg/merge
461 [1]
461 [1]
462 Now try again with --collapse
462 Now try again with --collapse
463 $ hg unbundle -q .hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
463 $ hg unbundle -q .hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
464 $ hg rebase -s 2 -d 1 --noninteractive --collapse
464 $ hg rebase -s 2 -d 1 --noninteractive --collapse
465 rebasing 2:fdaca8533b86 "b" (tip)
465 rebasing 2:fdaca8533b86 "b" (tip)
466 merging a
466 merging a
467 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
467 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
468 unresolved conflicts (see hg resolve, then hg rebase --continue)
468 unresolved conflicts (see hg resolve, then hg rebase --continue)
469 [1]
469 [1]
470 $ echo a > a
470 $ echo a > a
471 $ echo c >> a
471 $ echo c >> a
472 $ hg resolve --mark a
472 $ hg resolve --mark a
473 (no more unresolved files)
473 (no more unresolved files)
474 continue: hg rebase --continue
474 continue: hg rebase --continue
475 $ hg rebase --continue
475 $ hg rebase --continue
476 rebasing 2:fdaca8533b86 "b" (tip)
476 rebasing 2:fdaca8533b86 "b" (tip)
477 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
477 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fdaca8533b86-7fd70513-rebase.hg
478 $ hg resolve --list
478 $ hg resolve --list
479 $ test -d .hg/merge
479 $ test -d .hg/merge
480 [1]
480 [1]
@@ -1,189 +1,189 b''
1 This emulates the effects of an hg pull --rebase in which the remote repo
1 This emulates the effects of an hg pull --rebase in which the remote repo
2 already has one local mq patch
2 already has one local mq patch
3
3
4 $ cat >> $HGRCPATH <<EOF
4 $ cat >> $HGRCPATH <<EOF
5 > [extensions]
5 > [extensions]
6 > rebase=
6 > rebase=
7 > mq=
7 > mq=
8 >
8 >
9 > [phases]
9 > [phases]
10 > publish=False
10 > publish=False
11 >
11 >
12 > [alias]
12 > [alias]
13 > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n"
13 > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n"
14 > EOF
14 > EOF
15
15
16
16
17 $ hg init a
17 $ hg init a
18 $ cd a
18 $ cd a
19 $ hg qinit -c
19 $ hg qinit -c
20
20
21 $ echo c1 > c1
21 $ echo c1 > c1
22 $ hg add c1
22 $ hg add c1
23 $ hg ci -m C1
23 $ hg ci -m C1
24
24
25 $ echo r1 > r1
25 $ echo r1 > r1
26 $ hg add r1
26 $ hg add r1
27 $ hg ci -m R1
27 $ hg ci -m R1
28
28
29 $ hg up -q 0
29 $ hg up -q 0
30
30
31 $ hg qnew p0.patch -d '1 0'
31 $ hg qnew p0.patch -d '1 0'
32 $ echo p0 > p0
32 $ echo p0 > p0
33 $ hg add p0
33 $ hg add p0
34 $ hg qref -m P0
34 $ hg qref -m P0
35
35
36 $ hg qnew p1.patch -d '2 0'
36 $ hg qnew p1.patch -d '2 0'
37 $ echo p1 > p1
37 $ echo p1 > p1
38 $ hg add p1
38 $ hg add p1
39 $ hg qref -m P1
39 $ hg qref -m P1
40
40
41 $ hg export qtip > p1.patch
41 $ hg export qtip > p1.patch
42
42
43 $ hg up -q -C 1
43 $ hg up -q -C 1
44
44
45 $ hg import p1.patch
45 $ hg import p1.patch
46 applying p1.patch
46 applying p1.patch
47
47
48 $ rm p1.patch
48 $ rm p1.patch
49
49
50 $ hg up -q -C qtip
50 $ hg up -q -C qtip
51
51
52 $ hg rebase -v
52 $ hg rebase -v
53 rebasing 2:13a46ce44f60 "P0" (p0.patch qbase)
53 rebasing 2:13a46ce44f60 "P0" (p0.patch qbase)
54 resolving manifests
54 resolving manifests
55 removing p0
55 removing p0
56 getting r1
56 getting r1
57 resolving manifests
57 resolving manifests
58 getting p0
58 getting p0
59 committing files:
59 committing files:
60 p0
60 p0
61 committing manifest
61 committing manifest
62 committing changelog
62 committing changelog
63 rebasing 3:148775c71080 "P1" (p1.patch qtip)
63 rebasing 3:148775c71080 "P1" (p1.patch qtip)
64 resolving manifests
64 resolving manifests
65 note: rebase of 3:148775c71080 "P1" (p1.patch qtip) created no changes to commit
65 note: not rebasing 3:148775c71080 "P1" (p1.patch qtip), its destination already has all its changes
66 rebase merging completed
66 rebase merging completed
67 updating mq patch p0.patch to 5:9ecc820b1737
67 updating mq patch p0.patch to 5:9ecc820b1737
68 $TESTTMP/a/.hg/patches/p0.patch
68 $TESTTMP/a/.hg/patches/p0.patch
69 2 changesets found
69 2 changesets found
70 uncompressed size of bundle content:
70 uncompressed size of bundle content:
71 348 (changelog)
71 348 (changelog)
72 324 (manifests)
72 324 (manifests)
73 129 p0
73 129 p0
74 129 p1
74 129 p1
75 saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-5da6ecfb-rebase.hg
75 saved backup bundle to $TESTTMP/a/.hg/strip-backup/13a46ce44f60-5da6ecfb-rebase.hg
76 2 changesets found
76 2 changesets found
77 uncompressed size of bundle content:
77 uncompressed size of bundle content:
78 403 (changelog)
78 403 (changelog)
79 324 (manifests)
79 324 (manifests)
80 129 p0
80 129 p0
81 129 p1
81 129 p1
82 adding branch
82 adding branch
83 adding changesets
83 adding changesets
84 adding manifests
84 adding manifests
85 adding file changes
85 adding file changes
86 added 2 changesets with 2 changes to 2 files
86 added 2 changesets with 2 changes to 2 files
87 rebase completed
87 rebase completed
88 1 revisions have been skipped
88 1 revisions have been skipped
89
89
90 $ hg tglog
90 $ hg tglog
91 @ 3: 9ecc820b1737 'P0' tags: p0.patch qbase qtip tip
91 @ 3: 9ecc820b1737 'P0' tags: p0.patch qbase qtip tip
92 |
92 |
93 o 2: 869d8b134a27 'P1' tags: qparent
93 o 2: 869d8b134a27 'P1' tags: qparent
94 |
94 |
95 o 1: da108f2755df 'R1' tags:
95 o 1: da108f2755df 'R1' tags:
96 |
96 |
97 o 0: cd320d50b341 'C1' tags:
97 o 0: cd320d50b341 'C1' tags:
98
98
99 $ cd ..
99 $ cd ..
100
100
101
101
102 $ hg init b
102 $ hg init b
103 $ cd b
103 $ cd b
104 $ hg qinit -c
104 $ hg qinit -c
105
105
106 $ for i in r0 r1 r2 r3 r4 r5 r6;
106 $ for i in r0 r1 r2 r3 r4 r5 r6;
107 > do
107 > do
108 > echo $i > $i
108 > echo $i > $i
109 > hg ci -Am $i
109 > hg ci -Am $i
110 > done
110 > done
111 adding r0
111 adding r0
112 adding r1
112 adding r1
113 adding r2
113 adding r2
114 adding r3
114 adding r3
115 adding r4
115 adding r4
116 adding r5
116 adding r5
117 adding r6
117 adding r6
118
118
119 $ hg qimport -r 1:tip
119 $ hg qimport -r 1:tip
120
120
121 $ hg up -q 0
121 $ hg up -q 0
122
122
123 $ for i in r1 r3 r7 r8;
123 $ for i in r1 r3 r7 r8;
124 > do
124 > do
125 > echo $i > $i
125 > echo $i > $i
126 > hg ci -Am branch2-$i
126 > hg ci -Am branch2-$i
127 > done
127 > done
128 adding r1
128 adding r1
129 created new head
129 created new head
130 adding r3
130 adding r3
131 adding r7
131 adding r7
132 adding r8
132 adding r8
133
133
134 $ echo somethingelse > r4
134 $ echo somethingelse > r4
135 $ hg ci -Am branch2-r4
135 $ hg ci -Am branch2-r4
136 adding r4
136 adding r4
137
137
138 $ echo r6 > r6
138 $ echo r6 > r6
139 $ hg ci -Am branch2-r6
139 $ hg ci -Am branch2-r6
140 adding r6
140 adding r6
141
141
142 $ hg up -q qtip
142 $ hg up -q qtip
143
143
144 $ HGMERGE=internal:fail hg rebase
144 $ HGMERGE=internal:fail hg rebase
145 rebasing 1:b4bffa6e4776 "r1" (qbase r1)
145 rebasing 1:b4bffa6e4776 "r1" (qbase r1)
146 note: rebase of 1:b4bffa6e4776 "r1" (qbase r1) created no changes to commit
146 note: not rebasing 1:b4bffa6e4776 "r1" (qbase r1), its destination already has all its changes
147 rebasing 2:c0fd129beb01 "r2" (r2)
147 rebasing 2:c0fd129beb01 "r2" (r2)
148 rebasing 3:6ff5b8feed8e "r3" (r3)
148 rebasing 3:6ff5b8feed8e "r3" (r3)
149 note: rebase of 3:6ff5b8feed8e "r3" (r3) created no changes to commit
149 note: not rebasing 3:6ff5b8feed8e "r3" (r3), its destination already has all its changes
150 rebasing 4:094320fec554 "r4" (r4)
150 rebasing 4:094320fec554 "r4" (r4)
151 unresolved conflicts (see hg resolve, then hg rebase --continue)
151 unresolved conflicts (see hg resolve, then hg rebase --continue)
152 [1]
152 [1]
153
153
154 $ HGMERGE=internal:local hg resolve --all
154 $ HGMERGE=internal:local hg resolve --all
155 (no more unresolved files)
155 (no more unresolved files)
156 continue: hg rebase --continue
156 continue: hg rebase --continue
157
157
158 $ hg rebase --continue
158 $ hg rebase --continue
159 already rebased 1:b4bffa6e4776 "r1" (qbase r1) as 057f55ff8f44
159 already rebased 1:b4bffa6e4776 "r1" (qbase r1) as 057f55ff8f44
160 already rebased 2:c0fd129beb01 "r2" (r2) as 1660ab13ce9a
160 already rebased 2:c0fd129beb01 "r2" (r2) as 1660ab13ce9a
161 already rebased 3:6ff5b8feed8e "r3" (r3) as 1660ab13ce9a
161 already rebased 3:6ff5b8feed8e "r3" (r3) as 1660ab13ce9a
162 rebasing 4:094320fec554 "r4" (r4)
162 rebasing 4:094320fec554 "r4" (r4)
163 note: rebase of 4:094320fec554 "r4" (r4) created no changes to commit
163 note: not rebasing 4:094320fec554 "r4" (r4), its destination already has all its changes
164 rebasing 5:681a378595ba "r5" (r5)
164 rebasing 5:681a378595ba "r5" (r5)
165 rebasing 6:512a1f24768b "r6" (qtip r6)
165 rebasing 6:512a1f24768b "r6" (qtip r6)
166 note: rebase of 6:512a1f24768b "r6" (qtip r6) created no changes to commit
166 note: not rebasing 6:512a1f24768b "r6" (qtip r6), its destination already has all its changes
167 saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-rebase.hg
167 saved backup bundle to $TESTTMP/b/.hg/strip-backup/b4bffa6e4776-b9bfb84d-rebase.hg
168
168
169 $ hg tglog
169 $ hg tglog
170 @ 8: 0b9735ce8f0a 'r5' tags: qtip r5 tip
170 @ 8: 0b9735ce8f0a 'r5' tags: qtip r5 tip
171 |
171 |
172 o 7: 1660ab13ce9a 'r2' tags: qbase r2
172 o 7: 1660ab13ce9a 'r2' tags: qbase r2
173 |
173 |
174 o 6: 057f55ff8f44 'branch2-r6' tags: qparent
174 o 6: 057f55ff8f44 'branch2-r6' tags: qparent
175 |
175 |
176 o 5: 1d7287f8deb1 'branch2-r4' tags:
176 o 5: 1d7287f8deb1 'branch2-r4' tags:
177 |
177 |
178 o 4: 3c10b9db2bd5 'branch2-r8' tags:
178 o 4: 3c10b9db2bd5 'branch2-r8' tags:
179 |
179 |
180 o 3: b684023158dc 'branch2-r7' tags:
180 o 3: b684023158dc 'branch2-r7' tags:
181 |
181 |
182 o 2: d817754b1251 'branch2-r3' tags:
182 o 2: d817754b1251 'branch2-r3' tags:
183 |
183 |
184 o 1: 0621a206f8a4 'branch2-r1' tags:
184 o 1: 0621a206f8a4 'branch2-r1' tags:
185 |
185 |
186 o 0: 222799e2f90b 'r0' tags:
186 o 0: 222799e2f90b 'r0' tags:
187
187
188
188
189 $ cd ..
189 $ cd ..
@@ -1,360 +1,360 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > mq=
4 > mq=
5 >
5 >
6 > [mq]
6 > [mq]
7 > plain=true
7 > plain=true
8 >
8 >
9 > [alias]
9 > [alias]
10 > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n"
10 > tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n"
11 > EOF
11 > EOF
12
12
13
13
14 $ hg init a
14 $ hg init a
15 $ cd a
15 $ cd a
16 $ hg qinit -c
16 $ hg qinit -c
17
17
18 $ echo c1 > f
18 $ echo c1 > f
19 $ hg add f
19 $ hg add f
20 $ hg ci -m C1
20 $ hg ci -m C1
21
21
22 $ echo r1 > f
22 $ echo r1 > f
23 $ hg ci -m R1
23 $ hg ci -m R1
24
24
25 $ hg up -q 0
25 $ hg up -q 0
26
26
27 $ hg qnew f.patch -d '1 0'
27 $ hg qnew f.patch -d '1 0'
28 $ echo mq1 > f
28 $ echo mq1 > f
29 $ hg qref -m P0
29 $ hg qref -m P0
30
30
31 $ hg qnew f2.patch
31 $ hg qnew f2.patch
32 $ echo mq2 > f
32 $ echo mq2 > f
33 $ hg qref -m P1 -d '2 0'
33 $ hg qref -m P1 -d '2 0'
34
34
35 $ hg tglog
35 $ hg tglog
36 @ 3: 929394423cd3 'P1' tags: f2.patch qtip tip
36 @ 3: 929394423cd3 'P1' tags: f2.patch qtip tip
37 |
37 |
38 o 2: 3504f44bffc0 'P0' tags: f.patch qbase
38 o 2: 3504f44bffc0 'P0' tags: f.patch qbase
39 |
39 |
40 | o 1: bac9ed9960d8 'R1' tags:
40 | o 1: bac9ed9960d8 'R1' tags:
41 |/
41 |/
42 o 0: 36f36ddbca61 'C1' tags: qparent
42 o 0: 36f36ddbca61 'C1' tags: qparent
43
43
44
44
45 Rebase - try to rebase on an applied mq patch:
45 Rebase - try to rebase on an applied mq patch:
46
46
47 $ hg rebase -s 1 -d 3
47 $ hg rebase -s 1 -d 3
48 abort: cannot rebase onto an applied mq patch
48 abort: cannot rebase onto an applied mq patch
49 [255]
49 [255]
50
50
51 Rebase - same thing, but mq patch is default dest:
51 Rebase - same thing, but mq patch is default dest:
52
52
53 $ hg up -q 1
53 $ hg up -q 1
54 $ hg rebase
54 $ hg rebase
55 abort: cannot rebase onto an applied mq patch
55 abort: cannot rebase onto an applied mq patch
56 [255]
56 [255]
57 $ hg up -q qtip
57 $ hg up -q qtip
58
58
59 Rebase - generate a conflict:
59 Rebase - generate a conflict:
60
60
61 $ hg rebase -s 2 -d 1
61 $ hg rebase -s 2 -d 1
62 rebasing 2:3504f44bffc0 "P0" (f.patch qbase)
62 rebasing 2:3504f44bffc0 "P0" (f.patch qbase)
63 merging f
63 merging f
64 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
64 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
65 unresolved conflicts (see hg resolve, then hg rebase --continue)
65 unresolved conflicts (see hg resolve, then hg rebase --continue)
66 [1]
66 [1]
67
67
68 Fix the 1st conflict:
68 Fix the 1st conflict:
69
69
70 $ echo mq1r1 > f
70 $ echo mq1r1 > f
71 $ hg resolve -m f
71 $ hg resolve -m f
72 (no more unresolved files)
72 (no more unresolved files)
73 continue: hg rebase --continue
73 continue: hg rebase --continue
74 $ hg rebase -c
74 $ hg rebase -c
75 rebasing 2:3504f44bffc0 "P0" (f.patch qbase)
75 rebasing 2:3504f44bffc0 "P0" (f.patch qbase)
76 rebasing 3:929394423cd3 "P1" (f2.patch qtip tip)
76 rebasing 3:929394423cd3 "P1" (f2.patch qtip tip)
77 merging f
77 merging f
78 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
78 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
79 unresolved conflicts (see hg resolve, then hg rebase --continue)
79 unresolved conflicts (see hg resolve, then hg rebase --continue)
80 [1]
80 [1]
81
81
82 Fix the 2nd conflict:
82 Fix the 2nd conflict:
83
83
84 $ echo mq1r1mq2 > f
84 $ echo mq1r1mq2 > f
85 $ hg resolve -m f
85 $ hg resolve -m f
86 (no more unresolved files)
86 (no more unresolved files)
87 continue: hg rebase --continue
87 continue: hg rebase --continue
88 $ hg rebase -c
88 $ hg rebase -c
89 already rebased 2:3504f44bffc0 "P0" (f.patch qbase) as ebe9914c0d1c
89 already rebased 2:3504f44bffc0 "P0" (f.patch qbase) as ebe9914c0d1c
90 rebasing 3:929394423cd3 "P1" (f2.patch qtip)
90 rebasing 3:929394423cd3 "P1" (f2.patch qtip)
91 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3504f44bffc0-30595b40-rebase.hg
91 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3504f44bffc0-30595b40-rebase.hg
92
92
93 $ hg tglog
93 $ hg tglog
94 @ 3: 462012cf340c 'P1' tags: f2.patch qtip tip
94 @ 3: 462012cf340c 'P1' tags: f2.patch qtip tip
95 |
95 |
96 o 2: ebe9914c0d1c 'P0' tags: f.patch qbase
96 o 2: ebe9914c0d1c 'P0' tags: f.patch qbase
97 |
97 |
98 o 1: bac9ed9960d8 'R1' tags: qparent
98 o 1: bac9ed9960d8 'R1' tags: qparent
99 |
99 |
100 o 0: 36f36ddbca61 'C1' tags:
100 o 0: 36f36ddbca61 'C1' tags:
101
101
102 $ hg up -q qbase
102 $ hg up -q qbase
103
103
104 $ cat f
104 $ cat f
105 mq1r1
105 mq1r1
106
106
107 $ cat .hg/patches/f.patch
107 $ cat .hg/patches/f.patch
108 # HG changeset patch
108 # HG changeset patch
109 # User test
109 # User test
110 # Date 1 0
110 # Date 1 0
111 # Thu Jan 01 00:00:01 1970 +0000
111 # Thu Jan 01 00:00:01 1970 +0000
112 # Node ID ebe9914c0d1c3f60096e952fa4dbb3d377dea3ab
112 # Node ID ebe9914c0d1c3f60096e952fa4dbb3d377dea3ab
113 # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0
113 # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0
114 P0
114 P0
115
115
116 diff -r bac9ed9960d8 -r ebe9914c0d1c f
116 diff -r bac9ed9960d8 -r ebe9914c0d1c f
117 --- a/f Thu Jan 01 00:00:00 1970 +0000
117 --- a/f Thu Jan 01 00:00:00 1970 +0000
118 +++ b/f Thu Jan 01 00:00:01 1970 +0000
118 +++ b/f Thu Jan 01 00:00:01 1970 +0000
119 @@ -1,1 +1,1 @@
119 @@ -1,1 +1,1 @@
120 -r1
120 -r1
121 +mq1r1
121 +mq1r1
122
122
123 Update to qtip:
123 Update to qtip:
124
124
125 $ hg up -q qtip
125 $ hg up -q qtip
126
126
127 $ cat f
127 $ cat f
128 mq1r1mq2
128 mq1r1mq2
129
129
130 $ cat .hg/patches/f2.patch
130 $ cat .hg/patches/f2.patch
131 # HG changeset patch
131 # HG changeset patch
132 # User test
132 # User test
133 # Date 2 0
133 # Date 2 0
134 # Thu Jan 01 00:00:02 1970 +0000
134 # Thu Jan 01 00:00:02 1970 +0000
135 # Node ID 462012cf340c97d44d62377c985a423f6bb82f07
135 # Node ID 462012cf340c97d44d62377c985a423f6bb82f07
136 # Parent ebe9914c0d1c3f60096e952fa4dbb3d377dea3ab
136 # Parent ebe9914c0d1c3f60096e952fa4dbb3d377dea3ab
137 P1
137 P1
138
138
139 diff -r ebe9914c0d1c -r 462012cf340c f
139 diff -r ebe9914c0d1c -r 462012cf340c f
140 --- a/f Thu Jan 01 00:00:01 1970 +0000
140 --- a/f Thu Jan 01 00:00:01 1970 +0000
141 +++ b/f Thu Jan 01 00:00:02 1970 +0000
141 +++ b/f Thu Jan 01 00:00:02 1970 +0000
142 @@ -1,1 +1,1 @@
142 @@ -1,1 +1,1 @@
143 -mq1r1
143 -mq1r1
144 +mq1r1mq2
144 +mq1r1mq2
145
145
146 Adding one git-style patch and one normal:
146 Adding one git-style patch and one normal:
147
147
148 $ hg qpop -a
148 $ hg qpop -a
149 popping f2.patch
149 popping f2.patch
150 popping f.patch
150 popping f.patch
151 patch queue now empty
151 patch queue now empty
152
152
153 $ rm -fr .hg/patches
153 $ rm -fr .hg/patches
154 $ hg qinit -c
154 $ hg qinit -c
155
155
156 $ hg up -q 0
156 $ hg up -q 0
157
157
158 $ hg qnew --git f_git.patch -d '3 0'
158 $ hg qnew --git f_git.patch -d '3 0'
159 $ echo mq1 > p
159 $ echo mq1 > p
160 $ hg add p
160 $ hg add p
161 $ hg qref --git -m 'P0 (git)'
161 $ hg qref --git -m 'P0 (git)'
162
162
163 $ hg qnew f.patch -d '4 0'
163 $ hg qnew f.patch -d '4 0'
164 $ echo mq2 > p
164 $ echo mq2 > p
165 $ hg qref -m P1
165 $ hg qref -m P1
166 $ hg qci -m 'save patch state'
166 $ hg qci -m 'save patch state'
167
167
168 $ hg qseries -s
168 $ hg qseries -s
169 f_git.patch: P0 (git)
169 f_git.patch: P0 (git)
170 f.patch: P1
170 f.patch: P1
171
171
172 $ hg -R .hg/patches manifest
172 $ hg -R .hg/patches manifest
173 .hgignore
173 .hgignore
174 f.patch
174 f.patch
175 f_git.patch
175 f_git.patch
176 series
176 series
177
177
178 $ cat .hg/patches/f_git.patch
178 $ cat .hg/patches/f_git.patch
179 Date: 3 0
179 Date: 3 0
180
180
181 P0 (git)
181 P0 (git)
182
182
183 diff --git a/p b/p
183 diff --git a/p b/p
184 new file mode 100644
184 new file mode 100644
185 --- /dev/null
185 --- /dev/null
186 +++ b/p
186 +++ b/p
187 @@ -0,0 +1,1 @@
187 @@ -0,0 +1,1 @@
188 +mq1
188 +mq1
189
189
190 $ cat .hg/patches/f.patch
190 $ cat .hg/patches/f.patch
191 Date: 4 0
191 Date: 4 0
192
192
193 P1
193 P1
194
194
195 diff -r ???????????? p (glob)
195 diff -r ???????????? p (glob)
196 --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob)
196 --- a/p ??? ??? ?? ??:??:?? ???? ????? (glob)
197 +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob)
197 +++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob)
198 @@ -1,1 +1,1 @@
198 @@ -1,1 +1,1 @@
199 -mq1
199 -mq1
200 +mq2
200 +mq2
201
201
202
202
203 Rebase the applied mq patches:
203 Rebase the applied mq patches:
204
204
205 $ hg rebase -s 2 -d 1
205 $ hg rebase -s 2 -d 1
206 rebasing 2:0c587ffcb480 "P0 (git)" (f_git.patch qbase)
206 rebasing 2:0c587ffcb480 "P0 (git)" (f_git.patch qbase)
207 rebasing 3:c7f18665e4bc "P1" (f.patch qtip tip)
207 rebasing 3:c7f18665e4bc "P1" (f.patch qtip tip)
208 saved backup bundle to $TESTTMP/a/.hg/strip-backup/0c587ffcb480-0ea5695f-rebase.hg
208 saved backup bundle to $TESTTMP/a/.hg/strip-backup/0c587ffcb480-0ea5695f-rebase.hg
209
209
210 $ hg qci -m 'save patch state'
210 $ hg qci -m 'save patch state'
211
211
212 $ hg qseries -s
212 $ hg qseries -s
213 f_git.patch: P0 (git)
213 f_git.patch: P0 (git)
214 f.patch: P1
214 f.patch: P1
215
215
216 $ hg -R .hg/patches manifest
216 $ hg -R .hg/patches manifest
217 .hgignore
217 .hgignore
218 f.patch
218 f.patch
219 f_git.patch
219 f_git.patch
220 series
220 series
221
221
222 $ cat .hg/patches/f_git.patch
222 $ cat .hg/patches/f_git.patch
223 # HG changeset patch
223 # HG changeset patch
224 # User test
224 # User test
225 # Date 3 0
225 # Date 3 0
226 # Thu Jan 01 00:00:03 1970 +0000
226 # Thu Jan 01 00:00:03 1970 +0000
227 # Node ID 12d9f6a3bbe560dee50c7c454d434add7fb8e837
227 # Node ID 12d9f6a3bbe560dee50c7c454d434add7fb8e837
228 # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0
228 # Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0
229 P0 (git)
229 P0 (git)
230
230
231 diff --git a/p b/p
231 diff --git a/p b/p
232 new file mode 100644
232 new file mode 100644
233 --- /dev/null
233 --- /dev/null
234 +++ b/p
234 +++ b/p
235 @@ -0,0 +1,1 @@
235 @@ -0,0 +1,1 @@
236 +mq1
236 +mq1
237
237
238 $ cat .hg/patches/f.patch
238 $ cat .hg/patches/f.patch
239 # HG changeset patch
239 # HG changeset patch
240 # User test
240 # User test
241 # Date 4 0
241 # Date 4 0
242 # Thu Jan 01 00:00:04 1970 +0000
242 # Thu Jan 01 00:00:04 1970 +0000
243 # Node ID c77a2661c64c60d82f63c4f7aefd95b3a948a557
243 # Node ID c77a2661c64c60d82f63c4f7aefd95b3a948a557
244 # Parent 12d9f6a3bbe560dee50c7c454d434add7fb8e837
244 # Parent 12d9f6a3bbe560dee50c7c454d434add7fb8e837
245 P1
245 P1
246
246
247 diff -r 12d9f6a3bbe5 -r c77a2661c64c p
247 diff -r 12d9f6a3bbe5 -r c77a2661c64c p
248 --- a/p Thu Jan 01 00:00:03 1970 +0000
248 --- a/p Thu Jan 01 00:00:03 1970 +0000
249 +++ b/p Thu Jan 01 00:00:04 1970 +0000
249 +++ b/p Thu Jan 01 00:00:04 1970 +0000
250 @@ -1,1 +1,1 @@
250 @@ -1,1 +1,1 @@
251 -mq1
251 -mq1
252 +mq2
252 +mq2
253
253
254 $ cd ..
254 $ cd ..
255
255
256 Rebase with guards
256 Rebase with guards
257
257
258 $ hg init foo
258 $ hg init foo
259 $ cd foo
259 $ cd foo
260 $ echo a > a
260 $ echo a > a
261 $ hg ci -Am a
261 $ hg ci -Am a
262 adding a
262 adding a
263
263
264 Create mq repo with guarded patches foo and bar and empty patch:
264 Create mq repo with guarded patches foo and bar and empty patch:
265
265
266 $ hg qinit
266 $ hg qinit
267 $ echo guarded > guarded
267 $ echo guarded > guarded
268 $ hg add guarded
268 $ hg add guarded
269 $ hg qnew guarded
269 $ hg qnew guarded
270 $ hg qnew empty-important -m 'important commit message' -d '1 0'
270 $ hg qnew empty-important -m 'important commit message' -d '1 0'
271 $ echo bar > bar
271 $ echo bar > bar
272 $ hg add bar
272 $ hg add bar
273 $ hg qnew bar -d '2 0'
273 $ hg qnew bar -d '2 0'
274 $ echo foo > foo
274 $ echo foo > foo
275 $ hg add foo
275 $ hg add foo
276 $ hg qnew foo
276 $ hg qnew foo
277 $ hg qpop -a
277 $ hg qpop -a
278 popping foo
278 popping foo
279 popping bar
279 popping bar
280 popping empty-important
280 popping empty-important
281 popping guarded
281 popping guarded
282 patch queue now empty
282 patch queue now empty
283 $ hg qguard guarded +guarded
283 $ hg qguard guarded +guarded
284 $ hg qguard bar +baz
284 $ hg qguard bar +baz
285 $ hg qguard foo +baz
285 $ hg qguard foo +baz
286 $ hg qselect baz
286 $ hg qselect baz
287 number of unguarded, unapplied patches has changed from 1 to 3
287 number of unguarded, unapplied patches has changed from 1 to 3
288 $ hg qpush bar
288 $ hg qpush bar
289 applying empty-important
289 applying empty-important
290 patch empty-important is empty
290 patch empty-important is empty
291 applying bar
291 applying bar
292 now at: bar
292 now at: bar
293
293
294 $ hg qguard -l
294 $ hg qguard -l
295 guarded: +guarded
295 guarded: +guarded
296 empty-important: unguarded
296 empty-important: unguarded
297 bar: +baz
297 bar: +baz
298 foo: +baz
298 foo: +baz
299
299
300 $ hg tglog
300 $ hg tglog
301 @ 2: 4f44b861d38c 'imported patch bar' tags: bar qtip tip
301 @ 2: 4f44b861d38c 'imported patch bar' tags: bar qtip tip
302 |
302 |
303 o 1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase
303 o 1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase
304 |
304 |
305 o 0: cb9a9f314b8b 'a' tags: qparent
305 o 0: cb9a9f314b8b 'a' tags: qparent
306
306
307 Create new head to rebase bar onto:
307 Create new head to rebase bar onto:
308
308
309 $ hg up -C 0
309 $ hg up -C 0
310 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
310 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
311 $ echo b > b
311 $ echo b > b
312 $ hg add b
312 $ hg add b
313 $ hg ci -m b
313 $ hg ci -m b
314 created new head
314 created new head
315 $ hg up -C 2
315 $ hg up -C 2
316 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
316 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
317 $ echo a >> a
317 $ echo a >> a
318 $ hg qref
318 $ hg qref
319
319
320 $ hg tglog
320 $ hg tglog
321 @ 3: d526d4536ed6 '[mq]: bar' tags: bar qtip tip
321 @ 3: d526d4536ed6 '[mq]: bar' tags: bar qtip tip
322 |
322 |
323 | o 2: d2ae7f538514 'b' tags:
323 | o 2: d2ae7f538514 'b' tags:
324 | |
324 | |
325 o | 1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase
325 o | 1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase
326 |/
326 |/
327 o 0: cb9a9f314b8b 'a' tags: qparent
327 o 0: cb9a9f314b8b 'a' tags: qparent
328
328
329
329
330 Rebase bar (make sure series order is preserved and empty-important also is
330 Rebase bar (make sure series order is preserved and empty-important also is
331 removed from the series):
331 removed from the series):
332
332
333 $ hg qseries
333 $ hg qseries
334 guarded
334 guarded
335 empty-important
335 empty-important
336 bar
336 bar
337 foo
337 foo
338 $ [ -f .hg/patches/empty-important ]
338 $ [ -f .hg/patches/empty-important ]
339 $ hg -q rebase -d 2
339 $ hg -q rebase -d 2
340 note: rebase of 1:0aaf4c3af7eb "important commit message" (empty-important qbase) created no changes to commit
340 note: not rebasing 1:0aaf4c3af7eb "important commit message" (empty-important qbase), its destination already has all its changes
341 $ hg qseries
341 $ hg qseries
342 guarded
342 guarded
343 bar
343 bar
344 foo
344 foo
345 $ [ -f .hg/patches/empty-important ]
345 $ [ -f .hg/patches/empty-important ]
346 [1]
346 [1]
347
347
348 $ hg qguard -l
348 $ hg qguard -l
349 guarded: +guarded
349 guarded: +guarded
350 bar: +baz
350 bar: +baz
351 foo: +baz
351 foo: +baz
352
352
353 $ hg tglog
353 $ hg tglog
354 @ 2: 477d948bb2af '[mq]: bar' tags: bar qbase qtip tip
354 @ 2: 477d948bb2af '[mq]: bar' tags: bar qbase qtip tip
355 |
355 |
356 o 1: d2ae7f538514 'b' tags: qparent
356 o 1: d2ae7f538514 'b' tags: qparent
357 |
357 |
358 o 0: cb9a9f314b8b 'a' tags:
358 o 0: cb9a9f314b8b 'a' tags:
359
359
360 $ cd ..
360 $ cd ..
@@ -1,410 +1,410 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
10 > EOF
10 > EOF
11
11
12 $ hg init a
12 $ hg init a
13 $ cd a
13 $ cd a
14 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
14 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
15 adding changesets
15 adding changesets
16 adding manifests
16 adding manifests
17 adding file changes
17 adding file changes
18 added 8 changesets with 7 changes to 7 files (+2 heads)
18 added 8 changesets with 7 changes to 7 files (+2 heads)
19 new changesets cd010b8cd998:02de42196ebe (8 drafts)
19 new changesets cd010b8cd998:02de42196ebe (8 drafts)
20 (run 'hg heads' to see heads, 'hg merge' to merge)
20 (run 'hg heads' to see heads, 'hg merge' to merge)
21 $ hg up tip
21 $ hg up tip
22 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 $ cd ..
23 $ cd ..
24
24
25 $ hg clone -q -u . a a1
25 $ hg clone -q -u . a a1
26
26
27 $ cd a1
27 $ cd a1
28
28
29 $ hg update 3
29 $ hg update 3
30 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
30 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
31 $ hg branch dev-one
31 $ hg branch dev-one
32 marked working directory as branch dev-one
32 marked working directory as branch dev-one
33 (branches are permanent and global, did you want a bookmark?)
33 (branches are permanent and global, did you want a bookmark?)
34 $ hg ci -m 'dev-one named branch'
34 $ hg ci -m 'dev-one named branch'
35
35
36 $ hg update 7
36 $ hg update 7
37 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
37 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
38 $ hg branch dev-two
38 $ hg branch dev-two
39 marked working directory as branch dev-two
39 marked working directory as branch dev-two
40
40
41 $ echo x > x
41 $ echo x > x
42
42
43 $ hg add x
43 $ hg add x
44
44
45 $ hg ci -m 'dev-two named branch'
45 $ hg ci -m 'dev-two named branch'
46
46
47 $ hg tglog
47 $ hg tglog
48 @ 9: cb039b7cae8e 'dev-two named branch' dev-two
48 @ 9: cb039b7cae8e 'dev-two named branch' dev-two
49 |
49 |
50 | o 8: 643fc9128048 'dev-one named branch' dev-one
50 | o 8: 643fc9128048 'dev-one named branch' dev-one
51 | |
51 | |
52 o | 7: 02de42196ebe 'H'
52 o | 7: 02de42196ebe 'H'
53 | |
53 | |
54 +---o 6: eea13746799a 'G'
54 +---o 6: eea13746799a 'G'
55 | | |
55 | | |
56 o | | 5: 24b6387c8c8c 'F'
56 o | | 5: 24b6387c8c8c 'F'
57 | | |
57 | | |
58 +---o 4: 9520eea781bc 'E'
58 +---o 4: 9520eea781bc 'E'
59 | |
59 | |
60 | o 3: 32af7686d403 'D'
60 | o 3: 32af7686d403 'D'
61 | |
61 | |
62 | o 2: 5fddd98957c8 'C'
62 | o 2: 5fddd98957c8 'C'
63 | |
63 | |
64 | o 1: 42ccdea3bb16 'B'
64 | o 1: 42ccdea3bb16 'B'
65 |/
65 |/
66 o 0: cd010b8cd998 'A'
66 o 0: cd010b8cd998 'A'
67
67
68
68
69 Branch name containing a dash (issue3181)
69 Branch name containing a dash (issue3181)
70
70
71 $ hg rebase -b dev-two -d dev-one --keepbranches
71 $ hg rebase -b dev-two -d dev-one --keepbranches
72 rebasing 5:24b6387c8c8c "F"
72 rebasing 5:24b6387c8c8c "F"
73 rebasing 6:eea13746799a "G"
73 rebasing 6:eea13746799a "G"
74 rebasing 7:02de42196ebe "H"
74 rebasing 7:02de42196ebe "H"
75 rebasing 9:cb039b7cae8e "dev-two named branch" (tip)
75 rebasing 9:cb039b7cae8e "dev-two named branch" (tip)
76 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg
76 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/24b6387c8c8c-24cb8001-rebase.hg
77
77
78 $ hg tglog
78 $ hg tglog
79 @ 9: 9e70cd31750f 'dev-two named branch' dev-two
79 @ 9: 9e70cd31750f 'dev-two named branch' dev-two
80 |
80 |
81 o 8: 31d0e4ba75e6 'H'
81 o 8: 31d0e4ba75e6 'H'
82 |
82 |
83 | o 7: 4b988a958030 'G'
83 | o 7: 4b988a958030 'G'
84 |/|
84 |/|
85 o | 6: 24de4aff8e28 'F'
85 o | 6: 24de4aff8e28 'F'
86 | |
86 | |
87 o | 5: 643fc9128048 'dev-one named branch' dev-one
87 o | 5: 643fc9128048 'dev-one named branch' dev-one
88 | |
88 | |
89 | o 4: 9520eea781bc 'E'
89 | o 4: 9520eea781bc 'E'
90 | |
90 | |
91 o | 3: 32af7686d403 'D'
91 o | 3: 32af7686d403 'D'
92 | |
92 | |
93 o | 2: 5fddd98957c8 'C'
93 o | 2: 5fddd98957c8 'C'
94 | |
94 | |
95 o | 1: 42ccdea3bb16 'B'
95 o | 1: 42ccdea3bb16 'B'
96 |/
96 |/
97 o 0: cd010b8cd998 'A'
97 o 0: cd010b8cd998 'A'
98
98
99 $ hg rebase -s dev-one -d 0 --keepbranches
99 $ hg rebase -s dev-one -d 0 --keepbranches
100 rebasing 5:643fc9128048 "dev-one named branch"
100 rebasing 5:643fc9128048 "dev-one named branch"
101 rebasing 6:24de4aff8e28 "F"
101 rebasing 6:24de4aff8e28 "F"
102 rebasing 7:4b988a958030 "G"
102 rebasing 7:4b988a958030 "G"
103 rebasing 8:31d0e4ba75e6 "H"
103 rebasing 8:31d0e4ba75e6 "H"
104 rebasing 9:9e70cd31750f "dev-two named branch" (tip)
104 rebasing 9:9e70cd31750f "dev-two named branch" (tip)
105 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg
105 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-c4ee9ef5-rebase.hg
106
106
107 $ hg tglog
107 $ hg tglog
108 @ 9: 59c2e59309fe 'dev-two named branch' dev-two
108 @ 9: 59c2e59309fe 'dev-two named branch' dev-two
109 |
109 |
110 o 8: 904590360559 'H'
110 o 8: 904590360559 'H'
111 |
111 |
112 | o 7: 1a1e6f72ec38 'G'
112 | o 7: 1a1e6f72ec38 'G'
113 |/|
113 |/|
114 o | 6: 42aa3cf0fa7a 'F'
114 o | 6: 42aa3cf0fa7a 'F'
115 | |
115 | |
116 o | 5: bc8139ee757c 'dev-one named branch' dev-one
116 o | 5: bc8139ee757c 'dev-one named branch' dev-one
117 | |
117 | |
118 | o 4: 9520eea781bc 'E'
118 | o 4: 9520eea781bc 'E'
119 |/
119 |/
120 | o 3: 32af7686d403 'D'
120 | o 3: 32af7686d403 'D'
121 | |
121 | |
122 | o 2: 5fddd98957c8 'C'
122 | o 2: 5fddd98957c8 'C'
123 | |
123 | |
124 | o 1: 42ccdea3bb16 'B'
124 | o 1: 42ccdea3bb16 'B'
125 |/
125 |/
126 o 0: cd010b8cd998 'A'
126 o 0: cd010b8cd998 'A'
127
127
128 $ hg update 3
128 $ hg update 3
129 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
129 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
130 $ hg branch -f dev-one
130 $ hg branch -f dev-one
131 marked working directory as branch dev-one
131 marked working directory as branch dev-one
132 $ hg ci -m 'dev-one named branch'
132 $ hg ci -m 'dev-one named branch'
133 created new head
133 created new head
134
134
135 $ hg tglog
135 $ hg tglog
136 @ 10: 643fc9128048 'dev-one named branch' dev-one
136 @ 10: 643fc9128048 'dev-one named branch' dev-one
137 |
137 |
138 | o 9: 59c2e59309fe 'dev-two named branch' dev-two
138 | o 9: 59c2e59309fe 'dev-two named branch' dev-two
139 | |
139 | |
140 | o 8: 904590360559 'H'
140 | o 8: 904590360559 'H'
141 | |
141 | |
142 | | o 7: 1a1e6f72ec38 'G'
142 | | o 7: 1a1e6f72ec38 'G'
143 | |/|
143 | |/|
144 | o | 6: 42aa3cf0fa7a 'F'
144 | o | 6: 42aa3cf0fa7a 'F'
145 | | |
145 | | |
146 | o | 5: bc8139ee757c 'dev-one named branch' dev-one
146 | o | 5: bc8139ee757c 'dev-one named branch' dev-one
147 | | |
147 | | |
148 | | o 4: 9520eea781bc 'E'
148 | | o 4: 9520eea781bc 'E'
149 | |/
149 | |/
150 o | 3: 32af7686d403 'D'
150 o | 3: 32af7686d403 'D'
151 | |
151 | |
152 o | 2: 5fddd98957c8 'C'
152 o | 2: 5fddd98957c8 'C'
153 | |
153 | |
154 o | 1: 42ccdea3bb16 'B'
154 o | 1: 42ccdea3bb16 'B'
155 |/
155 |/
156 o 0: cd010b8cd998 'A'
156 o 0: cd010b8cd998 'A'
157
157
158 $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches
158 $ hg rebase -b 'max(branch("dev-two"))' -d dev-one --keepbranches
159 rebasing 5:bc8139ee757c "dev-one named branch"
159 rebasing 5:bc8139ee757c "dev-one named branch"
160 note: rebase of 5:bc8139ee757c "dev-one named branch" created no changes to commit
160 note: not rebasing 5:bc8139ee757c "dev-one named branch", its destination already has all its changes
161 rebasing 6:42aa3cf0fa7a "F"
161 rebasing 6:42aa3cf0fa7a "F"
162 rebasing 7:1a1e6f72ec38 "G"
162 rebasing 7:1a1e6f72ec38 "G"
163 rebasing 8:904590360559 "H"
163 rebasing 8:904590360559 "H"
164 rebasing 9:59c2e59309fe "dev-two named branch"
164 rebasing 9:59c2e59309fe "dev-two named branch"
165 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg
165 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/bc8139ee757c-f11c1080-rebase.hg
166
166
167 $ hg tglog
167 $ hg tglog
168 o 9: 71325f8bc082 'dev-two named branch' dev-two
168 o 9: 71325f8bc082 'dev-two named branch' dev-two
169 |
169 |
170 o 8: 12b2bc666e20 'H'
170 o 8: 12b2bc666e20 'H'
171 |
171 |
172 | o 7: 549f007a9f5f 'G'
172 | o 7: 549f007a9f5f 'G'
173 |/|
173 |/|
174 o | 6: 679f28760620 'F'
174 o | 6: 679f28760620 'F'
175 | |
175 | |
176 @ | 5: 643fc9128048 'dev-one named branch' dev-one
176 @ | 5: 643fc9128048 'dev-one named branch' dev-one
177 | |
177 | |
178 | o 4: 9520eea781bc 'E'
178 | o 4: 9520eea781bc 'E'
179 | |
179 | |
180 o | 3: 32af7686d403 'D'
180 o | 3: 32af7686d403 'D'
181 | |
181 | |
182 o | 2: 5fddd98957c8 'C'
182 o | 2: 5fddd98957c8 'C'
183 | |
183 | |
184 o | 1: 42ccdea3bb16 'B'
184 o | 1: 42ccdea3bb16 'B'
185 |/
185 |/
186 o 0: cd010b8cd998 'A'
186 o 0: cd010b8cd998 'A'
187
187
188 $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches
188 $ hg rebase -s 'max(branch("dev-one"))' -d 0 --keepbranches
189 rebasing 5:643fc9128048 "dev-one named branch"
189 rebasing 5:643fc9128048 "dev-one named branch"
190 rebasing 6:679f28760620 "F"
190 rebasing 6:679f28760620 "F"
191 rebasing 7:549f007a9f5f "G"
191 rebasing 7:549f007a9f5f "G"
192 rebasing 8:12b2bc666e20 "H"
192 rebasing 8:12b2bc666e20 "H"
193 rebasing 9:71325f8bc082 "dev-two named branch" (tip)
193 rebasing 9:71325f8bc082 "dev-two named branch" (tip)
194 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg
194 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/643fc9128048-6cdd1a52-rebase.hg
195
195
196 $ hg tglog
196 $ hg tglog
197 o 9: 3944801ae4ea 'dev-two named branch' dev-two
197 o 9: 3944801ae4ea 'dev-two named branch' dev-two
198 |
198 |
199 o 8: 8e279d293175 'H'
199 o 8: 8e279d293175 'H'
200 |
200 |
201 | o 7: aeefee77ab01 'G'
201 | o 7: aeefee77ab01 'G'
202 |/|
202 |/|
203 o | 6: e908b85f3729 'F'
203 o | 6: e908b85f3729 'F'
204 | |
204 | |
205 @ | 5: bc8139ee757c 'dev-one named branch' dev-one
205 @ | 5: bc8139ee757c 'dev-one named branch' dev-one
206 | |
206 | |
207 | o 4: 9520eea781bc 'E'
207 | o 4: 9520eea781bc 'E'
208 |/
208 |/
209 | o 3: 32af7686d403 'D'
209 | o 3: 32af7686d403 'D'
210 | |
210 | |
211 | o 2: 5fddd98957c8 'C'
211 | o 2: 5fddd98957c8 'C'
212 | |
212 | |
213 | o 1: 42ccdea3bb16 'B'
213 | o 1: 42ccdea3bb16 'B'
214 |/
214 |/
215 o 0: cd010b8cd998 'A'
215 o 0: cd010b8cd998 'A'
216
216
217 $ hg up -r 0 > /dev/null
217 $ hg up -r 0 > /dev/null
218
218
219 Rebasing descendant onto ancestor across different named branches
219 Rebasing descendant onto ancestor across different named branches
220
220
221 $ hg rebase -s 1 -d 9 --keepbranches
221 $ hg rebase -s 1 -d 9 --keepbranches
222 rebasing 1:42ccdea3bb16 "B"
222 rebasing 1:42ccdea3bb16 "B"
223 rebasing 2:5fddd98957c8 "C"
223 rebasing 2:5fddd98957c8 "C"
224 rebasing 3:32af7686d403 "D"
224 rebasing 3:32af7686d403 "D"
225 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
225 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
226
226
227 $ hg tglog
227 $ hg tglog
228 o 9: e9f862ce8bad 'D'
228 o 9: e9f862ce8bad 'D'
229 |
229 |
230 o 8: a0d543090fa4 'C'
230 o 8: a0d543090fa4 'C'
231 |
231 |
232 o 7: 3bdb949809d9 'B'
232 o 7: 3bdb949809d9 'B'
233 |
233 |
234 o 6: 3944801ae4ea 'dev-two named branch' dev-two
234 o 6: 3944801ae4ea 'dev-two named branch' dev-two
235 |
235 |
236 o 5: 8e279d293175 'H'
236 o 5: 8e279d293175 'H'
237 |
237 |
238 | o 4: aeefee77ab01 'G'
238 | o 4: aeefee77ab01 'G'
239 |/|
239 |/|
240 o | 3: e908b85f3729 'F'
240 o | 3: e908b85f3729 'F'
241 | |
241 | |
242 o | 2: bc8139ee757c 'dev-one named branch' dev-one
242 o | 2: bc8139ee757c 'dev-one named branch' dev-one
243 | |
243 | |
244 | o 1: 9520eea781bc 'E'
244 | o 1: 9520eea781bc 'E'
245 |/
245 |/
246 @ 0: cd010b8cd998 'A'
246 @ 0: cd010b8cd998 'A'
247
247
248 $ hg rebase -s 5 -d 6
248 $ hg rebase -s 5 -d 6
249 abort: source and destination form a cycle
249 abort: source and destination form a cycle
250 [255]
250 [255]
251
251
252 $ hg rebase -s 6 -d 5
252 $ hg rebase -s 6 -d 5
253 rebasing 6:3944801ae4ea "dev-two named branch"
253 rebasing 6:3944801ae4ea "dev-two named branch"
254 rebasing 7:3bdb949809d9 "B"
254 rebasing 7:3bdb949809d9 "B"
255 rebasing 8:a0d543090fa4 "C"
255 rebasing 8:a0d543090fa4 "C"
256 rebasing 9:e9f862ce8bad "D" (tip)
256 rebasing 9:e9f862ce8bad "D" (tip)
257 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg
257 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/3944801ae4ea-fb46ed74-rebase.hg
258
258
259 $ hg tglog
259 $ hg tglog
260 o 9: e522577ccdbd 'D'
260 o 9: e522577ccdbd 'D'
261 |
261 |
262 o 8: 810110211f50 'C'
262 o 8: 810110211f50 'C'
263 |
263 |
264 o 7: 160b0930ccc6 'B'
264 o 7: 160b0930ccc6 'B'
265 |
265 |
266 o 6: c57724c84928 'dev-two named branch'
266 o 6: c57724c84928 'dev-two named branch'
267 |
267 |
268 o 5: 8e279d293175 'H'
268 o 5: 8e279d293175 'H'
269 |
269 |
270 | o 4: aeefee77ab01 'G'
270 | o 4: aeefee77ab01 'G'
271 |/|
271 |/|
272 o | 3: e908b85f3729 'F'
272 o | 3: e908b85f3729 'F'
273 | |
273 | |
274 o | 2: bc8139ee757c 'dev-one named branch' dev-one
274 o | 2: bc8139ee757c 'dev-one named branch' dev-one
275 | |
275 | |
276 | o 1: 9520eea781bc 'E'
276 | o 1: 9520eea781bc 'E'
277 |/
277 |/
278 @ 0: cd010b8cd998 'A'
278 @ 0: cd010b8cd998 'A'
279
279
280
280
281 Reopen branch by rebase
281 Reopen branch by rebase
282
282
283 $ hg up -qr3
283 $ hg up -qr3
284 $ hg branch -q b
284 $ hg branch -q b
285 $ hg ci -m 'create b'
285 $ hg ci -m 'create b'
286 $ hg ci -m 'close b' --close
286 $ hg ci -m 'close b' --close
287 $ hg rebase -b 8 -d b
287 $ hg rebase -b 8 -d b
288 reopening closed branch head 2b586e70108d
288 reopening closed branch head 2b586e70108d
289 rebasing 5:8e279d293175 "H"
289 rebasing 5:8e279d293175 "H"
290 rebasing 6:c57724c84928 "dev-two named branch"
290 rebasing 6:c57724c84928 "dev-two named branch"
291 rebasing 7:160b0930ccc6 "B"
291 rebasing 7:160b0930ccc6 "B"
292 rebasing 8:810110211f50 "C"
292 rebasing 8:810110211f50 "C"
293 rebasing 9:e522577ccdbd "D"
293 rebasing 9:e522577ccdbd "D"
294 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg
294 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/8e279d293175-b023e27c-rebase.hg
295
295
296 $ cd ..
296 $ cd ..
297
297
298 Rebase to other head on branch
298 Rebase to other head on branch
299
299
300 Set up a case:
300 Set up a case:
301
301
302 $ hg init case1
302 $ hg init case1
303 $ cd case1
303 $ cd case1
304 $ touch f
304 $ touch f
305 $ hg ci -qAm0
305 $ hg ci -qAm0
306 $ hg branch -q b
306 $ hg branch -q b
307 $ echo >> f
307 $ echo >> f
308 $ hg ci -qAm 'b1'
308 $ hg ci -qAm 'b1'
309 $ hg up -qr -2
309 $ hg up -qr -2
310 $ hg branch -qf b
310 $ hg branch -qf b
311 $ hg ci -qm 'b2'
311 $ hg ci -qm 'b2'
312 $ hg up -qr -3
312 $ hg up -qr -3
313 $ hg branch -q c
313 $ hg branch -q c
314 $ hg ci -m 'c1'
314 $ hg ci -m 'c1'
315
315
316 $ hg tglog
316 $ hg tglog
317 @ 3: c062e3ecd6c6 'c1' c
317 @ 3: c062e3ecd6c6 'c1' c
318 |
318 |
319 | o 2: 792845bb77ee 'b2' b
319 | o 2: 792845bb77ee 'b2' b
320 |/
320 |/
321 | o 1: 40039acb7ca5 'b1' b
321 | o 1: 40039acb7ca5 'b1' b
322 |/
322 |/
323 o 0: d681519c3ea7 '0'
323 o 0: d681519c3ea7 '0'
324
324
325 $ hg clone -q . ../case2
325 $ hg clone -q . ../case2
326
326
327 rebase 'b2' to another lower branch head
327 rebase 'b2' to another lower branch head
328
328
329 $ hg up -qr 2
329 $ hg up -qr 2
330 $ hg rebase
330 $ hg rebase
331 rebasing 2:792845bb77ee "b2"
331 rebasing 2:792845bb77ee "b2"
332 note: rebase of 2:792845bb77ee "b2" created no changes to commit
332 note: not rebasing 2:792845bb77ee "b2", its destination already has all its changes
333 saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg
333 saved backup bundle to $TESTTMP/case1/.hg/strip-backup/792845bb77ee-627120ee-rebase.hg
334 $ hg tglog
334 $ hg tglog
335 o 2: c062e3ecd6c6 'c1' c
335 o 2: c062e3ecd6c6 'c1' c
336 |
336 |
337 | @ 1: 40039acb7ca5 'b1' b
337 | @ 1: 40039acb7ca5 'b1' b
338 |/
338 |/
339 o 0: d681519c3ea7 '0'
339 o 0: d681519c3ea7 '0'
340
340
341
341
342 rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1')
342 rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1')
343
343
344 $ cd ../case2
344 $ cd ../case2
345 $ hg up -qr 1
345 $ hg up -qr 1
346 $ hg rebase
346 $ hg rebase
347 rebasing 1:40039acb7ca5 "b1"
347 rebasing 1:40039acb7ca5 "b1"
348 saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg
348 saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-342b72d1-rebase.hg
349 $ hg tglog
349 $ hg tglog
350 @ 3: 76abc1c6f8c7 'b1' b
350 @ 3: 76abc1c6f8c7 'b1' b
351 |
351 |
352 | o 2: c062e3ecd6c6 'c1' c
352 | o 2: c062e3ecd6c6 'c1' c
353 | |
353 | |
354 o | 1: 792845bb77ee 'b2' b
354 o | 1: 792845bb77ee 'b2' b
355 |/
355 |/
356 o 0: d681519c3ea7 '0'
356 o 0: d681519c3ea7 '0'
357
357
358
358
359 rebase 'c1' to the branch head 'c2' that is closed
359 rebase 'c1' to the branch head 'c2' that is closed
360
360
361 $ hg branch -qf c
361 $ hg branch -qf c
362 $ hg ci -qm 'c2 closed' --close
362 $ hg ci -qm 'c2 closed' --close
363 $ hg up -qr 2
363 $ hg up -qr 2
364 $ hg tglog
364 $ hg tglog
365 _ 4: 8427af5d86f2 'c2 closed' c
365 _ 4: 8427af5d86f2 'c2 closed' c
366 |
366 |
367 o 3: 76abc1c6f8c7 'b1' b
367 o 3: 76abc1c6f8c7 'b1' b
368 |
368 |
369 | @ 2: c062e3ecd6c6 'c1' c
369 | @ 2: c062e3ecd6c6 'c1' c
370 | |
370 | |
371 o | 1: 792845bb77ee 'b2' b
371 o | 1: 792845bb77ee 'b2' b
372 |/
372 |/
373 o 0: d681519c3ea7 '0'
373 o 0: d681519c3ea7 '0'
374
374
375 $ hg rebase
375 $ hg rebase
376 abort: branch 'c' has one head - please rebase to an explicit rev
376 abort: branch 'c' has one head - please rebase to an explicit rev
377 (run 'hg heads' to see all heads)
377 (run 'hg heads' to see all heads)
378 [255]
378 [255]
379 $ hg tglog
379 $ hg tglog
380 _ 4: 8427af5d86f2 'c2 closed' c
380 _ 4: 8427af5d86f2 'c2 closed' c
381 |
381 |
382 o 3: 76abc1c6f8c7 'b1' b
382 o 3: 76abc1c6f8c7 'b1' b
383 |
383 |
384 | @ 2: c062e3ecd6c6 'c1' c
384 | @ 2: c062e3ecd6c6 'c1' c
385 | |
385 | |
386 o | 1: 792845bb77ee 'b2' b
386 o | 1: 792845bb77ee 'b2' b
387 |/
387 |/
388 o 0: d681519c3ea7 '0'
388 o 0: d681519c3ea7 '0'
389
389
390
390
391 $ hg up -cr 1
391 $ hg up -cr 1
392 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
392 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
393 $ hg branch x
393 $ hg branch x
394 marked working directory as branch x
394 marked working directory as branch x
395 $ hg rebase -r 3:: -d .
395 $ hg rebase -r 3:: -d .
396 rebasing 3:76abc1c6f8c7 "b1"
396 rebasing 3:76abc1c6f8c7 "b1"
397 rebasing 4:8427af5d86f2 "c2 closed" (tip)
397 rebasing 4:8427af5d86f2 "c2 closed" (tip)
398 note: rebase of 4:8427af5d86f2 "c2 closed" (tip) created no changes to commit
398 note: not rebasing 4:8427af5d86f2 "c2 closed" (tip), its destination already has all its changes
399 saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg
399 saved backup bundle to $TESTTMP/case2/.hg/strip-backup/76abc1c6f8c7-cd698d13-rebase.hg
400 $ hg tglog
400 $ hg tglog
401 o 3: 117b0ed08075 'b1' x
401 o 3: 117b0ed08075 'b1' x
402 |
402 |
403 | o 2: c062e3ecd6c6 'c1' c
403 | o 2: c062e3ecd6c6 'c1' c
404 | |
404 | |
405 @ | 1: 792845bb77ee 'b2' b
405 @ | 1: 792845bb77ee 'b2' b
406 |/
406 |/
407 o 0: d681519c3ea7 '0'
407 o 0: d681519c3ea7 '0'
408
408
409
409
410 $ cd ..
410 $ cd ..
@@ -1,426 +1,426 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
4 > drawdag=$TESTDIR/drawdag.py
5 > [alias]
5 > [alias]
6 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
6 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
7 > EOF
7 > EOF
8
8
9 $ hg init repo
9 $ hg init repo
10 $ cd repo
10 $ cd repo
11
11
12 $ echo A > a
12 $ echo A > a
13 $ echo >> a
13 $ echo >> a
14 $ hg ci -Am A
14 $ hg ci -Am A
15 adding a
15 adding a
16
16
17 $ echo B > a
17 $ echo B > a
18 $ echo >> a
18 $ echo >> a
19 $ hg ci -m B
19 $ hg ci -m B
20
20
21 $ echo C > a
21 $ echo C > a
22 $ echo >> a
22 $ echo >> a
23 $ hg ci -m C
23 $ hg ci -m C
24
24
25 $ hg up -q -C 0
25 $ hg up -q -C 0
26
26
27 $ echo D >> a
27 $ echo D >> a
28 $ hg ci -Am AD
28 $ hg ci -Am AD
29 created new head
29 created new head
30
30
31 $ hg tglog
31 $ hg tglog
32 @ 3: 3878212183bd 'AD'
32 @ 3: 3878212183bd 'AD'
33 |
33 |
34 | o 2: 30ae917c0e4f 'C'
34 | o 2: 30ae917c0e4f 'C'
35 | |
35 | |
36 | o 1: 0f4f7cb4f549 'B'
36 | o 1: 0f4f7cb4f549 'B'
37 |/
37 |/
38 o 0: 1e635d440a73 'A'
38 o 0: 1e635d440a73 'A'
39
39
40 $ hg rebase -s 1 -d 3
40 $ hg rebase -s 1 -d 3
41 rebasing 1:0f4f7cb4f549 "B"
41 rebasing 1:0f4f7cb4f549 "B"
42 merging a
42 merging a
43 rebasing 2:30ae917c0e4f "C"
43 rebasing 2:30ae917c0e4f "C"
44 merging a
44 merging a
45 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0f4f7cb4f549-82b3b163-rebase.hg
45 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0f4f7cb4f549-82b3b163-rebase.hg
46
46
47 $ hg tglog
47 $ hg tglog
48 o 3: 25773bc4b4b0 'C'
48 o 3: 25773bc4b4b0 'C'
49 |
49 |
50 o 2: c09015405f75 'B'
50 o 2: c09015405f75 'B'
51 |
51 |
52 @ 1: 3878212183bd 'AD'
52 @ 1: 3878212183bd 'AD'
53 |
53 |
54 o 0: 1e635d440a73 'A'
54 o 0: 1e635d440a73 'A'
55
55
56
56
57 $ cd ..
57 $ cd ..
58
58
59
59
60 Test rebasing of merges with ancestors of the rebase destination - a situation
60 Test rebasing of merges with ancestors of the rebase destination - a situation
61 that often happens when trying to recover from repeated merging with a mainline
61 that often happens when trying to recover from repeated merging with a mainline
62 branch.
62 branch.
63
63
64 The test case creates a dev branch that contains a couple of merges from the
64 The test case creates a dev branch that contains a couple of merges from the
65 default branch. When rebasing to the default branch, these merges would be
65 default branch. When rebasing to the default branch, these merges would be
66 merges with ancestors on the same branch. The merges _could_ contain some
66 merges with ancestors on the same branch. The merges _could_ contain some
67 interesting conflict resolutions or additional changes in the merge commit, but
67 interesting conflict resolutions or additional changes in the merge commit, but
68 that is mixed up with the actual merge stuff and there is in general no way to
68 that is mixed up with the actual merge stuff and there is in general no way to
69 separate them.
69 separate them.
70
70
71 Note: The dev branch contains _no_ changes to f-default. It might be unclear
71 Note: The dev branch contains _no_ changes to f-default. It might be unclear
72 how rebasing of ancestor merges should be handled, but the current behavior
72 how rebasing of ancestor merges should be handled, but the current behavior
73 with spurious prompts for conflicts in files that didn't change seems very
73 with spurious prompts for conflicts in files that didn't change seems very
74 wrong.
74 wrong.
75
75
76 $ hg init ancestor-merge
76 $ hg init ancestor-merge
77 $ cd ancestor-merge
77 $ cd ancestor-merge
78
78
79 $ touch f-default
79 $ touch f-default
80 $ hg ci -Aqm 'default: create f-default'
80 $ hg ci -Aqm 'default: create f-default'
81
81
82 $ hg branch -q dev
82 $ hg branch -q dev
83 $ hg ci -qm 'dev: create branch'
83 $ hg ci -qm 'dev: create branch'
84
84
85 $ echo stuff > f-dev
85 $ echo stuff > f-dev
86 $ hg ci -Aqm 'dev: f-dev stuff'
86 $ hg ci -Aqm 'dev: f-dev stuff'
87
87
88 $ hg up -q default
88 $ hg up -q default
89 $ echo stuff > f-default
89 $ echo stuff > f-default
90 $ hg ci -m 'default: f-default stuff'
90 $ hg ci -m 'default: f-default stuff'
91
91
92 $ hg up -q dev
92 $ hg up -q dev
93 $ hg merge -q default
93 $ hg merge -q default
94 $ hg ci -m 'dev: merge default'
94 $ hg ci -m 'dev: merge default'
95
95
96 $ hg up -q default
96 $ hg up -q default
97 $ hg rm f-default
97 $ hg rm f-default
98 $ hg ci -m 'default: remove f-default'
98 $ hg ci -m 'default: remove f-default'
99
99
100 $ hg up -q dev
100 $ hg up -q dev
101 $ hg merge -q default
101 $ hg merge -q default
102 $ hg ci -m 'dev: merge default'
102 $ hg ci -m 'dev: merge default'
103
103
104 $ hg up -q default
104 $ hg up -q default
105 $ echo stuff > f-other
105 $ echo stuff > f-other
106 $ hg ci -Aqm 'default: f-other stuff'
106 $ hg ci -Aqm 'default: f-other stuff'
107
107
108 $ hg tglog
108 $ hg tglog
109 @ 7: e08089805d82 'default: f-other stuff'
109 @ 7: e08089805d82 'default: f-other stuff'
110 |
110 |
111 | o 6: 9455ee510502 'dev: merge default' dev
111 | o 6: 9455ee510502 'dev: merge default' dev
112 |/|
112 |/|
113 o | 5: 462860db70a1 'default: remove f-default'
113 o | 5: 462860db70a1 'default: remove f-default'
114 | |
114 | |
115 | o 4: 4b019212aaf6 'dev: merge default' dev
115 | o 4: 4b019212aaf6 'dev: merge default' dev
116 |/|
116 |/|
117 o | 3: f157ecfd2b6b 'default: f-default stuff'
117 o | 3: f157ecfd2b6b 'default: f-default stuff'
118 | |
118 | |
119 | o 2: ec2c14fb2984 'dev: f-dev stuff' dev
119 | o 2: ec2c14fb2984 'dev: f-dev stuff' dev
120 | |
120 | |
121 | o 1: 1d1a643d390e 'dev: create branch' dev
121 | o 1: 1d1a643d390e 'dev: create branch' dev
122 |/
122 |/
123 o 0: e90e8eb90b6f 'default: create f-default'
123 o 0: e90e8eb90b6f 'default: create f-default'
124
124
125 $ hg clone -qU . ../ancestor-merge-2
125 $ hg clone -qU . ../ancestor-merge-2
126
126
127 Full rebase all the way back from branching point:
127 Full rebase all the way back from branching point:
128
128
129 $ hg rebase -r 'only(dev,default)' -d default --config ui.interactive=True << EOF
129 $ hg rebase -r 'only(dev,default)' -d default --config ui.interactive=True << EOF
130 > c
130 > c
131 > EOF
131 > EOF
132 rebasing 1:1d1a643d390e "dev: create branch"
132 rebasing 1:1d1a643d390e "dev: create branch"
133 note: rebase of 1:1d1a643d390e "dev: create branch" created no changes to commit
133 note: not rebasing 1:1d1a643d390e "dev: create branch", its destination already has all its changes
134 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
134 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
135 rebasing 4:4b019212aaf6 "dev: merge default"
135 rebasing 4:4b019212aaf6 "dev: merge default"
136 file 'f-default' was deleted in local [dest] but was modified in other [source].
136 file 'f-default' was deleted in local [dest] but was modified in other [source].
137 What do you want to do?
137 What do you want to do?
138 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
138 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
139 rebasing 6:9455ee510502 "dev: merge default"
139 rebasing 6:9455ee510502 "dev: merge default"
140 saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-43e9e04b-rebase.hg
140 saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-43e9e04b-rebase.hg
141 $ hg tglog
141 $ hg tglog
142 o 6: fbc098e72227 'dev: merge default'
142 o 6: fbc098e72227 'dev: merge default'
143 |
143 |
144 o 5: eda7b7f46f5d 'dev: merge default'
144 o 5: eda7b7f46f5d 'dev: merge default'
145 |
145 |
146 o 4: 3e075b1c0a40 'dev: f-dev stuff'
146 o 4: 3e075b1c0a40 'dev: f-dev stuff'
147 |
147 |
148 @ 3: e08089805d82 'default: f-other stuff'
148 @ 3: e08089805d82 'default: f-other stuff'
149 |
149 |
150 o 2: 462860db70a1 'default: remove f-default'
150 o 2: 462860db70a1 'default: remove f-default'
151 |
151 |
152 o 1: f157ecfd2b6b 'default: f-default stuff'
152 o 1: f157ecfd2b6b 'default: f-default stuff'
153 |
153 |
154 o 0: e90e8eb90b6f 'default: create f-default'
154 o 0: e90e8eb90b6f 'default: create f-default'
155
155
156 Grafty cherry picking rebasing:
156 Grafty cherry picking rebasing:
157
157
158 $ cd ../ancestor-merge-2
158 $ cd ../ancestor-merge-2
159
159
160 $ hg phase -fdr0:
160 $ hg phase -fdr0:
161 $ hg rebase -r 'children(only(dev,default))' -d default --config ui.interactive=True << EOF
161 $ hg rebase -r 'children(only(dev,default))' -d default --config ui.interactive=True << EOF
162 > c
162 > c
163 > EOF
163 > EOF
164 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
164 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
165 rebasing 4:4b019212aaf6 "dev: merge default"
165 rebasing 4:4b019212aaf6 "dev: merge default"
166 file 'f-default' was deleted in local [dest] but was modified in other [source].
166 file 'f-default' was deleted in local [dest] but was modified in other [source].
167 What do you want to do?
167 What do you want to do?
168 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
168 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
169 rebasing 6:9455ee510502 "dev: merge default"
169 rebasing 6:9455ee510502 "dev: merge default"
170 saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-62d0b222-rebase.hg
170 saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-62d0b222-rebase.hg
171 $ hg tglog
171 $ hg tglog
172 o 7: fbc098e72227 'dev: merge default'
172 o 7: fbc098e72227 'dev: merge default'
173 |
173 |
174 o 6: eda7b7f46f5d 'dev: merge default'
174 o 6: eda7b7f46f5d 'dev: merge default'
175 |
175 |
176 o 5: 3e075b1c0a40 'dev: f-dev stuff'
176 o 5: 3e075b1c0a40 'dev: f-dev stuff'
177 |
177 |
178 o 4: e08089805d82 'default: f-other stuff'
178 o 4: e08089805d82 'default: f-other stuff'
179 |
179 |
180 o 3: 462860db70a1 'default: remove f-default'
180 o 3: 462860db70a1 'default: remove f-default'
181 |
181 |
182 o 2: f157ecfd2b6b 'default: f-default stuff'
182 o 2: f157ecfd2b6b 'default: f-default stuff'
183 |
183 |
184 | o 1: 1d1a643d390e 'dev: create branch' dev
184 | o 1: 1d1a643d390e 'dev: create branch' dev
185 |/
185 |/
186 o 0: e90e8eb90b6f 'default: create f-default'
186 o 0: e90e8eb90b6f 'default: create f-default'
187
187
188 $ cd ..
188 $ cd ..
189
189
190
190
191 Test order of parents of rebased merged with un-rebased changes as p1.
191 Test order of parents of rebased merged with un-rebased changes as p1.
192
192
193 $ hg init parentorder
193 $ hg init parentorder
194 $ cd parentorder
194 $ cd parentorder
195 $ touch f
195 $ touch f
196 $ hg ci -Aqm common
196 $ hg ci -Aqm common
197 $ touch change
197 $ touch change
198 $ hg ci -Aqm change
198 $ hg ci -Aqm change
199 $ touch target
199 $ touch target
200 $ hg ci -Aqm target
200 $ hg ci -Aqm target
201 $ hg up -qr 0
201 $ hg up -qr 0
202 $ touch outside
202 $ touch outside
203 $ hg ci -Aqm outside
203 $ hg ci -Aqm outside
204 $ hg merge -qr 1
204 $ hg merge -qr 1
205 $ hg ci -m 'merge p1 3=outside p2 1=ancestor'
205 $ hg ci -m 'merge p1 3=outside p2 1=ancestor'
206 $ hg par
206 $ hg par
207 changeset: 4:6990226659be
207 changeset: 4:6990226659be
208 tag: tip
208 tag: tip
209 parent: 3:f59da8fc0fcf
209 parent: 3:f59da8fc0fcf
210 parent: 1:dd40c13f7a6f
210 parent: 1:dd40c13f7a6f
211 user: test
211 user: test
212 date: Thu Jan 01 00:00:00 1970 +0000
212 date: Thu Jan 01 00:00:00 1970 +0000
213 summary: merge p1 3=outside p2 1=ancestor
213 summary: merge p1 3=outside p2 1=ancestor
214
214
215 $ hg up -qr 1
215 $ hg up -qr 1
216 $ hg merge -qr 3
216 $ hg merge -qr 3
217 $ hg ci -qm 'merge p1 1=ancestor p2 3=outside'
217 $ hg ci -qm 'merge p1 1=ancestor p2 3=outside'
218 $ hg par
218 $ hg par
219 changeset: 5:a57575f79074
219 changeset: 5:a57575f79074
220 tag: tip
220 tag: tip
221 parent: 1:dd40c13f7a6f
221 parent: 1:dd40c13f7a6f
222 parent: 3:f59da8fc0fcf
222 parent: 3:f59da8fc0fcf
223 user: test
223 user: test
224 date: Thu Jan 01 00:00:00 1970 +0000
224 date: Thu Jan 01 00:00:00 1970 +0000
225 summary: merge p1 1=ancestor p2 3=outside
225 summary: merge p1 1=ancestor p2 3=outside
226
226
227 $ hg tglog
227 $ hg tglog
228 @ 5: a57575f79074 'merge p1 1=ancestor p2 3=outside'
228 @ 5: a57575f79074 'merge p1 1=ancestor p2 3=outside'
229 |\
229 |\
230 +---o 4: 6990226659be 'merge p1 3=outside p2 1=ancestor'
230 +---o 4: 6990226659be 'merge p1 3=outside p2 1=ancestor'
231 | |/
231 | |/
232 | o 3: f59da8fc0fcf 'outside'
232 | o 3: f59da8fc0fcf 'outside'
233 | |
233 | |
234 +---o 2: a60552eb93fb 'target'
234 +---o 2: a60552eb93fb 'target'
235 | |
235 | |
236 o | 1: dd40c13f7a6f 'change'
236 o | 1: dd40c13f7a6f 'change'
237 |/
237 |/
238 o 0: 02f0f58d5300 'common'
238 o 0: 02f0f58d5300 'common'
239
239
240 $ hg rebase -r 4 -d 2
240 $ hg rebase -r 4 -d 2
241 rebasing 4:6990226659be "merge p1 3=outside p2 1=ancestor"
241 rebasing 4:6990226659be "merge p1 3=outside p2 1=ancestor"
242 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-4d67a0d3-rebase.hg
242 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-4d67a0d3-rebase.hg
243 $ hg tip
243 $ hg tip
244 changeset: 5:cca50676b1c5
244 changeset: 5:cca50676b1c5
245 tag: tip
245 tag: tip
246 parent: 2:a60552eb93fb
246 parent: 2:a60552eb93fb
247 parent: 3:f59da8fc0fcf
247 parent: 3:f59da8fc0fcf
248 user: test
248 user: test
249 date: Thu Jan 01 00:00:00 1970 +0000
249 date: Thu Jan 01 00:00:00 1970 +0000
250 summary: merge p1 3=outside p2 1=ancestor
250 summary: merge p1 3=outside p2 1=ancestor
251
251
252 $ hg rebase -r 4 -d 2
252 $ hg rebase -r 4 -d 2
253 rebasing 4:a57575f79074 "merge p1 1=ancestor p2 3=outside"
253 rebasing 4:a57575f79074 "merge p1 1=ancestor p2 3=outside"
254 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-385426e5-rebase.hg
254 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-385426e5-rebase.hg
255 $ hg tip
255 $ hg tip
256 changeset: 5:f9daf77ffe76
256 changeset: 5:f9daf77ffe76
257 tag: tip
257 tag: tip
258 parent: 2:a60552eb93fb
258 parent: 2:a60552eb93fb
259 parent: 3:f59da8fc0fcf
259 parent: 3:f59da8fc0fcf
260 user: test
260 user: test
261 date: Thu Jan 01 00:00:00 1970 +0000
261 date: Thu Jan 01 00:00:00 1970 +0000
262 summary: merge p1 1=ancestor p2 3=outside
262 summary: merge p1 1=ancestor p2 3=outside
263
263
264 $ hg tglog
264 $ hg tglog
265 @ 5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
265 @ 5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
266 |\
266 |\
267 +---o 4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
267 +---o 4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
268 | |/
268 | |/
269 | o 3: f59da8fc0fcf 'outside'
269 | o 3: f59da8fc0fcf 'outside'
270 | |
270 | |
271 o | 2: a60552eb93fb 'target'
271 o | 2: a60552eb93fb 'target'
272 | |
272 | |
273 o | 1: dd40c13f7a6f 'change'
273 o | 1: dd40c13f7a6f 'change'
274 |/
274 |/
275 o 0: 02f0f58d5300 'common'
275 o 0: 02f0f58d5300 'common'
276
276
277 rebase of merge of ancestors
277 rebase of merge of ancestors
278
278
279 $ hg up -qr 2
279 $ hg up -qr 2
280 $ hg merge -qr 3
280 $ hg merge -qr 3
281 $ echo 'other change while merging future "rebase ancestors"' > other
281 $ echo 'other change while merging future "rebase ancestors"' > other
282 $ hg ci -Aqm 'merge rebase ancestors'
282 $ hg ci -Aqm 'merge rebase ancestors'
283 $ hg rebase -d 5 -v
283 $ hg rebase -d 5 -v
284 rebasing 6:4c5f12f25ebe "merge rebase ancestors" (tip)
284 rebasing 6:4c5f12f25ebe "merge rebase ancestors" (tip)
285 resolving manifests
285 resolving manifests
286 removing other
286 removing other
287 note: merging f9daf77ffe76+ and 4c5f12f25ebe using bids from ancestors a60552eb93fb and f59da8fc0fcf
287 note: merging f9daf77ffe76+ and 4c5f12f25ebe using bids from ancestors a60552eb93fb and f59da8fc0fcf
288
288
289 calculating bids for ancestor a60552eb93fb
289 calculating bids for ancestor a60552eb93fb
290 resolving manifests
290 resolving manifests
291
291
292 calculating bids for ancestor f59da8fc0fcf
292 calculating bids for ancestor f59da8fc0fcf
293 resolving manifests
293 resolving manifests
294
294
295 auction for merging merge bids
295 auction for merging merge bids
296 other: consensus for g
296 other: consensus for g
297 end of auction
297 end of auction
298
298
299 getting other
299 getting other
300 committing files:
300 committing files:
301 other
301 other
302 committing manifest
302 committing manifest
303 committing changelog
303 committing changelog
304 rebase merging completed
304 rebase merging completed
305 1 changesets found
305 1 changesets found
306 uncompressed size of bundle content:
306 uncompressed size of bundle content:
307 199 (changelog)
307 199 (changelog)
308 216 (manifests)
308 216 (manifests)
309 182 other
309 182 other
310 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-f46990e5-rebase.hg
310 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-f46990e5-rebase.hg
311 1 changesets found
311 1 changesets found
312 uncompressed size of bundle content:
312 uncompressed size of bundle content:
313 254 (changelog)
313 254 (changelog)
314 167 (manifests)
314 167 (manifests)
315 182 other
315 182 other
316 adding branch
316 adding branch
317 adding changesets
317 adding changesets
318 adding manifests
318 adding manifests
319 adding file changes
319 adding file changes
320 added 1 changesets with 1 changes to 1 files
320 added 1 changesets with 1 changes to 1 files
321 rebase completed
321 rebase completed
322 $ hg tglog
322 $ hg tglog
323 @ 6: 113755df812b 'merge rebase ancestors'
323 @ 6: 113755df812b 'merge rebase ancestors'
324 |
324 |
325 o 5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
325 o 5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
326 |\
326 |\
327 +---o 4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
327 +---o 4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
328 | |/
328 | |/
329 | o 3: f59da8fc0fcf 'outside'
329 | o 3: f59da8fc0fcf 'outside'
330 | |
330 | |
331 o | 2: a60552eb93fb 'target'
331 o | 2: a60552eb93fb 'target'
332 | |
332 | |
333 o | 1: dd40c13f7a6f 'change'
333 o | 1: dd40c13f7a6f 'change'
334 |/
334 |/
335 o 0: 02f0f58d5300 'common'
335 o 0: 02f0f58d5300 'common'
336
336
337 Due to the limitation of 3-way merge algorithm (1 merge base), rebasing a merge
337 Due to the limitation of 3-way merge algorithm (1 merge base), rebasing a merge
338 may include unwanted content:
338 may include unwanted content:
339
339
340 $ hg init $TESTTMP/dual-merge-base1
340 $ hg init $TESTTMP/dual-merge-base1
341 $ cd $TESTTMP/dual-merge-base1
341 $ cd $TESTTMP/dual-merge-base1
342 $ hg debugdrawdag <<'EOS'
342 $ hg debugdrawdag <<'EOS'
343 > F
343 > F
344 > /|
344 > /|
345 > D E
345 > D E
346 > | |
346 > | |
347 > B C
347 > B C
348 > |/
348 > |/
349 > A Z
349 > A Z
350 > |/
350 > |/
351 > R
351 > R
352 > EOS
352 > EOS
353 $ hg rebase -r D+E+F -d Z
353 $ hg rebase -r D+E+F -d Z
354 rebasing 5:5f2c926dfecf "D" (D)
354 rebasing 5:5f2c926dfecf "D" (D)
355 rebasing 6:b296604d9846 "E" (E)
355 rebasing 6:b296604d9846 "E" (E)
356 rebasing 7:caa9781e507d "F" (F tip)
356 rebasing 7:caa9781e507d "F" (F tip)
357 abort: rebasing 7:caa9781e507d will include unwanted changes from 4:d6003a550c2c or 3:c1e6b162678d
357 abort: rebasing 7:caa9781e507d will include unwanted changes from 4:d6003a550c2c or 3:c1e6b162678d
358 [255]
358 [255]
359
359
360 The warning does not get printed if there is no unwanted change detected:
360 The warning does not get printed if there is no unwanted change detected:
361
361
362 $ hg init $TESTTMP/dual-merge-base2
362 $ hg init $TESTTMP/dual-merge-base2
363 $ cd $TESTTMP/dual-merge-base2
363 $ cd $TESTTMP/dual-merge-base2
364 $ hg debugdrawdag <<'EOS'
364 $ hg debugdrawdag <<'EOS'
365 > D
365 > D
366 > /|
366 > /|
367 > B C
367 > B C
368 > |/
368 > |/
369 > A Z
369 > A Z
370 > |/
370 > |/
371 > R
371 > R
372 > EOS
372 > EOS
373 $ hg rebase -r B+C+D -d Z
373 $ hg rebase -r B+C+D -d Z
374 rebasing 3:c1e6b162678d "B" (B)
374 rebasing 3:c1e6b162678d "B" (B)
375 rebasing 4:d6003a550c2c "C" (C)
375 rebasing 4:d6003a550c2c "C" (C)
376 rebasing 5:c8f78076273e "D" (D tip)
376 rebasing 5:c8f78076273e "D" (D tip)
377 saved backup bundle to $TESTTMP/dual-merge-base2/.hg/strip-backup/d6003a550c2c-6f1424b6-rebase.hg
377 saved backup bundle to $TESTTMP/dual-merge-base2/.hg/strip-backup/d6003a550c2c-6f1424b6-rebase.hg
378 $ hg manifest -r 'desc(D)'
378 $ hg manifest -r 'desc(D)'
379 B
379 B
380 C
380 C
381 R
381 R
382 Z
382 Z
383
383
384 The merge base could be different from old p1 (changed parent becomes new p1):
384 The merge base could be different from old p1 (changed parent becomes new p1):
385
385
386 $ hg init $TESTTMP/chosen-merge-base1
386 $ hg init $TESTTMP/chosen-merge-base1
387 $ cd $TESTTMP/chosen-merge-base1
387 $ cd $TESTTMP/chosen-merge-base1
388 $ hg debugdrawdag <<'EOS'
388 $ hg debugdrawdag <<'EOS'
389 > F
389 > F
390 > /|
390 > /|
391 > D E
391 > D E
392 > | |
392 > | |
393 > B C Z
393 > B C Z
394 > EOS
394 > EOS
395 $ hg rebase -r D+F -d Z
395 $ hg rebase -r D+F -d Z
396 rebasing 3:004dc1679908 "D" (D)
396 rebasing 3:004dc1679908 "D" (D)
397 rebasing 5:4be4cbf6f206 "F" (F tip)
397 rebasing 5:4be4cbf6f206 "F" (F tip)
398 saved backup bundle to $TESTTMP/chosen-merge-base1/.hg/strip-backup/004dc1679908-06a66a3c-rebase.hg
398 saved backup bundle to $TESTTMP/chosen-merge-base1/.hg/strip-backup/004dc1679908-06a66a3c-rebase.hg
399 $ hg manifest -r 'desc(F)'
399 $ hg manifest -r 'desc(F)'
400 C
400 C
401 D
401 D
402 E
402 E
403 Z
403 Z
404 $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n'
404 $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n'
405 D
405 D
406
406
407 $ hg init $TESTTMP/chosen-merge-base2
407 $ hg init $TESTTMP/chosen-merge-base2
408 $ cd $TESTTMP/chosen-merge-base2
408 $ cd $TESTTMP/chosen-merge-base2
409 $ hg debugdrawdag <<'EOS'
409 $ hg debugdrawdag <<'EOS'
410 > F
410 > F
411 > /|
411 > /|
412 > D E
412 > D E
413 > | |
413 > | |
414 > B C Z
414 > B C Z
415 > EOS
415 > EOS
416 $ hg rebase -r E+F -d Z
416 $ hg rebase -r E+F -d Z
417 rebasing 4:974e4943c210 "E" (E)
417 rebasing 4:974e4943c210 "E" (E)
418 rebasing 5:4be4cbf6f206 "F" (F tip)
418 rebasing 5:4be4cbf6f206 "F" (F tip)
419 saved backup bundle to $TESTTMP/chosen-merge-base2/.hg/strip-backup/974e4943c210-b2874da5-rebase.hg
419 saved backup bundle to $TESTTMP/chosen-merge-base2/.hg/strip-backup/974e4943c210-b2874da5-rebase.hg
420 $ hg manifest -r 'desc(F)'
420 $ hg manifest -r 'desc(F)'
421 B
421 B
422 D
422 D
423 E
423 E
424 Z
424 Z
425 $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n'
425 $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n'
426 E
426 E
@@ -1,2137 +1,2137 b''
1 ==========================
1 ==========================
2 Test rebase with obsolete
2 Test rebase with obsolete
3 ==========================
3 ==========================
4
4
5 Enable obsolete
5 Enable obsolete
6
6
7 $ cat >> $HGRCPATH << EOF
7 $ cat >> $HGRCPATH << EOF
8 > [ui]
8 > [ui]
9 > logtemplate= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
9 > logtemplate= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
10 > [experimental]
10 > [experimental]
11 > evolution.createmarkers=True
11 > evolution.createmarkers=True
12 > evolution.allowunstable=True
12 > evolution.allowunstable=True
13 > [phases]
13 > [phases]
14 > publish=False
14 > publish=False
15 > [extensions]
15 > [extensions]
16 > rebase=
16 > rebase=
17 > drawdag=$TESTDIR/drawdag.py
17 > drawdag=$TESTDIR/drawdag.py
18 > strip=
18 > strip=
19 > EOF
19 > EOF
20
20
21 Setup rebase canonical repo
21 Setup rebase canonical repo
22
22
23 $ hg init base
23 $ hg init base
24 $ cd base
24 $ cd base
25 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
25 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
26 adding changesets
26 adding changesets
27 adding manifests
27 adding manifests
28 adding file changes
28 adding file changes
29 added 8 changesets with 7 changes to 7 files (+2 heads)
29 added 8 changesets with 7 changes to 7 files (+2 heads)
30 new changesets cd010b8cd998:02de42196ebe (8 drafts)
30 new changesets cd010b8cd998:02de42196ebe (8 drafts)
31 (run 'hg heads' to see heads, 'hg merge' to merge)
31 (run 'hg heads' to see heads, 'hg merge' to merge)
32 $ hg up tip
32 $ hg up tip
33 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg log -G
34 $ hg log -G
35 @ 7:02de42196ebe H
35 @ 7:02de42196ebe H
36 |
36 |
37 | o 6:eea13746799a G
37 | o 6:eea13746799a G
38 |/|
38 |/|
39 o | 5:24b6387c8c8c F
39 o | 5:24b6387c8c8c F
40 | |
40 | |
41 | o 4:9520eea781bc E
41 | o 4:9520eea781bc E
42 |/
42 |/
43 | o 3:32af7686d403 D
43 | o 3:32af7686d403 D
44 | |
44 | |
45 | o 2:5fddd98957c8 C
45 | o 2:5fddd98957c8 C
46 | |
46 | |
47 | o 1:42ccdea3bb16 B
47 | o 1:42ccdea3bb16 B
48 |/
48 |/
49 o 0:cd010b8cd998 A
49 o 0:cd010b8cd998 A
50
50
51 $ cd ..
51 $ cd ..
52
52
53 simple rebase
53 simple rebase
54 ---------------------------------
54 ---------------------------------
55
55
56 $ hg clone base simple
56 $ hg clone base simple
57 updating to branch default
57 updating to branch default
58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 $ cd simple
59 $ cd simple
60 $ hg up 32af7686d403
60 $ hg up 32af7686d403
61 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
61 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
62 $ hg rebase -d eea13746799a
62 $ hg rebase -d eea13746799a
63 rebasing 1:42ccdea3bb16 "B"
63 rebasing 1:42ccdea3bb16 "B"
64 rebasing 2:5fddd98957c8 "C"
64 rebasing 2:5fddd98957c8 "C"
65 rebasing 3:32af7686d403 "D"
65 rebasing 3:32af7686d403 "D"
66 $ hg log -G
66 $ hg log -G
67 @ 10:8eeb3c33ad33 D
67 @ 10:8eeb3c33ad33 D
68 |
68 |
69 o 9:2327fea05063 C
69 o 9:2327fea05063 C
70 |
70 |
71 o 8:e4e5be0395b2 B
71 o 8:e4e5be0395b2 B
72 |
72 |
73 | o 7:02de42196ebe H
73 | o 7:02de42196ebe H
74 | |
74 | |
75 o | 6:eea13746799a G
75 o | 6:eea13746799a G
76 |\|
76 |\|
77 | o 5:24b6387c8c8c F
77 | o 5:24b6387c8c8c F
78 | |
78 | |
79 o | 4:9520eea781bc E
79 o | 4:9520eea781bc E
80 |/
80 |/
81 o 0:cd010b8cd998 A
81 o 0:cd010b8cd998 A
82
82
83 $ hg log --hidden -G
83 $ hg log --hidden -G
84 @ 10:8eeb3c33ad33 D
84 @ 10:8eeb3c33ad33 D
85 |
85 |
86 o 9:2327fea05063 C
86 o 9:2327fea05063 C
87 |
87 |
88 o 8:e4e5be0395b2 B
88 o 8:e4e5be0395b2 B
89 |
89 |
90 | o 7:02de42196ebe H
90 | o 7:02de42196ebe H
91 | |
91 | |
92 o | 6:eea13746799a G
92 o | 6:eea13746799a G
93 |\|
93 |\|
94 | o 5:24b6387c8c8c F
94 | o 5:24b6387c8c8c F
95 | |
95 | |
96 o | 4:9520eea781bc E
96 o | 4:9520eea781bc E
97 |/
97 |/
98 | x 3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
98 | x 3:32af7686d403 D (rewritten using rebase as 10:8eeb3c33ad33)
99 | |
99 | |
100 | x 2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
100 | x 2:5fddd98957c8 C (rewritten using rebase as 9:2327fea05063)
101 | |
101 | |
102 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
102 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:e4e5be0395b2)
103 |/
103 |/
104 o 0:cd010b8cd998 A
104 o 0:cd010b8cd998 A
105
105
106 $ hg debugobsolete
106 $ hg debugobsolete
107 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
107 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
108 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
108 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
109 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
109 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
110
110
111
111
112 $ cd ..
112 $ cd ..
113
113
114 empty changeset
114 empty changeset
115 ---------------------------------
115 ---------------------------------
116
116
117 $ hg clone base empty
117 $ hg clone base empty
118 updating to branch default
118 updating to branch default
119 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd empty
120 $ cd empty
121 $ hg up eea13746799a
121 $ hg up eea13746799a
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
123
123
124 We make a copy of both the first changeset in the rebased and some other in the
124 We make a copy of both the first changeset in the rebased and some other in the
125 set.
125 set.
126
126
127 $ hg graft 42ccdea3bb16 32af7686d403
127 $ hg graft 42ccdea3bb16 32af7686d403
128 grafting 1:42ccdea3bb16 "B"
128 grafting 1:42ccdea3bb16 "B"
129 grafting 3:32af7686d403 "D"
129 grafting 3:32af7686d403 "D"
130 $ hg rebase -s 42ccdea3bb16 -d .
130 $ hg rebase -s 42ccdea3bb16 -d .
131 rebasing 1:42ccdea3bb16 "B"
131 rebasing 1:42ccdea3bb16 "B"
132 note: rebase of 1:42ccdea3bb16 "B" created no changes to commit
132 note: not rebasing 1:42ccdea3bb16 "B", its destination already has all its changes
133 rebasing 2:5fddd98957c8 "C"
133 rebasing 2:5fddd98957c8 "C"
134 rebasing 3:32af7686d403 "D"
134 rebasing 3:32af7686d403 "D"
135 note: rebase of 3:32af7686d403 "D" created no changes to commit
135 note: not rebasing 3:32af7686d403 "D", its destination already has all its changes
136 $ hg log -G
136 $ hg log -G
137 o 10:5ae4c968c6ac C
137 o 10:5ae4c968c6ac C
138 |
138 |
139 @ 9:08483444fef9 D
139 @ 9:08483444fef9 D
140 |
140 |
141 o 8:8877864f1edb B
141 o 8:8877864f1edb B
142 |
142 |
143 | o 7:02de42196ebe H
143 | o 7:02de42196ebe H
144 | |
144 | |
145 o | 6:eea13746799a G
145 o | 6:eea13746799a G
146 |\|
146 |\|
147 | o 5:24b6387c8c8c F
147 | o 5:24b6387c8c8c F
148 | |
148 | |
149 o | 4:9520eea781bc E
149 o | 4:9520eea781bc E
150 |/
150 |/
151 o 0:cd010b8cd998 A
151 o 0:cd010b8cd998 A
152
152
153 $ hg log --hidden -G
153 $ hg log --hidden -G
154 o 10:5ae4c968c6ac C
154 o 10:5ae4c968c6ac C
155 |
155 |
156 @ 9:08483444fef9 D
156 @ 9:08483444fef9 D
157 |
157 |
158 o 8:8877864f1edb B
158 o 8:8877864f1edb B
159 |
159 |
160 | o 7:02de42196ebe H
160 | o 7:02de42196ebe H
161 | |
161 | |
162 o | 6:eea13746799a G
162 o | 6:eea13746799a G
163 |\|
163 |\|
164 | o 5:24b6387c8c8c F
164 | o 5:24b6387c8c8c F
165 | |
165 | |
166 o | 4:9520eea781bc E
166 o | 4:9520eea781bc E
167 |/
167 |/
168 | x 3:32af7686d403 D (pruned using rebase)
168 | x 3:32af7686d403 D (pruned using rebase)
169 | |
169 | |
170 | x 2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
170 | x 2:5fddd98957c8 C (rewritten using rebase as 10:5ae4c968c6ac)
171 | |
171 | |
172 | x 1:42ccdea3bb16 B (pruned using rebase)
172 | x 1:42ccdea3bb16 B (pruned using rebase)
173 |/
173 |/
174 o 0:cd010b8cd998 A
174 o 0:cd010b8cd998 A
175
175
176 $ hg debugobsolete
176 $ hg debugobsolete
177 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
177 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
178 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
178 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
179 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
179 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
180
180
181
181
182 More complex case where part of the rebase set were already rebased
182 More complex case where part of the rebase set were already rebased
183
183
184 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
184 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
185 rebasing 9:08483444fef9 "D"
185 rebasing 9:08483444fef9 "D"
186 1 new orphan changesets
186 1 new orphan changesets
187 $ hg debugobsolete
187 $ hg debugobsolete
188 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
188 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
189 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
189 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
190 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
190 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
191 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
191 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
192 $ hg log -G
192 $ hg log -G
193 @ 11:4596109a6a43 D
193 @ 11:4596109a6a43 D
194 |
194 |
195 | * 10:5ae4c968c6ac C
195 | * 10:5ae4c968c6ac C
196 | |
196 | |
197 | x 9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
197 | x 9:08483444fef9 D (rewritten using rebase as 11:4596109a6a43)
198 | |
198 | |
199 | o 8:8877864f1edb B
199 | o 8:8877864f1edb B
200 | |
200 | |
201 o | 7:02de42196ebe H
201 o | 7:02de42196ebe H
202 | |
202 | |
203 | o 6:eea13746799a G
203 | o 6:eea13746799a G
204 |/|
204 |/|
205 o | 5:24b6387c8c8c F
205 o | 5:24b6387c8c8c F
206 | |
206 | |
207 | o 4:9520eea781bc E
207 | o 4:9520eea781bc E
208 |/
208 |/
209 o 0:cd010b8cd998 A
209 o 0:cd010b8cd998 A
210
210
211 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
211 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
212 rebasing 8:8877864f1edb "B"
212 rebasing 8:8877864f1edb "B"
213 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip)
213 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D" (tip)
214 rebasing 10:5ae4c968c6ac "C"
214 rebasing 10:5ae4c968c6ac "C"
215 $ hg debugobsolete
215 $ hg debugobsolete
216 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
216 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
217 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
217 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
218 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
218 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'rebase', 'user': 'test'}
219 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
219 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
220 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
220 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
221 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
221 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
222 $ hg log --rev 'contentdivergent()'
222 $ hg log --rev 'contentdivergent()'
223 $ hg log -G
223 $ hg log -G
224 o 13:98f6af4ee953 C
224 o 13:98f6af4ee953 C
225 |
225 |
226 o 12:462a34d07e59 B
226 o 12:462a34d07e59 B
227 |
227 |
228 @ 11:4596109a6a43 D
228 @ 11:4596109a6a43 D
229 |
229 |
230 o 7:02de42196ebe H
230 o 7:02de42196ebe H
231 |
231 |
232 | o 6:eea13746799a G
232 | o 6:eea13746799a G
233 |/|
233 |/|
234 o | 5:24b6387c8c8c F
234 o | 5:24b6387c8c8c F
235 | |
235 | |
236 | o 4:9520eea781bc E
236 | o 4:9520eea781bc E
237 |/
237 |/
238 o 0:cd010b8cd998 A
238 o 0:cd010b8cd998 A
239
239
240 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
240 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
241 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
241 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
242 phase: draft
242 phase: draft
243 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
243 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
244 parent: -1:0000000000000000000000000000000000000000
244 parent: -1:0000000000000000000000000000000000000000
245 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
245 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
246 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
246 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
247 date: Sat Apr 30 15:24:48 2011 +0200
247 date: Sat Apr 30 15:24:48 2011 +0200
248 files+: D
248 files+: D
249 extra: branch=default
249 extra: branch=default
250 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
250 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
251 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
251 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
252 description:
252 description:
253 D
253 D
254
254
255
255
256 $ hg up -qr 'desc(G)'
256 $ hg up -qr 'desc(G)'
257 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
257 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
258 grafting 11:4596109a6a43 "D"
258 grafting 11:4596109a6a43 "D"
259 $ hg up -qr 'desc(E)'
259 $ hg up -qr 'desc(E)'
260 $ hg rebase -s tip -d .
260 $ hg rebase -s tip -d .
261 rebasing 14:9e36056a46e3 "D" (tip)
261 rebasing 14:9e36056a46e3 "D" (tip)
262 $ hg log --style default --debug -r tip
262 $ hg log --style default --debug -r tip
263 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
263 changeset: 15:627d4614809036ba22b9e7cb31638ddc06ab99ab
264 tag: tip
264 tag: tip
265 phase: draft
265 phase: draft
266 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
266 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
267 parent: -1:0000000000000000000000000000000000000000
267 parent: -1:0000000000000000000000000000000000000000
268 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
268 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
269 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
269 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
270 date: Sat Apr 30 15:24:48 2011 +0200
270 date: Sat Apr 30 15:24:48 2011 +0200
271 files+: D
271 files+: D
272 extra: branch=default
272 extra: branch=default
273 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
273 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
274 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
274 extra: rebase_source=9e36056a46e37c9776168c7375734eebc70e294f
275 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
275 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
276 description:
276 description:
277 D
277 D
278
278
279
279
280 Start rebase from a commit that is obsolete but not hidden only because it's
280 Start rebase from a commit that is obsolete but not hidden only because it's
281 a working copy parent. We should be moved back to the starting commit as usual
281 a working copy parent. We should be moved back to the starting commit as usual
282 even though it is hidden (until we're moved there).
282 even though it is hidden (until we're moved there).
283
283
284 $ hg --hidden up -qr 'first(hidden())'
284 $ hg --hidden up -qr 'first(hidden())'
285 updated to hidden changeset 42ccdea3bb16
285 updated to hidden changeset 42ccdea3bb16
286 (hidden revision '42ccdea3bb16' is pruned)
286 (hidden revision '42ccdea3bb16' is pruned)
287 $ hg rebase --rev 13 --dest 15
287 $ hg rebase --rev 13 --dest 15
288 rebasing 13:98f6af4ee953 "C"
288 rebasing 13:98f6af4ee953 "C"
289 $ hg log -G
289 $ hg log -G
290 o 16:294a2b93eb4d C
290 o 16:294a2b93eb4d C
291 |
291 |
292 o 15:627d46148090 D
292 o 15:627d46148090 D
293 |
293 |
294 | o 12:462a34d07e59 B
294 | o 12:462a34d07e59 B
295 | |
295 | |
296 | o 11:4596109a6a43 D
296 | o 11:4596109a6a43 D
297 | |
297 | |
298 | o 7:02de42196ebe H
298 | o 7:02de42196ebe H
299 | |
299 | |
300 +---o 6:eea13746799a G
300 +---o 6:eea13746799a G
301 | |/
301 | |/
302 | o 5:24b6387c8c8c F
302 | o 5:24b6387c8c8c F
303 | |
303 | |
304 o | 4:9520eea781bc E
304 o | 4:9520eea781bc E
305 |/
305 |/
306 | @ 1:42ccdea3bb16 B (pruned using rebase)
306 | @ 1:42ccdea3bb16 B (pruned using rebase)
307 |/
307 |/
308 o 0:cd010b8cd998 A
308 o 0:cd010b8cd998 A
309
309
310
310
311 $ cd ..
311 $ cd ..
312
312
313 collapse rebase
313 collapse rebase
314 ---------------------------------
314 ---------------------------------
315
315
316 $ hg clone base collapse
316 $ hg clone base collapse
317 updating to branch default
317 updating to branch default
318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
318 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 $ cd collapse
319 $ cd collapse
320 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
320 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
321 rebasing 1:42ccdea3bb16 "B"
321 rebasing 1:42ccdea3bb16 "B"
322 rebasing 2:5fddd98957c8 "C"
322 rebasing 2:5fddd98957c8 "C"
323 rebasing 3:32af7686d403 "D"
323 rebasing 3:32af7686d403 "D"
324 $ hg log -G
324 $ hg log -G
325 o 8:4dc2197e807b Collapsed revision
325 o 8:4dc2197e807b Collapsed revision
326 |
326 |
327 | @ 7:02de42196ebe H
327 | @ 7:02de42196ebe H
328 | |
328 | |
329 o | 6:eea13746799a G
329 o | 6:eea13746799a G
330 |\|
330 |\|
331 | o 5:24b6387c8c8c F
331 | o 5:24b6387c8c8c F
332 | |
332 | |
333 o | 4:9520eea781bc E
333 o | 4:9520eea781bc E
334 |/
334 |/
335 o 0:cd010b8cd998 A
335 o 0:cd010b8cd998 A
336
336
337 $ hg log --hidden -G
337 $ hg log --hidden -G
338 o 8:4dc2197e807b Collapsed revision
338 o 8:4dc2197e807b Collapsed revision
339 |
339 |
340 | @ 7:02de42196ebe H
340 | @ 7:02de42196ebe H
341 | |
341 | |
342 o | 6:eea13746799a G
342 o | 6:eea13746799a G
343 |\|
343 |\|
344 | o 5:24b6387c8c8c F
344 | o 5:24b6387c8c8c F
345 | |
345 | |
346 o | 4:9520eea781bc E
346 o | 4:9520eea781bc E
347 |/
347 |/
348 | x 3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
348 | x 3:32af7686d403 D (rewritten using rebase as 8:4dc2197e807b)
349 | |
349 | |
350 | x 2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
350 | x 2:5fddd98957c8 C (rewritten using rebase as 8:4dc2197e807b)
351 | |
351 | |
352 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
352 | x 1:42ccdea3bb16 B (rewritten using rebase as 8:4dc2197e807b)
353 |/
353 |/
354 o 0:cd010b8cd998 A
354 o 0:cd010b8cd998 A
355
355
356 $ hg id --debug -r tip
356 $ hg id --debug -r tip
357 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
357 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
358 $ hg debugobsolete
358 $ hg debugobsolete
359 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '1', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
359 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '1', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
360 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '2', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
360 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '2', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
361 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '3', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
361 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'fold-id': '6fb65cdc', 'fold-idx': '3', 'fold-size': '3', 'operation': 'rebase', 'user': 'test'}
362
362
363 $ cd ..
363 $ cd ..
364
364
365 Rebase set has hidden descendants
365 Rebase set has hidden descendants
366 ---------------------------------
366 ---------------------------------
367
367
368 We rebase a changeset which has hidden descendants. Hidden changesets must not
368 We rebase a changeset which has hidden descendants. Hidden changesets must not
369 be rebased.
369 be rebased.
370
370
371 $ hg clone base hidden
371 $ hg clone base hidden
372 updating to branch default
372 updating to branch default
373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 $ cd hidden
374 $ cd hidden
375 $ hg log -G
375 $ hg log -G
376 @ 7:02de42196ebe H
376 @ 7:02de42196ebe H
377 |
377 |
378 | o 6:eea13746799a G
378 | o 6:eea13746799a G
379 |/|
379 |/|
380 o | 5:24b6387c8c8c F
380 o | 5:24b6387c8c8c F
381 | |
381 | |
382 | o 4:9520eea781bc E
382 | o 4:9520eea781bc E
383 |/
383 |/
384 | o 3:32af7686d403 D
384 | o 3:32af7686d403 D
385 | |
385 | |
386 | o 2:5fddd98957c8 C
386 | o 2:5fddd98957c8 C
387 | |
387 | |
388 | o 1:42ccdea3bb16 B
388 | o 1:42ccdea3bb16 B
389 |/
389 |/
390 o 0:cd010b8cd998 A
390 o 0:cd010b8cd998 A
391
391
392 $ hg rebase -s 5fddd98957c8 -d eea13746799a
392 $ hg rebase -s 5fddd98957c8 -d eea13746799a
393 rebasing 2:5fddd98957c8 "C"
393 rebasing 2:5fddd98957c8 "C"
394 rebasing 3:32af7686d403 "D"
394 rebasing 3:32af7686d403 "D"
395 $ hg log -G
395 $ hg log -G
396 o 9:cf44d2f5a9f4 D
396 o 9:cf44d2f5a9f4 D
397 |
397 |
398 o 8:e273c5e7d2d2 C
398 o 8:e273c5e7d2d2 C
399 |
399 |
400 | @ 7:02de42196ebe H
400 | @ 7:02de42196ebe H
401 | |
401 | |
402 o | 6:eea13746799a G
402 o | 6:eea13746799a G
403 |\|
403 |\|
404 | o 5:24b6387c8c8c F
404 | o 5:24b6387c8c8c F
405 | |
405 | |
406 o | 4:9520eea781bc E
406 o | 4:9520eea781bc E
407 |/
407 |/
408 | o 1:42ccdea3bb16 B
408 | o 1:42ccdea3bb16 B
409 |/
409 |/
410 o 0:cd010b8cd998 A
410 o 0:cd010b8cd998 A
411
411
412 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
412 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
413 rebasing 1:42ccdea3bb16 "B"
413 rebasing 1:42ccdea3bb16 "B"
414 $ hg log -G
414 $ hg log -G
415 o 10:7c6027df6a99 B
415 o 10:7c6027df6a99 B
416 |
416 |
417 | o 9:cf44d2f5a9f4 D
417 | o 9:cf44d2f5a9f4 D
418 | |
418 | |
419 | o 8:e273c5e7d2d2 C
419 | o 8:e273c5e7d2d2 C
420 | |
420 | |
421 @ | 7:02de42196ebe H
421 @ | 7:02de42196ebe H
422 | |
422 | |
423 | o 6:eea13746799a G
423 | o 6:eea13746799a G
424 |/|
424 |/|
425 o | 5:24b6387c8c8c F
425 o | 5:24b6387c8c8c F
426 | |
426 | |
427 | o 4:9520eea781bc E
427 | o 4:9520eea781bc E
428 |/
428 |/
429 o 0:cd010b8cd998 A
429 o 0:cd010b8cd998 A
430
430
431 $ hg log --hidden -G
431 $ hg log --hidden -G
432 o 10:7c6027df6a99 B
432 o 10:7c6027df6a99 B
433 |
433 |
434 | o 9:cf44d2f5a9f4 D
434 | o 9:cf44d2f5a9f4 D
435 | |
435 | |
436 | o 8:e273c5e7d2d2 C
436 | o 8:e273c5e7d2d2 C
437 | |
437 | |
438 @ | 7:02de42196ebe H
438 @ | 7:02de42196ebe H
439 | |
439 | |
440 | o 6:eea13746799a G
440 | o 6:eea13746799a G
441 |/|
441 |/|
442 o | 5:24b6387c8c8c F
442 o | 5:24b6387c8c8c F
443 | |
443 | |
444 | o 4:9520eea781bc E
444 | o 4:9520eea781bc E
445 |/
445 |/
446 | x 3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
446 | x 3:32af7686d403 D (rewritten using rebase as 9:cf44d2f5a9f4)
447 | |
447 | |
448 | x 2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
448 | x 2:5fddd98957c8 C (rewritten using rebase as 8:e273c5e7d2d2)
449 | |
449 | |
450 | x 1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
450 | x 1:42ccdea3bb16 B (rewritten using rebase as 10:7c6027df6a99)
451 |/
451 |/
452 o 0:cd010b8cd998 A
452 o 0:cd010b8cd998 A
453
453
454 $ hg debugobsolete
454 $ hg debugobsolete
455 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
455 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
456 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
456 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
457 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
457 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
458
458
459 Test that rewriting leaving instability behind is allowed
459 Test that rewriting leaving instability behind is allowed
460 ---------------------------------------------------------------------
460 ---------------------------------------------------------------------
461
461
462 $ hg log -r 'children(8)'
462 $ hg log -r 'children(8)'
463 9:cf44d2f5a9f4 D (no-eol)
463 9:cf44d2f5a9f4 D (no-eol)
464 $ hg rebase -r 8
464 $ hg rebase -r 8
465 rebasing 8:e273c5e7d2d2 "C"
465 rebasing 8:e273c5e7d2d2 "C"
466 1 new orphan changesets
466 1 new orphan changesets
467 $ hg log -G
467 $ hg log -G
468 o 11:0d8f238b634c C
468 o 11:0d8f238b634c C
469 |
469 |
470 o 10:7c6027df6a99 B
470 o 10:7c6027df6a99 B
471 |
471 |
472 | * 9:cf44d2f5a9f4 D
472 | * 9:cf44d2f5a9f4 D
473 | |
473 | |
474 | x 8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
474 | x 8:e273c5e7d2d2 C (rewritten using rebase as 11:0d8f238b634c)
475 | |
475 | |
476 @ | 7:02de42196ebe H
476 @ | 7:02de42196ebe H
477 | |
477 | |
478 | o 6:eea13746799a G
478 | o 6:eea13746799a G
479 |/|
479 |/|
480 o | 5:24b6387c8c8c F
480 o | 5:24b6387c8c8c F
481 | |
481 | |
482 | o 4:9520eea781bc E
482 | o 4:9520eea781bc E
483 |/
483 |/
484 o 0:cd010b8cd998 A
484 o 0:cd010b8cd998 A
485
485
486 $ cd ..
486 $ cd ..
487 $ cp -R hidden stabilize
487 $ cp -R hidden stabilize
488 $ cd stabilize
488 $ cd stabilize
489 $ hg rebase --auto-orphans '0::' -d 10
489 $ hg rebase --auto-orphans '0::' -d 10
490 abort: --auto-orphans is incompatible with --dest
490 abort: --auto-orphans is incompatible with --dest
491 [255]
491 [255]
492 $ hg rebase --auto-orphans '0::'
492 $ hg rebase --auto-orphans '0::'
493 rebasing 9:cf44d2f5a9f4 "D"
493 rebasing 9:cf44d2f5a9f4 "D"
494 $ hg log -G
494 $ hg log -G
495 o 12:7e3935feaa68 D
495 o 12:7e3935feaa68 D
496 |
496 |
497 o 11:0d8f238b634c C
497 o 11:0d8f238b634c C
498 |
498 |
499 o 10:7c6027df6a99 B
499 o 10:7c6027df6a99 B
500 |
500 |
501 @ 7:02de42196ebe H
501 @ 7:02de42196ebe H
502 |
502 |
503 | o 6:eea13746799a G
503 | o 6:eea13746799a G
504 |/|
504 |/|
505 o | 5:24b6387c8c8c F
505 o | 5:24b6387c8c8c F
506 | |
506 | |
507 | o 4:9520eea781bc E
507 | o 4:9520eea781bc E
508 |/
508 |/
509 o 0:cd010b8cd998 A
509 o 0:cd010b8cd998 A
510
510
511
511
512 $ cd ../hidden
512 $ cd ../hidden
513 $ rm -r ../stabilize
513 $ rm -r ../stabilize
514
514
515 Test multiple root handling
515 Test multiple root handling
516 ------------------------------------
516 ------------------------------------
517
517
518 $ hg rebase --dest 4 --rev '7+11+9'
518 $ hg rebase --dest 4 --rev '7+11+9'
519 rebasing 9:cf44d2f5a9f4 "D"
519 rebasing 9:cf44d2f5a9f4 "D"
520 rebasing 7:02de42196ebe "H"
520 rebasing 7:02de42196ebe "H"
521 rebasing 11:0d8f238b634c "C" (tip)
521 rebasing 11:0d8f238b634c "C" (tip)
522 $ hg log -G
522 $ hg log -G
523 o 14:1e8370e38cca C
523 o 14:1e8370e38cca C
524 |
524 |
525 @ 13:bfe264faf697 H
525 @ 13:bfe264faf697 H
526 |
526 |
527 | o 12:102b4c1d889b D
527 | o 12:102b4c1d889b D
528 |/
528 |/
529 | * 10:7c6027df6a99 B
529 | * 10:7c6027df6a99 B
530 | |
530 | |
531 | x 7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
531 | x 7:02de42196ebe H (rewritten using rebase as 13:bfe264faf697)
532 | |
532 | |
533 +---o 6:eea13746799a G
533 +---o 6:eea13746799a G
534 | |/
534 | |/
535 | o 5:24b6387c8c8c F
535 | o 5:24b6387c8c8c F
536 | |
536 | |
537 o | 4:9520eea781bc E
537 o | 4:9520eea781bc E
538 |/
538 |/
539 o 0:cd010b8cd998 A
539 o 0:cd010b8cd998 A
540
540
541 $ cd ..
541 $ cd ..
542
542
543 Detach both parents
543 Detach both parents
544
544
545 $ hg init double-detach
545 $ hg init double-detach
546 $ cd double-detach
546 $ cd double-detach
547
547
548 $ hg debugdrawdag <<EOF
548 $ hg debugdrawdag <<EOF
549 > F
549 > F
550 > /|
550 > /|
551 > C E
551 > C E
552 > | |
552 > | |
553 > B D G
553 > B D G
554 > \|/
554 > \|/
555 > A
555 > A
556 > EOF
556 > EOF
557
557
558 $ hg rebase -d G -r 'B + D + F'
558 $ hg rebase -d G -r 'B + D + F'
559 rebasing 1:112478962961 "B" (B)
559 rebasing 1:112478962961 "B" (B)
560 rebasing 2:b18e25de2cf5 "D" (D)
560 rebasing 2:b18e25de2cf5 "D" (D)
561 rebasing 6:f15c3adaf214 "F" (F tip)
561 rebasing 6:f15c3adaf214 "F" (F tip)
562 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
562 abort: cannot rebase 6:f15c3adaf214 without moving at least one of its parents
563 [255]
563 [255]
564
564
565 $ cd ..
565 $ cd ..
566
566
567 test on rebase dropping a merge
567 test on rebase dropping a merge
568
568
569 (setup)
569 (setup)
570
570
571 $ hg init dropmerge
571 $ hg init dropmerge
572 $ cd dropmerge
572 $ cd dropmerge
573 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
573 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
574 adding changesets
574 adding changesets
575 adding manifests
575 adding manifests
576 adding file changes
576 adding file changes
577 added 8 changesets with 7 changes to 7 files (+2 heads)
577 added 8 changesets with 7 changes to 7 files (+2 heads)
578 new changesets cd010b8cd998:02de42196ebe (8 drafts)
578 new changesets cd010b8cd998:02de42196ebe (8 drafts)
579 (run 'hg heads' to see heads, 'hg merge' to merge)
579 (run 'hg heads' to see heads, 'hg merge' to merge)
580 $ hg up 3
580 $ hg up 3
581 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
581 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 $ hg merge 7
582 $ hg merge 7
583 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
584 (branch merge, don't forget to commit)
584 (branch merge, don't forget to commit)
585 $ hg ci -m 'M'
585 $ hg ci -m 'M'
586 $ echo I > I
586 $ echo I > I
587 $ hg add I
587 $ hg add I
588 $ hg ci -m I
588 $ hg ci -m I
589 $ hg log -G
589 $ hg log -G
590 @ 9:4bde274eefcf I
590 @ 9:4bde274eefcf I
591 |
591 |
592 o 8:53a6a128b2b7 M
592 o 8:53a6a128b2b7 M
593 |\
593 |\
594 | o 7:02de42196ebe H
594 | o 7:02de42196ebe H
595 | |
595 | |
596 | | o 6:eea13746799a G
596 | | o 6:eea13746799a G
597 | |/|
597 | |/|
598 | o | 5:24b6387c8c8c F
598 | o | 5:24b6387c8c8c F
599 | | |
599 | | |
600 | | o 4:9520eea781bc E
600 | | o 4:9520eea781bc E
601 | |/
601 | |/
602 o | 3:32af7686d403 D
602 o | 3:32af7686d403 D
603 | |
603 | |
604 o | 2:5fddd98957c8 C
604 o | 2:5fddd98957c8 C
605 | |
605 | |
606 o | 1:42ccdea3bb16 B
606 o | 1:42ccdea3bb16 B
607 |/
607 |/
608 o 0:cd010b8cd998 A
608 o 0:cd010b8cd998 A
609
609
610 (actual test)
610 (actual test)
611
611
612 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
612 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
613 rebasing 3:32af7686d403 "D"
613 rebasing 3:32af7686d403 "D"
614 rebasing 7:02de42196ebe "H"
614 rebasing 7:02de42196ebe "H"
615 rebasing 9:4bde274eefcf "I" (tip)
615 rebasing 9:4bde274eefcf "I" (tip)
616 1 new orphan changesets
616 1 new orphan changesets
617 $ hg log -G
617 $ hg log -G
618 @ 12:acd174b7ab39 I
618 @ 12:acd174b7ab39 I
619 |
619 |
620 o 11:6c11a6218c97 H
620 o 11:6c11a6218c97 H
621 |
621 |
622 | o 10:b5313c85b22e D
622 | o 10:b5313c85b22e D
623 |/
623 |/
624 | * 8:53a6a128b2b7 M
624 | * 8:53a6a128b2b7 M
625 | |\
625 | |\
626 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
626 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
627 | | |
627 | | |
628 o---+ 6:eea13746799a G
628 o---+ 6:eea13746799a G
629 | | |
629 | | |
630 | | o 5:24b6387c8c8c F
630 | | o 5:24b6387c8c8c F
631 | | |
631 | | |
632 o---+ 4:9520eea781bc E
632 o---+ 4:9520eea781bc E
633 / /
633 / /
634 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
634 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
635 | |
635 | |
636 o | 2:5fddd98957c8 C
636 o | 2:5fddd98957c8 C
637 | |
637 | |
638 o | 1:42ccdea3bb16 B
638 o | 1:42ccdea3bb16 B
639 |/
639 |/
640 o 0:cd010b8cd998 A
640 o 0:cd010b8cd998 A
641
641
642
642
643 Test hidden changesets in the rebase set (issue4504)
643 Test hidden changesets in the rebase set (issue4504)
644
644
645 $ hg up --hidden 9
645 $ hg up --hidden 9
646 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
646 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
647 updated to hidden changeset 4bde274eefcf
647 updated to hidden changeset 4bde274eefcf
648 (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39)
648 (hidden revision '4bde274eefcf' was rewritten as: acd174b7ab39)
649 $ echo J > J
649 $ echo J > J
650 $ hg add J
650 $ hg add J
651 $ hg commit -m J
651 $ hg commit -m J
652 1 new orphan changesets
652 1 new orphan changesets
653 $ hg debugobsolete `hg log --rev . -T '{node}'`
653 $ hg debugobsolete `hg log --rev . -T '{node}'`
654 obsoleted 1 changesets
654 obsoleted 1 changesets
655
655
656 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
656 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
657 rebasing 9:4bde274eefcf "I"
657 rebasing 9:4bde274eefcf "I"
658 rebasing 13:06edfc82198f "J" (tip)
658 rebasing 13:06edfc82198f "J" (tip)
659 2 new content-divergent changesets
659 2 new content-divergent changesets
660 $ hg log -G
660 $ hg log -G
661 @ 15:5ae8a643467b J
661 @ 15:5ae8a643467b J
662 |
662 |
663 * 14:9ad579b4a5de I
663 * 14:9ad579b4a5de I
664 |
664 |
665 | * 12:acd174b7ab39 I
665 | * 12:acd174b7ab39 I
666 | |
666 | |
667 | o 11:6c11a6218c97 H
667 | o 11:6c11a6218c97 H
668 | |
668 | |
669 o | 10:b5313c85b22e D
669 o | 10:b5313c85b22e D
670 |/
670 |/
671 | * 8:53a6a128b2b7 M
671 | * 8:53a6a128b2b7 M
672 | |\
672 | |\
673 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
673 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
674 | | |
674 | | |
675 o---+ 6:eea13746799a G
675 o---+ 6:eea13746799a G
676 | | |
676 | | |
677 | | o 5:24b6387c8c8c F
677 | | o 5:24b6387c8c8c F
678 | | |
678 | | |
679 o---+ 4:9520eea781bc E
679 o---+ 4:9520eea781bc E
680 / /
680 / /
681 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
681 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
682 | |
682 | |
683 o | 2:5fddd98957c8 C
683 o | 2:5fddd98957c8 C
684 | |
684 | |
685 o | 1:42ccdea3bb16 B
685 o | 1:42ccdea3bb16 B
686 |/
686 |/
687 o 0:cd010b8cd998 A
687 o 0:cd010b8cd998 A
688
688
689 $ hg up 14 -C
689 $ hg up 14 -C
690 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
690 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
691 $ echo "K" > K
691 $ echo "K" > K
692 $ hg add K
692 $ hg add K
693 $ hg commit --amend -m "K"
693 $ hg commit --amend -m "K"
694 1 new orphan changesets
694 1 new orphan changesets
695 $ echo "L" > L
695 $ echo "L" > L
696 $ hg add L
696 $ hg add L
697 $ hg commit -m "L"
697 $ hg commit -m "L"
698 $ hg up '.^'
698 $ hg up '.^'
699 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
699 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
700 $ echo "M" > M
700 $ echo "M" > M
701 $ hg add M
701 $ hg add M
702 $ hg commit --amend -m "M"
702 $ hg commit --amend -m "M"
703 1 new orphan changesets
703 1 new orphan changesets
704 $ hg log -G
704 $ hg log -G
705 @ 18:bfaedf8eb73b M
705 @ 18:bfaedf8eb73b M
706 |
706 |
707 | * 17:97219452e4bd L
707 | * 17:97219452e4bd L
708 | |
708 | |
709 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
709 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
710 |/
710 |/
711 | * 15:5ae8a643467b J
711 | * 15:5ae8a643467b J
712 | |
712 | |
713 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
713 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
714 |/
714 |/
715 | * 12:acd174b7ab39 I
715 | * 12:acd174b7ab39 I
716 | |
716 | |
717 | o 11:6c11a6218c97 H
717 | o 11:6c11a6218c97 H
718 | |
718 | |
719 o | 10:b5313c85b22e D
719 o | 10:b5313c85b22e D
720 |/
720 |/
721 | * 8:53a6a128b2b7 M
721 | * 8:53a6a128b2b7 M
722 | |\
722 | |\
723 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
723 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
724 | | |
724 | | |
725 o---+ 6:eea13746799a G
725 o---+ 6:eea13746799a G
726 | | |
726 | | |
727 | | o 5:24b6387c8c8c F
727 | | o 5:24b6387c8c8c F
728 | | |
728 | | |
729 o---+ 4:9520eea781bc E
729 o---+ 4:9520eea781bc E
730 / /
730 / /
731 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
731 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
732 | |
732 | |
733 o | 2:5fddd98957c8 C
733 o | 2:5fddd98957c8 C
734 | |
734 | |
735 o | 1:42ccdea3bb16 B
735 o | 1:42ccdea3bb16 B
736 |/
736 |/
737 o 0:cd010b8cd998 A
737 o 0:cd010b8cd998 A
738
738
739 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
739 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
740 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
740 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
741 rebasing 15:5ae8a643467b "J"
741 rebasing 15:5ae8a643467b "J"
742 1 new orphan changesets
742 1 new orphan changesets
743
743
744 $ cd ..
744 $ cd ..
745
745
746 Skip obsolete changeset even with multiple hops
746 Skip obsolete changeset even with multiple hops
747 -----------------------------------------------
747 -----------------------------------------------
748
748
749 setup
749 setup
750
750
751 $ hg init obsskip
751 $ hg init obsskip
752 $ cd obsskip
752 $ cd obsskip
753 $ cat << EOF >> .hg/hgrc
753 $ cat << EOF >> .hg/hgrc
754 > [experimental]
754 > [experimental]
755 > rebaseskipobsolete = True
755 > rebaseskipobsolete = True
756 > [extensions]
756 > [extensions]
757 > strip =
757 > strip =
758 > EOF
758 > EOF
759 $ echo A > A
759 $ echo A > A
760 $ hg add A
760 $ hg add A
761 $ hg commit -m A
761 $ hg commit -m A
762 $ echo B > B
762 $ echo B > B
763 $ hg add B
763 $ hg add B
764 $ hg commit -m B0
764 $ hg commit -m B0
765 $ hg commit --amend -m B1
765 $ hg commit --amend -m B1
766 $ hg commit --amend -m B2
766 $ hg commit --amend -m B2
767 $ hg up --hidden 'desc(B0)'
767 $ hg up --hidden 'desc(B0)'
768 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
768 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 updated to hidden changeset a8b11f55fb19
769 updated to hidden changeset a8b11f55fb19
770 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
770 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
771 $ echo C > C
771 $ echo C > C
772 $ hg add C
772 $ hg add C
773 $ hg commit -m C
773 $ hg commit -m C
774 1 new orphan changesets
774 1 new orphan changesets
775 $ hg log -G
775 $ hg log -G
776 @ 4:212cb178bcbb C
776 @ 4:212cb178bcbb C
777 |
777 |
778 | o 3:261e70097290 B2
778 | o 3:261e70097290 B2
779 | |
779 | |
780 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
780 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
781 |/
781 |/
782 o 0:4a2df7238c3b A
782 o 0:4a2df7238c3b A
783
783
784
784
785 Rebase finds its way in a chain of marker
785 Rebase finds its way in a chain of marker
786
786
787 $ hg rebase -d 'desc(B2)'
787 $ hg rebase -d 'desc(B2)'
788 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
788 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
789 rebasing 4:212cb178bcbb "C" (tip)
789 rebasing 4:212cb178bcbb "C" (tip)
790
790
791 Even when the chain include missing node
791 Even when the chain include missing node
792
792
793 $ hg up --hidden 'desc(B0)'
793 $ hg up --hidden 'desc(B0)'
794 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
794 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
795 updated to hidden changeset a8b11f55fb19
795 updated to hidden changeset a8b11f55fb19
796 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
796 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
797 $ echo D > D
797 $ echo D > D
798 $ hg add D
798 $ hg add D
799 $ hg commit -m D
799 $ hg commit -m D
800 1 new orphan changesets
800 1 new orphan changesets
801 $ hg --hidden strip -r 'desc(B1)'
801 $ hg --hidden strip -r 'desc(B1)'
802 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
802 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
803 1 new orphan changesets
803 1 new orphan changesets
804 $ hg log -G
804 $ hg log -G
805 @ 5:1a79b7535141 D
805 @ 5:1a79b7535141 D
806 |
806 |
807 | o 4:ff2c4d47b71d C
807 | o 4:ff2c4d47b71d C
808 | |
808 | |
809 | o 2:261e70097290 B2
809 | o 2:261e70097290 B2
810 | |
810 | |
811 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
811 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
812 |/
812 |/
813 o 0:4a2df7238c3b A
813 o 0:4a2df7238c3b A
814
814
815
815
816 $ hg rebase -d 'desc(B2)'
816 $ hg rebase -d 'desc(B2)'
817 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
817 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
818 rebasing 5:1a79b7535141 "D" (tip)
818 rebasing 5:1a79b7535141 "D" (tip)
819 $ hg up 4
819 $ hg up 4
820 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
820 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 $ echo "O" > O
821 $ echo "O" > O
822 $ hg add O
822 $ hg add O
823 $ hg commit -m O
823 $ hg commit -m O
824 $ echo "P" > P
824 $ echo "P" > P
825 $ hg add P
825 $ hg add P
826 $ hg commit -m P
826 $ hg commit -m P
827 $ hg log -G
827 $ hg log -G
828 @ 8:8d47583e023f P
828 @ 8:8d47583e023f P
829 |
829 |
830 o 7:360bbaa7d3ce O
830 o 7:360bbaa7d3ce O
831 |
831 |
832 | o 6:9c48361117de D
832 | o 6:9c48361117de D
833 | |
833 | |
834 o | 4:ff2c4d47b71d C
834 o | 4:ff2c4d47b71d C
835 |/
835 |/
836 o 2:261e70097290 B2
836 o 2:261e70097290 B2
837 |
837 |
838 o 0:4a2df7238c3b A
838 o 0:4a2df7238c3b A
839
839
840 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
840 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
841 obsoleted 1 changesets
841 obsoleted 1 changesets
842 1 new orphan changesets
842 1 new orphan changesets
843 $ hg rebase -d 6 -r "4::"
843 $ hg rebase -d 6 -r "4::"
844 rebasing 4:ff2c4d47b71d "C"
844 rebasing 4:ff2c4d47b71d "C"
845 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
845 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
846 rebasing 8:8d47583e023f "P" (tip)
846 rebasing 8:8d47583e023f "P" (tip)
847
847
848 If all the changeset to be rebased are obsolete and present in the destination, we
848 If all the changeset to be rebased are obsolete and present in the destination, we
849 should display a friendly error message
849 should display a friendly error message
850
850
851 $ hg log -G
851 $ hg log -G
852 @ 10:121d9e3bc4c6 P
852 @ 10:121d9e3bc4c6 P
853 |
853 |
854 o 9:4be60e099a77 C
854 o 9:4be60e099a77 C
855 |
855 |
856 o 6:9c48361117de D
856 o 6:9c48361117de D
857 |
857 |
858 o 2:261e70097290 B2
858 o 2:261e70097290 B2
859 |
859 |
860 o 0:4a2df7238c3b A
860 o 0:4a2df7238c3b A
861
861
862
862
863 $ hg up 9
863 $ hg up 9
864 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
864 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
865 $ echo "non-relevant change" > nonrelevant
865 $ echo "non-relevant change" > nonrelevant
866 $ hg add nonrelevant
866 $ hg add nonrelevant
867 $ hg commit -m nonrelevant
867 $ hg commit -m nonrelevant
868 created new head
868 created new head
869 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
869 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
870 obsoleted 1 changesets
870 obsoleted 1 changesets
871 $ hg log -G
871 $ hg log -G
872 @ 11:f44da1f4954c nonrelevant (pruned)
872 @ 11:f44da1f4954c nonrelevant (pruned)
873 |
873 |
874 | o 10:121d9e3bc4c6 P
874 | o 10:121d9e3bc4c6 P
875 |/
875 |/
876 o 9:4be60e099a77 C
876 o 9:4be60e099a77 C
877 |
877 |
878 o 6:9c48361117de D
878 o 6:9c48361117de D
879 |
879 |
880 o 2:261e70097290 B2
880 o 2:261e70097290 B2
881 |
881 |
882 o 0:4a2df7238c3b A
882 o 0:4a2df7238c3b A
883
883
884 $ hg rebase -r . -d 10
884 $ hg rebase -r . -d 10
885 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
885 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
886
886
887 If a rebase is going to create divergence, it should abort
887 If a rebase is going to create divergence, it should abort
888
888
889 $ hg log -G
889 $ hg log -G
890 @ 10:121d9e3bc4c6 P
890 @ 10:121d9e3bc4c6 P
891 |
891 |
892 o 9:4be60e099a77 C
892 o 9:4be60e099a77 C
893 |
893 |
894 o 6:9c48361117de D
894 o 6:9c48361117de D
895 |
895 |
896 o 2:261e70097290 B2
896 o 2:261e70097290 B2
897 |
897 |
898 o 0:4a2df7238c3b A
898 o 0:4a2df7238c3b A
899
899
900
900
901 $ hg up 9
901 $ hg up 9
902 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
902 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
903 $ echo "john" > doe
903 $ echo "john" > doe
904 $ hg add doe
904 $ hg add doe
905 $ hg commit -m "john doe"
905 $ hg commit -m "john doe"
906 created new head
906 created new head
907 $ hg up 10
907 $ hg up 10
908 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
908 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
909 $ echo "foo" > bar
909 $ echo "foo" > bar
910 $ hg add bar
910 $ hg add bar
911 $ hg commit --amend -m "10'"
911 $ hg commit --amend -m "10'"
912 $ hg up 10 --hidden
912 $ hg up 10 --hidden
913 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
913 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
914 updated to hidden changeset 121d9e3bc4c6
914 updated to hidden changeset 121d9e3bc4c6
915 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
915 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
916 $ echo "bar" > foo
916 $ echo "bar" > foo
917 $ hg add foo
917 $ hg add foo
918 $ hg commit -m "bar foo"
918 $ hg commit -m "bar foo"
919 1 new orphan changesets
919 1 new orphan changesets
920 $ hg log -G
920 $ hg log -G
921 @ 14:73568ab6879d bar foo
921 @ 14:73568ab6879d bar foo
922 |
922 |
923 | o 13:77d874d096a2 10'
923 | o 13:77d874d096a2 10'
924 | |
924 | |
925 | | o 12:3eb461388009 john doe
925 | | o 12:3eb461388009 john doe
926 | |/
926 | |/
927 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
927 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
928 |/
928 |/
929 o 9:4be60e099a77 C
929 o 9:4be60e099a77 C
930 |
930 |
931 o 6:9c48361117de D
931 o 6:9c48361117de D
932 |
932 |
933 o 2:261e70097290 B2
933 o 2:261e70097290 B2
934 |
934 |
935 o 0:4a2df7238c3b A
935 o 0:4a2df7238c3b A
936
936
937 $ hg summary
937 $ hg summary
938 parent: 14:73568ab6879d tip (orphan)
938 parent: 14:73568ab6879d tip (orphan)
939 bar foo
939 bar foo
940 branch: default
940 branch: default
941 commit: (clean)
941 commit: (clean)
942 update: 2 new changesets, 3 branch heads (merge)
942 update: 2 new changesets, 3 branch heads (merge)
943 phases: 8 draft
943 phases: 8 draft
944 orphan: 1 changesets
944 orphan: 1 changesets
945 $ hg rebase -s 10 -d 12
945 $ hg rebase -s 10 -d 12
946 abort: this rebase will cause divergences from: 121d9e3bc4c6
946 abort: this rebase will cause divergences from: 121d9e3bc4c6
947 (to force the rebase please set experimental.evolution.allowdivergence=True)
947 (to force the rebase please set experimental.evolution.allowdivergence=True)
948 [255]
948 [255]
949 $ hg log -G
949 $ hg log -G
950 @ 14:73568ab6879d bar foo
950 @ 14:73568ab6879d bar foo
951 |
951 |
952 | o 13:77d874d096a2 10'
952 | o 13:77d874d096a2 10'
953 | |
953 | |
954 | | o 12:3eb461388009 john doe
954 | | o 12:3eb461388009 john doe
955 | |/
955 | |/
956 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
956 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
957 |/
957 |/
958 o 9:4be60e099a77 C
958 o 9:4be60e099a77 C
959 |
959 |
960 o 6:9c48361117de D
960 o 6:9c48361117de D
961 |
961 |
962 o 2:261e70097290 B2
962 o 2:261e70097290 B2
963 |
963 |
964 o 0:4a2df7238c3b A
964 o 0:4a2df7238c3b A
965
965
966 With experimental.evolution.allowdivergence=True, rebase can create divergence
966 With experimental.evolution.allowdivergence=True, rebase can create divergence
967
967
968 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
968 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
969 rebasing 10:121d9e3bc4c6 "P"
969 rebasing 10:121d9e3bc4c6 "P"
970 rebasing 14:73568ab6879d "bar foo" (tip)
970 rebasing 14:73568ab6879d "bar foo" (tip)
971 2 new content-divergent changesets
971 2 new content-divergent changesets
972 $ hg summary
972 $ hg summary
973 parent: 16:61bd55f69bc4 tip
973 parent: 16:61bd55f69bc4 tip
974 bar foo
974 bar foo
975 branch: default
975 branch: default
976 commit: (clean)
976 commit: (clean)
977 update: 1 new changesets, 2 branch heads (merge)
977 update: 1 new changesets, 2 branch heads (merge)
978 phases: 8 draft
978 phases: 8 draft
979 content-divergent: 2 changesets
979 content-divergent: 2 changesets
980
980
981 rebase --continue + skipped rev because their successors are in destination
981 rebase --continue + skipped rev because their successors are in destination
982 we make a change in trunk and work on conflicting changes to make rebase abort.
982 we make a change in trunk and work on conflicting changes to make rebase abort.
983
983
984 $ hg log -G -r 16::
984 $ hg log -G -r 16::
985 @ 16:61bd55f69bc4 bar foo
985 @ 16:61bd55f69bc4 bar foo
986 |
986 |
987 ~
987 ~
988
988
989 Create the two changes in trunk
989 Create the two changes in trunk
990 $ printf "a" > willconflict
990 $ printf "a" > willconflict
991 $ hg add willconflict
991 $ hg add willconflict
992 $ hg commit -m "willconflict first version"
992 $ hg commit -m "willconflict first version"
993
993
994 $ printf "dummy" > C
994 $ printf "dummy" > C
995 $ hg commit -m "dummy change successor"
995 $ hg commit -m "dummy change successor"
996
996
997 Create the changes that we will rebase
997 Create the changes that we will rebase
998 $ hg update -C 16 -q
998 $ hg update -C 16 -q
999 $ printf "b" > willconflict
999 $ printf "b" > willconflict
1000 $ hg add willconflict
1000 $ hg add willconflict
1001 $ hg commit -m "willconflict second version"
1001 $ hg commit -m "willconflict second version"
1002 created new head
1002 created new head
1003 $ printf "dummy" > K
1003 $ printf "dummy" > K
1004 $ hg add K
1004 $ hg add K
1005 $ hg commit -m "dummy change"
1005 $ hg commit -m "dummy change"
1006 $ printf "dummy" > L
1006 $ printf "dummy" > L
1007 $ hg add L
1007 $ hg add L
1008 $ hg commit -m "dummy change"
1008 $ hg commit -m "dummy change"
1009 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1009 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1010 obsoleted 1 changesets
1010 obsoleted 1 changesets
1011 1 new orphan changesets
1011 1 new orphan changesets
1012
1012
1013 $ hg log -G -r 16::
1013 $ hg log -G -r 16::
1014 @ 21:7bdc8a87673d dummy change
1014 @ 21:7bdc8a87673d dummy change
1015 |
1015 |
1016 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1016 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1017 |
1017 |
1018 o 19:b82fb57ea638 willconflict second version
1018 o 19:b82fb57ea638 willconflict second version
1019 |
1019 |
1020 | o 18:601db7a18f51 dummy change successor
1020 | o 18:601db7a18f51 dummy change successor
1021 | |
1021 | |
1022 | o 17:357ddf1602d5 willconflict first version
1022 | o 17:357ddf1602d5 willconflict first version
1023 |/
1023 |/
1024 o 16:61bd55f69bc4 bar foo
1024 o 16:61bd55f69bc4 bar foo
1025 |
1025 |
1026 ~
1026 ~
1027 $ hg rebase -r ".^^ + .^ + ." -d 18
1027 $ hg rebase -r ".^^ + .^ + ." -d 18
1028 rebasing 19:b82fb57ea638 "willconflict second version"
1028 rebasing 19:b82fb57ea638 "willconflict second version"
1029 merging willconflict
1029 merging willconflict
1030 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1030 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1031 unresolved conflicts (see hg resolve, then hg rebase --continue)
1031 unresolved conflicts (see hg resolve, then hg rebase --continue)
1032 [1]
1032 [1]
1033
1033
1034 $ hg resolve --mark willconflict
1034 $ hg resolve --mark willconflict
1035 (no more unresolved files)
1035 (no more unresolved files)
1036 continue: hg rebase --continue
1036 continue: hg rebase --continue
1037 $ hg rebase --continue
1037 $ hg rebase --continue
1038 rebasing 19:b82fb57ea638 "willconflict second version"
1038 rebasing 19:b82fb57ea638 "willconflict second version"
1039 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1039 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1040 rebasing 21:7bdc8a87673d "dummy change" (tip)
1040 rebasing 21:7bdc8a87673d "dummy change" (tip)
1041 $ cd ..
1041 $ cd ..
1042
1042
1043 Divergence cases due to obsolete changesets
1043 Divergence cases due to obsolete changesets
1044 -------------------------------------------
1044 -------------------------------------------
1045
1045
1046 We should ignore branches with unstable changesets when they are based on an
1046 We should ignore branches with unstable changesets when they are based on an
1047 obsolete changeset which successor is in rebase set.
1047 obsolete changeset which successor is in rebase set.
1048
1048
1049 $ hg init divergence
1049 $ hg init divergence
1050 $ cd divergence
1050 $ cd divergence
1051 $ cat >> .hg/hgrc << EOF
1051 $ cat >> .hg/hgrc << EOF
1052 > [extensions]
1052 > [extensions]
1053 > strip =
1053 > strip =
1054 > [alias]
1054 > [alias]
1055 > strip = strip --no-backup --quiet
1055 > strip = strip --no-backup --quiet
1056 > [templates]
1056 > [templates]
1057 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1057 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1058 > EOF
1058 > EOF
1059
1059
1060 $ hg debugdrawdag <<EOF
1060 $ hg debugdrawdag <<EOF
1061 > e f
1061 > e f
1062 > | |
1062 > | |
1063 > d' d # replace: d -> d'
1063 > d' d # replace: d -> d'
1064 > \ /
1064 > \ /
1065 > c
1065 > c
1066 > |
1066 > |
1067 > x b
1067 > x b
1068 > \|
1068 > \|
1069 > a
1069 > a
1070 > EOF
1070 > EOF
1071 1 new orphan changesets
1071 1 new orphan changesets
1072 $ hg log -G -r 'a'::
1072 $ hg log -G -r 'a'::
1073 * 7:1143e9adc121 f
1073 * 7:1143e9adc121 f
1074 |
1074 |
1075 | o 6:d60ebfa0f1cb e
1075 | o 6:d60ebfa0f1cb e
1076 | |
1076 | |
1077 | o 5:027ad6c5830d d'
1077 | o 5:027ad6c5830d d'
1078 | |
1078 | |
1079 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1079 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1080 |/
1080 |/
1081 o 3:a82ac2b38757 c
1081 o 3:a82ac2b38757 c
1082 |
1082 |
1083 | o 2:630d7c95eff7 x
1083 | o 2:630d7c95eff7 x
1084 | |
1084 | |
1085 o | 1:488e1b7e7341 b
1085 o | 1:488e1b7e7341 b
1086 |/
1086 |/
1087 o 0:b173517d0057 a
1087 o 0:b173517d0057 a
1088
1088
1089
1089
1090 Changeset d and its descendants are excluded to avoid divergence of d, which
1090 Changeset d and its descendants are excluded to avoid divergence of d, which
1091 would occur because the successor of d (d') is also in rebaseset. As a
1091 would occur because the successor of d (d') is also in rebaseset. As a
1092 consequence f (descendant of d) is left behind.
1092 consequence f (descendant of d) is left behind.
1093
1093
1094 $ hg rebase -b 'e' -d 'x'
1094 $ hg rebase -b 'e' -d 'x'
1095 rebasing 1:488e1b7e7341 "b" (b)
1095 rebasing 1:488e1b7e7341 "b" (b)
1096 rebasing 3:a82ac2b38757 "c" (c)
1096 rebasing 3:a82ac2b38757 "c" (c)
1097 rebasing 5:027ad6c5830d "d'" (d')
1097 rebasing 5:027ad6c5830d "d'" (d')
1098 rebasing 6:d60ebfa0f1cb "e" (e)
1098 rebasing 6:d60ebfa0f1cb "e" (e)
1099 note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
1099 note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
1100 $ hg log -G -r 'a'::
1100 $ hg log -G -r 'a'::
1101 o 11:eb6d63fc4ed5 e
1101 o 11:eb6d63fc4ed5 e
1102 |
1102 |
1103 o 10:44d8c724a70c d'
1103 o 10:44d8c724a70c d'
1104 |
1104 |
1105 o 9:d008e6b4d3fd c
1105 o 9:d008e6b4d3fd c
1106 |
1106 |
1107 o 8:67e8f4a16c49 b
1107 o 8:67e8f4a16c49 b
1108 |
1108 |
1109 | * 7:1143e9adc121 f
1109 | * 7:1143e9adc121 f
1110 | |
1110 | |
1111 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1111 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1112 | | |
1112 | | |
1113 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1113 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1114 | | |
1114 | | |
1115 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1115 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1116 | |/
1116 | |/
1117 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1117 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1118 | |
1118 | |
1119 o | 2:630d7c95eff7 x
1119 o | 2:630d7c95eff7 x
1120 | |
1120 | |
1121 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1121 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1122 |/
1122 |/
1123 o 0:b173517d0057 a
1123 o 0:b173517d0057 a
1124
1124
1125 $ hg strip -r 8:
1125 $ hg strip -r 8:
1126 $ hg log -G -r 'a'::
1126 $ hg log -G -r 'a'::
1127 * 7:1143e9adc121 f
1127 * 7:1143e9adc121 f
1128 |
1128 |
1129 | o 6:d60ebfa0f1cb e
1129 | o 6:d60ebfa0f1cb e
1130 | |
1130 | |
1131 | o 5:027ad6c5830d d'
1131 | o 5:027ad6c5830d d'
1132 | |
1132 | |
1133 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1133 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1134 |/
1134 |/
1135 o 3:a82ac2b38757 c
1135 o 3:a82ac2b38757 c
1136 |
1136 |
1137 | o 2:630d7c95eff7 x
1137 | o 2:630d7c95eff7 x
1138 | |
1138 | |
1139 o | 1:488e1b7e7341 b
1139 o | 1:488e1b7e7341 b
1140 |/
1140 |/
1141 o 0:b173517d0057 a
1141 o 0:b173517d0057 a
1142
1142
1143
1143
1144 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1144 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1145 set and none in destination, we still get the divergence warning.
1145 set and none in destination, we still get the divergence warning.
1146 By allowing divergence, we can perform the rebase.
1146 By allowing divergence, we can perform the rebase.
1147
1147
1148 $ hg rebase -r 'c'::'f' -d 'x'
1148 $ hg rebase -r 'c'::'f' -d 'x'
1149 abort: this rebase will cause divergences from: 76be324c128b
1149 abort: this rebase will cause divergences from: 76be324c128b
1150 (to force the rebase please set experimental.evolution.allowdivergence=True)
1150 (to force the rebase please set experimental.evolution.allowdivergence=True)
1151 [255]
1151 [255]
1152 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1152 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1153 rebasing 3:a82ac2b38757 "c" (c)
1153 rebasing 3:a82ac2b38757 "c" (c)
1154 rebasing 4:76be324c128b "d" (d)
1154 rebasing 4:76be324c128b "d" (d)
1155 rebasing 7:1143e9adc121 "f" (f tip)
1155 rebasing 7:1143e9adc121 "f" (f tip)
1156 1 new orphan changesets
1156 1 new orphan changesets
1157 2 new content-divergent changesets
1157 2 new content-divergent changesets
1158 $ hg log -G -r 'a':: -T instabilities
1158 $ hg log -G -r 'a':: -T instabilities
1159 o 10:e1744ea07510 f
1159 o 10:e1744ea07510 f
1160 |
1160 |
1161 * 9:e2b36ea9a0a0 d (content-divergent)
1161 * 9:e2b36ea9a0a0 d (content-divergent)
1162 |
1162 |
1163 o 8:6a0376de376e c
1163 o 8:6a0376de376e c
1164 |
1164 |
1165 | x 7:1143e9adc121 f
1165 | x 7:1143e9adc121 f
1166 | |
1166 | |
1167 | | * 6:d60ebfa0f1cb e (orphan)
1167 | | * 6:d60ebfa0f1cb e (orphan)
1168 | | |
1168 | | |
1169 | | * 5:027ad6c5830d d' (orphan content-divergent)
1169 | | * 5:027ad6c5830d d' (orphan content-divergent)
1170 | | |
1170 | | |
1171 | x | 4:76be324c128b d
1171 | x | 4:76be324c128b d
1172 | |/
1172 | |/
1173 | x 3:a82ac2b38757 c
1173 | x 3:a82ac2b38757 c
1174 | |
1174 | |
1175 o | 2:630d7c95eff7 x
1175 o | 2:630d7c95eff7 x
1176 | |
1176 | |
1177 | o 1:488e1b7e7341 b
1177 | o 1:488e1b7e7341 b
1178 |/
1178 |/
1179 o 0:b173517d0057 a
1179 o 0:b173517d0057 a
1180
1180
1181 $ hg strip -r 8:
1181 $ hg strip -r 8:
1182
1182
1183 (Not skipping obsoletes means that divergence is allowed.)
1183 (Not skipping obsoletes means that divergence is allowed.)
1184
1184
1185 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1185 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1186 rebasing 3:a82ac2b38757 "c" (c)
1186 rebasing 3:a82ac2b38757 "c" (c)
1187 rebasing 4:76be324c128b "d" (d)
1187 rebasing 4:76be324c128b "d" (d)
1188 rebasing 7:1143e9adc121 "f" (f tip)
1188 rebasing 7:1143e9adc121 "f" (f tip)
1189 1 new orphan changesets
1189 1 new orphan changesets
1190 2 new content-divergent changesets
1190 2 new content-divergent changesets
1191
1191
1192 $ hg strip -r 0:
1192 $ hg strip -r 0:
1193
1193
1194 Similar test on a more complex graph
1194 Similar test on a more complex graph
1195
1195
1196 $ hg debugdrawdag <<EOF
1196 $ hg debugdrawdag <<EOF
1197 > g
1197 > g
1198 > |
1198 > |
1199 > f e
1199 > f e
1200 > | |
1200 > | |
1201 > e' d # replace: e -> e'
1201 > e' d # replace: e -> e'
1202 > \ /
1202 > \ /
1203 > c
1203 > c
1204 > |
1204 > |
1205 > x b
1205 > x b
1206 > \|
1206 > \|
1207 > a
1207 > a
1208 > EOF
1208 > EOF
1209 1 new orphan changesets
1209 1 new orphan changesets
1210 $ hg log -G -r 'a':
1210 $ hg log -G -r 'a':
1211 * 8:2876ce66c6eb g
1211 * 8:2876ce66c6eb g
1212 |
1212 |
1213 | o 7:3ffec603ab53 f
1213 | o 7:3ffec603ab53 f
1214 | |
1214 | |
1215 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1215 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1216 | |
1216 | |
1217 | o 5:63324dc512ea e'
1217 | o 5:63324dc512ea e'
1218 | |
1218 | |
1219 o | 4:76be324c128b d
1219 o | 4:76be324c128b d
1220 |/
1220 |/
1221 o 3:a82ac2b38757 c
1221 o 3:a82ac2b38757 c
1222 |
1222 |
1223 | o 2:630d7c95eff7 x
1223 | o 2:630d7c95eff7 x
1224 | |
1224 | |
1225 o | 1:488e1b7e7341 b
1225 o | 1:488e1b7e7341 b
1226 |/
1226 |/
1227 o 0:b173517d0057 a
1227 o 0:b173517d0057 a
1228
1228
1229 $ hg rebase -b 'f' -d 'x'
1229 $ hg rebase -b 'f' -d 'x'
1230 rebasing 1:488e1b7e7341 "b" (b)
1230 rebasing 1:488e1b7e7341 "b" (b)
1231 rebasing 3:a82ac2b38757 "c" (c)
1231 rebasing 3:a82ac2b38757 "c" (c)
1232 rebasing 5:63324dc512ea "e'" (e')
1232 rebasing 5:63324dc512ea "e'" (e')
1233 rebasing 7:3ffec603ab53 "f" (f)
1233 rebasing 7:3ffec603ab53 "f" (f)
1234 rebasing 4:76be324c128b "d" (d)
1234 rebasing 4:76be324c128b "d" (d)
1235 note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
1235 note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
1236 $ hg log -G -r 'a':
1236 $ hg log -G -r 'a':
1237 o 13:a1707a5b7c2c d
1237 o 13:a1707a5b7c2c d
1238 |
1238 |
1239 | o 12:ef6251596616 f
1239 | o 12:ef6251596616 f
1240 | |
1240 | |
1241 | o 11:b6f172e64af9 e'
1241 | o 11:b6f172e64af9 e'
1242 |/
1242 |/
1243 o 10:d008e6b4d3fd c
1243 o 10:d008e6b4d3fd c
1244 |
1244 |
1245 o 9:67e8f4a16c49 b
1245 o 9:67e8f4a16c49 b
1246 |
1246 |
1247 | * 8:2876ce66c6eb g
1247 | * 8:2876ce66c6eb g
1248 | |
1248 | |
1249 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1249 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1250 | | |
1250 | | |
1251 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1251 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1252 | | |
1252 | | |
1253 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1253 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1254 | | |
1254 | | |
1255 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1255 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1256 | |/
1256 | |/
1257 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1257 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1258 | |
1258 | |
1259 o | 2:630d7c95eff7 x
1259 o | 2:630d7c95eff7 x
1260 | |
1260 | |
1261 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1261 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1262 |/
1262 |/
1263 o 0:b173517d0057 a
1263 o 0:b173517d0057 a
1264
1264
1265
1265
1266 issue5782
1266 issue5782
1267 $ hg strip -r 0:
1267 $ hg strip -r 0:
1268 $ hg debugdrawdag <<EOF
1268 $ hg debugdrawdag <<EOF
1269 > d
1269 > d
1270 > |
1270 > |
1271 > c1 c # replace: c -> c1
1271 > c1 c # replace: c -> c1
1272 > \ /
1272 > \ /
1273 > b
1273 > b
1274 > |
1274 > |
1275 > a
1275 > a
1276 > EOF
1276 > EOF
1277 1 new orphan changesets
1277 1 new orphan changesets
1278 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1278 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1279 obsoleted 1 changesets
1279 obsoleted 1 changesets
1280 $ hg log -G -r 'a': --hidden
1280 $ hg log -G -r 'a': --hidden
1281 * 4:76be324c128b d
1281 * 4:76be324c128b d
1282 |
1282 |
1283 | x 3:ef8a456de8fa c1 (pruned)
1283 | x 3:ef8a456de8fa c1 (pruned)
1284 | |
1284 | |
1285 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1285 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1286 |/
1286 |/
1287 o 1:488e1b7e7341 b
1287 o 1:488e1b7e7341 b
1288 |
1288 |
1289 o 0:b173517d0057 a
1289 o 0:b173517d0057 a
1290
1290
1291 $ hg rebase -d 0 -r 2
1291 $ hg rebase -d 0 -r 2
1292 rebasing 2:a82ac2b38757 "c" (c)
1292 rebasing 2:a82ac2b38757 "c" (c)
1293 $ hg log -G -r 'a': --hidden
1293 $ hg log -G -r 'a': --hidden
1294 o 5:69ad416a4a26 c
1294 o 5:69ad416a4a26 c
1295 |
1295 |
1296 | * 4:76be324c128b d
1296 | * 4:76be324c128b d
1297 | |
1297 | |
1298 | | x 3:ef8a456de8fa c1 (pruned)
1298 | | x 3:ef8a456de8fa c1 (pruned)
1299 | | |
1299 | | |
1300 | x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa rewritten using rebase as 5:69ad416a4a26)
1300 | x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa rewritten using rebase as 5:69ad416a4a26)
1301 | |/
1301 | |/
1302 | o 1:488e1b7e7341 b
1302 | o 1:488e1b7e7341 b
1303 |/
1303 |/
1304 o 0:b173517d0057 a
1304 o 0:b173517d0057 a
1305
1305
1306 $ cd ..
1306 $ cd ..
1307
1307
1308 Rebase merge where successor of one parent is equal to destination (issue5198)
1308 Rebase merge where successor of one parent is equal to destination (issue5198)
1309
1309
1310 $ hg init p1-succ-is-dest
1310 $ hg init p1-succ-is-dest
1311 $ cd p1-succ-is-dest
1311 $ cd p1-succ-is-dest
1312
1312
1313 $ hg debugdrawdag <<EOF
1313 $ hg debugdrawdag <<EOF
1314 > F
1314 > F
1315 > /|
1315 > /|
1316 > E D B # replace: D -> B
1316 > E D B # replace: D -> B
1317 > \|/
1317 > \|/
1318 > A
1318 > A
1319 > EOF
1319 > EOF
1320 1 new orphan changesets
1320 1 new orphan changesets
1321
1321
1322 $ hg rebase -d B -s D
1322 $ hg rebase -d B -s D
1323 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1323 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1324 rebasing 4:66f1a38021c9 "F" (F tip)
1324 rebasing 4:66f1a38021c9 "F" (F tip)
1325 $ hg log -G
1325 $ hg log -G
1326 o 5:50e9d60b99c6 F
1326 o 5:50e9d60b99c6 F
1327 |\
1327 |\
1328 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1328 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1329 | |/|
1329 | |/|
1330 | o | 3:7fb047a69f22 E
1330 | o | 3:7fb047a69f22 E
1331 | | |
1331 | | |
1332 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1332 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1333 | |/
1333 | |/
1334 o | 1:112478962961 B
1334 o | 1:112478962961 B
1335 |/
1335 |/
1336 o 0:426bada5c675 A
1336 o 0:426bada5c675 A
1337
1337
1338 $ cd ..
1338 $ cd ..
1339
1339
1340 Rebase merge where successor of other parent is equal to destination
1340 Rebase merge where successor of other parent is equal to destination
1341
1341
1342 $ hg init p2-succ-is-dest
1342 $ hg init p2-succ-is-dest
1343 $ cd p2-succ-is-dest
1343 $ cd p2-succ-is-dest
1344
1344
1345 $ hg debugdrawdag <<EOF
1345 $ hg debugdrawdag <<EOF
1346 > F
1346 > F
1347 > /|
1347 > /|
1348 > E D B # replace: E -> B
1348 > E D B # replace: E -> B
1349 > \|/
1349 > \|/
1350 > A
1350 > A
1351 > EOF
1351 > EOF
1352 1 new orphan changesets
1352 1 new orphan changesets
1353
1353
1354 $ hg rebase -d B -s E
1354 $ hg rebase -d B -s E
1355 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1355 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1356 rebasing 4:66f1a38021c9 "F" (F tip)
1356 rebasing 4:66f1a38021c9 "F" (F tip)
1357 $ hg log -G
1357 $ hg log -G
1358 o 5:aae1787dacee F
1358 o 5:aae1787dacee F
1359 |\
1359 |\
1360 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1360 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1361 | |/|
1361 | |/|
1362 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1362 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1363 | | |
1363 | | |
1364 | o | 2:b18e25de2cf5 D
1364 | o | 2:b18e25de2cf5 D
1365 | |/
1365 | |/
1366 o / 1:112478962961 B
1366 o / 1:112478962961 B
1367 |/
1367 |/
1368 o 0:426bada5c675 A
1368 o 0:426bada5c675 A
1369
1369
1370 $ cd ..
1370 $ cd ..
1371
1371
1372 Rebase merge where successor of one parent is ancestor of destination
1372 Rebase merge where successor of one parent is ancestor of destination
1373
1373
1374 $ hg init p1-succ-in-dest
1374 $ hg init p1-succ-in-dest
1375 $ cd p1-succ-in-dest
1375 $ cd p1-succ-in-dest
1376
1376
1377 $ hg debugdrawdag <<EOF
1377 $ hg debugdrawdag <<EOF
1378 > F C
1378 > F C
1379 > /| |
1379 > /| |
1380 > E D B # replace: D -> B
1380 > E D B # replace: D -> B
1381 > \|/
1381 > \|/
1382 > A
1382 > A
1383 > EOF
1383 > EOF
1384 1 new orphan changesets
1384 1 new orphan changesets
1385
1385
1386 $ hg rebase -d C -s D
1386 $ hg rebase -d C -s D
1387 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1387 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1388 rebasing 5:66f1a38021c9 "F" (F tip)
1388 rebasing 5:66f1a38021c9 "F" (F tip)
1389
1389
1390 $ hg log -G
1390 $ hg log -G
1391 o 6:0913febf6439 F
1391 o 6:0913febf6439 F
1392 |\
1392 |\
1393 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1393 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1394 | | |
1394 | | |
1395 | o | 4:26805aba1e60 C
1395 | o | 4:26805aba1e60 C
1396 | | |
1396 | | |
1397 o | | 3:7fb047a69f22 E
1397 o | | 3:7fb047a69f22 E
1398 | | |
1398 | | |
1399 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1399 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1400 | |
1400 | |
1401 | o 1:112478962961 B
1401 | o 1:112478962961 B
1402 |/
1402 |/
1403 o 0:426bada5c675 A
1403 o 0:426bada5c675 A
1404
1404
1405 $ cd ..
1405 $ cd ..
1406
1406
1407 Rebase merge where successor of other parent is ancestor of destination
1407 Rebase merge where successor of other parent is ancestor of destination
1408
1408
1409 $ hg init p2-succ-in-dest
1409 $ hg init p2-succ-in-dest
1410 $ cd p2-succ-in-dest
1410 $ cd p2-succ-in-dest
1411
1411
1412 $ hg debugdrawdag <<EOF
1412 $ hg debugdrawdag <<EOF
1413 > F C
1413 > F C
1414 > /| |
1414 > /| |
1415 > E D B # replace: E -> B
1415 > E D B # replace: E -> B
1416 > \|/
1416 > \|/
1417 > A
1417 > A
1418 > EOF
1418 > EOF
1419 1 new orphan changesets
1419 1 new orphan changesets
1420
1420
1421 $ hg rebase -d C -s E
1421 $ hg rebase -d C -s E
1422 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1422 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1423 rebasing 5:66f1a38021c9 "F" (F tip)
1423 rebasing 5:66f1a38021c9 "F" (F tip)
1424 $ hg log -G
1424 $ hg log -G
1425 o 6:c6ab0cc6d220 F
1425 o 6:c6ab0cc6d220 F
1426 |\
1426 |\
1427 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1427 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1428 | | |
1428 | | |
1429 | o | 4:26805aba1e60 C
1429 | o | 4:26805aba1e60 C
1430 | | |
1430 | | |
1431 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1431 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1432 | | |
1432 | | |
1433 o---+ 2:b18e25de2cf5 D
1433 o---+ 2:b18e25de2cf5 D
1434 / /
1434 / /
1435 o / 1:112478962961 B
1435 o / 1:112478962961 B
1436 |/
1436 |/
1437 o 0:426bada5c675 A
1437 o 0:426bada5c675 A
1438
1438
1439 $ cd ..
1439 $ cd ..
1440
1440
1441 Rebase merge where successor of one parent is ancestor of destination
1441 Rebase merge where successor of one parent is ancestor of destination
1442
1442
1443 $ hg init p1-succ-in-dest-b
1443 $ hg init p1-succ-in-dest-b
1444 $ cd p1-succ-in-dest-b
1444 $ cd p1-succ-in-dest-b
1445
1445
1446 $ hg debugdrawdag <<EOF
1446 $ hg debugdrawdag <<EOF
1447 > F C
1447 > F C
1448 > /| |
1448 > /| |
1449 > E D B # replace: E -> B
1449 > E D B # replace: E -> B
1450 > \|/
1450 > \|/
1451 > A
1451 > A
1452 > EOF
1452 > EOF
1453 1 new orphan changesets
1453 1 new orphan changesets
1454
1454
1455 $ hg rebase -d C -b F
1455 $ hg rebase -d C -b F
1456 rebasing 2:b18e25de2cf5 "D" (D)
1456 rebasing 2:b18e25de2cf5 "D" (D)
1457 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1457 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1458 rebasing 5:66f1a38021c9 "F" (F tip)
1458 rebasing 5:66f1a38021c9 "F" (F tip)
1459 note: rebase of 5:66f1a38021c9 "F" (F tip) created no changes to commit
1459 note: not rebasing 5:66f1a38021c9 "F" (F tip), its destination already has all its changes
1460 $ hg log -G
1460 $ hg log -G
1461 o 6:8f47515dda15 D
1461 o 6:8f47515dda15 D
1462 |
1462 |
1463 | x 5:66f1a38021c9 F (pruned using rebase)
1463 | x 5:66f1a38021c9 F (pruned using rebase)
1464 | |\
1464 | |\
1465 o | | 4:26805aba1e60 C
1465 o | | 4:26805aba1e60 C
1466 | | |
1466 | | |
1467 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1467 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1468 | | |
1468 | | |
1469 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1469 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1470 | |/
1470 | |/
1471 o / 1:112478962961 B
1471 o / 1:112478962961 B
1472 |/
1472 |/
1473 o 0:426bada5c675 A
1473 o 0:426bada5c675 A
1474
1474
1475 $ cd ..
1475 $ cd ..
1476
1476
1477 Rebase merge where successor of other parent is ancestor of destination
1477 Rebase merge where successor of other parent is ancestor of destination
1478
1478
1479 $ hg init p2-succ-in-dest-b
1479 $ hg init p2-succ-in-dest-b
1480 $ cd p2-succ-in-dest-b
1480 $ cd p2-succ-in-dest-b
1481
1481
1482 $ hg debugdrawdag <<EOF
1482 $ hg debugdrawdag <<EOF
1483 > F C
1483 > F C
1484 > /| |
1484 > /| |
1485 > E D B # replace: D -> B
1485 > E D B # replace: D -> B
1486 > \|/
1486 > \|/
1487 > A
1487 > A
1488 > EOF
1488 > EOF
1489 1 new orphan changesets
1489 1 new orphan changesets
1490
1490
1491 $ hg rebase -d C -b F
1491 $ hg rebase -d C -b F
1492 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1492 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1493 rebasing 3:7fb047a69f22 "E" (E)
1493 rebasing 3:7fb047a69f22 "E" (E)
1494 rebasing 5:66f1a38021c9 "F" (F tip)
1494 rebasing 5:66f1a38021c9 "F" (F tip)
1495 note: rebase of 5:66f1a38021c9 "F" (F tip) created no changes to commit
1495 note: not rebasing 5:66f1a38021c9 "F" (F tip), its destination already has all its changes
1496
1496
1497 $ hg log -G
1497 $ hg log -G
1498 o 6:533690786a86 E
1498 o 6:533690786a86 E
1499 |
1499 |
1500 | x 5:66f1a38021c9 F (pruned using rebase)
1500 | x 5:66f1a38021c9 F (pruned using rebase)
1501 | |\
1501 | |\
1502 o | | 4:26805aba1e60 C
1502 o | | 4:26805aba1e60 C
1503 | | |
1503 | | |
1504 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1504 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1505 | | |
1505 | | |
1506 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1506 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1507 | |/
1507 | |/
1508 o / 1:112478962961 B
1508 o / 1:112478962961 B
1509 |/
1509 |/
1510 o 0:426bada5c675 A
1510 o 0:426bada5c675 A
1511
1511
1512 $ cd ..
1512 $ cd ..
1513
1513
1514 Rebase merge where extinct node has successor that is not an ancestor of
1514 Rebase merge where extinct node has successor that is not an ancestor of
1515 destination
1515 destination
1516
1516
1517 $ hg init extinct-with-succ-not-in-dest
1517 $ hg init extinct-with-succ-not-in-dest
1518 $ cd extinct-with-succ-not-in-dest
1518 $ cd extinct-with-succ-not-in-dest
1519
1519
1520 $ hg debugdrawdag <<EOF
1520 $ hg debugdrawdag <<EOF
1521 > E C # replace: C -> E
1521 > E C # replace: C -> E
1522 > | |
1522 > | |
1523 > D B
1523 > D B
1524 > |/
1524 > |/
1525 > A
1525 > A
1526 > EOF
1526 > EOF
1527
1527
1528 $ hg rebase -d D -s B
1528 $ hg rebase -d D -s B
1529 rebasing 1:112478962961 "B" (B)
1529 rebasing 1:112478962961 "B" (B)
1530 note: not rebasing 3:26805aba1e60 "C" (C) and its descendants as this would cause divergence
1530 note: not rebasing 3:26805aba1e60 "C" (C) and its descendants as this would cause divergence
1531
1531
1532 $ cd ..
1532 $ cd ..
1533
1533
1534 $ hg init p2-succ-in-dest-c
1534 $ hg init p2-succ-in-dest-c
1535 $ cd p2-succ-in-dest-c
1535 $ cd p2-succ-in-dest-c
1536
1536
1537 The scenario here was that B::D were developed on default. B was queued on
1537 The scenario here was that B::D were developed on default. B was queued on
1538 stable, but amended before being push to hg-committed. C was queued on default,
1538 stable, but amended before being push to hg-committed. C was queued on default,
1539 along with unrelated J.
1539 along with unrelated J.
1540
1540
1541 $ hg debugdrawdag <<EOF
1541 $ hg debugdrawdag <<EOF
1542 > J
1542 > J
1543 > |
1543 > |
1544 > F
1544 > F
1545 > |
1545 > |
1546 > E
1546 > E
1547 > | D
1547 > | D
1548 > | |
1548 > | |
1549 > | C # replace: C -> F
1549 > | C # replace: C -> F
1550 > | | H I # replace: B -> H -> I
1550 > | | H I # replace: B -> H -> I
1551 > | B |/
1551 > | B |/
1552 > |/ G
1552 > |/ G
1553 > A
1553 > A
1554 > EOF
1554 > EOF
1555 1 new orphan changesets
1555 1 new orphan changesets
1556
1556
1557 This strip seems to be the key to avoid an early divergence warning.
1557 This strip seems to be the key to avoid an early divergence warning.
1558 $ hg --config extensions.strip= --hidden strip -qr H
1558 $ hg --config extensions.strip= --hidden strip -qr H
1559 1 new orphan changesets
1559 1 new orphan changesets
1560
1560
1561 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1561 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1562 abort: this rebase will cause divergences from: 112478962961
1562 abort: this rebase will cause divergences from: 112478962961
1563 (to force the rebase please set experimental.evolution.allowdivergence=True)
1563 (to force the rebase please set experimental.evolution.allowdivergence=True)
1564 [255]
1564 [255]
1565
1565
1566 Rebase merge where both parents have successors in destination
1566 Rebase merge where both parents have successors in destination
1567
1567
1568 $ hg init p12-succ-in-dest
1568 $ hg init p12-succ-in-dest
1569 $ cd p12-succ-in-dest
1569 $ cd p12-succ-in-dest
1570 $ hg debugdrawdag <<'EOS'
1570 $ hg debugdrawdag <<'EOS'
1571 > E F
1571 > E F
1572 > /| /| # replace: A -> C
1572 > /| /| # replace: A -> C
1573 > A B C D # replace: B -> D
1573 > A B C D # replace: B -> D
1574 > | |
1574 > | |
1575 > X Y
1575 > X Y
1576 > EOS
1576 > EOS
1577 1 new orphan changesets
1577 1 new orphan changesets
1578 $ hg rebase -r A+B+E -d F
1578 $ hg rebase -r A+B+E -d F
1579 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1579 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1580 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1580 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1581 rebasing 7:dac5d11c5a7d "E" (E tip)
1581 rebasing 7:dac5d11c5a7d "E" (E tip)
1582 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1582 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1583 [255]
1583 [255]
1584 $ cd ..
1584 $ cd ..
1585
1585
1586 Rebase a non-clean merge. One parent has successor in destination, the other
1586 Rebase a non-clean merge. One parent has successor in destination, the other
1587 parent moves as requested.
1587 parent moves as requested.
1588
1588
1589 $ hg init p1-succ-p2-move
1589 $ hg init p1-succ-p2-move
1590 $ cd p1-succ-p2-move
1590 $ cd p1-succ-p2-move
1591 $ hg debugdrawdag <<'EOS'
1591 $ hg debugdrawdag <<'EOS'
1592 > D Z
1592 > D Z
1593 > /| | # replace: A -> C
1593 > /| | # replace: A -> C
1594 > A B C # D/D = D
1594 > A B C # D/D = D
1595 > EOS
1595 > EOS
1596 1 new orphan changesets
1596 1 new orphan changesets
1597 $ hg rebase -r A+B+D -d Z
1597 $ hg rebase -r A+B+D -d Z
1598 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1598 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1599 rebasing 1:fc2b737bb2e5 "B" (B)
1599 rebasing 1:fc2b737bb2e5 "B" (B)
1600 rebasing 3:b8ed089c80ad "D" (D)
1600 rebasing 3:b8ed089c80ad "D" (D)
1601
1601
1602 $ rm .hg/localtags
1602 $ rm .hg/localtags
1603 $ hg log -G
1603 $ hg log -G
1604 o 6:e4f78693cc88 D
1604 o 6:e4f78693cc88 D
1605 |
1605 |
1606 o 5:76840d832e98 B
1606 o 5:76840d832e98 B
1607 |
1607 |
1608 o 4:50e41c1f3950 Z
1608 o 4:50e41c1f3950 Z
1609 |
1609 |
1610 o 2:96cc3511f894 C
1610 o 2:96cc3511f894 C
1611
1611
1612 $ hg files -r tip
1612 $ hg files -r tip
1613 B
1613 B
1614 C
1614 C
1615 D
1615 D
1616 Z
1616 Z
1617
1617
1618 $ cd ..
1618 $ cd ..
1619
1619
1620 $ hg init p1-move-p2-succ
1620 $ hg init p1-move-p2-succ
1621 $ cd p1-move-p2-succ
1621 $ cd p1-move-p2-succ
1622 $ hg debugdrawdag <<'EOS'
1622 $ hg debugdrawdag <<'EOS'
1623 > D Z
1623 > D Z
1624 > /| | # replace: B -> C
1624 > /| | # replace: B -> C
1625 > A B C # D/D = D
1625 > A B C # D/D = D
1626 > EOS
1626 > EOS
1627 1 new orphan changesets
1627 1 new orphan changesets
1628 $ hg rebase -r B+A+D -d Z
1628 $ hg rebase -r B+A+D -d Z
1629 rebasing 0:426bada5c675 "A" (A)
1629 rebasing 0:426bada5c675 "A" (A)
1630 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1630 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1631 rebasing 3:b8ed089c80ad "D" (D)
1631 rebasing 3:b8ed089c80ad "D" (D)
1632
1632
1633 $ rm .hg/localtags
1633 $ rm .hg/localtags
1634 $ hg log -G
1634 $ hg log -G
1635 o 6:1b355ed94d82 D
1635 o 6:1b355ed94d82 D
1636 |
1636 |
1637 o 5:a81a74d764a6 A
1637 o 5:a81a74d764a6 A
1638 |
1638 |
1639 o 4:50e41c1f3950 Z
1639 o 4:50e41c1f3950 Z
1640 |
1640 |
1641 o 2:96cc3511f894 C
1641 o 2:96cc3511f894 C
1642
1642
1643 $ hg files -r tip
1643 $ hg files -r tip
1644 A
1644 A
1645 C
1645 C
1646 D
1646 D
1647 Z
1647 Z
1648
1648
1649 $ cd ..
1649 $ cd ..
1650
1650
1651 Test that bookmark is moved and working dir is updated when all changesets have
1651 Test that bookmark is moved and working dir is updated when all changesets have
1652 equivalents in destination
1652 equivalents in destination
1653 $ hg init rbsrepo && cd rbsrepo
1653 $ hg init rbsrepo && cd rbsrepo
1654 $ echo "[experimental]" > .hg/hgrc
1654 $ echo "[experimental]" > .hg/hgrc
1655 $ echo "evolution=true" >> .hg/hgrc
1655 $ echo "evolution=true" >> .hg/hgrc
1656 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1656 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1657 $ echo root > root && hg ci -Am root
1657 $ echo root > root && hg ci -Am root
1658 adding root
1658 adding root
1659 $ echo a > a && hg ci -Am a
1659 $ echo a > a && hg ci -Am a
1660 adding a
1660 adding a
1661 $ hg up 0
1661 $ hg up 0
1662 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1662 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1663 $ echo b > b && hg ci -Am b
1663 $ echo b > b && hg ci -Am b
1664 adding b
1664 adding b
1665 created new head
1665 created new head
1666 $ hg rebase -r 2 -d 1
1666 $ hg rebase -r 2 -d 1
1667 rebasing 2:1e9a3c00cbe9 "b" (tip)
1667 rebasing 2:1e9a3c00cbe9 "b" (tip)
1668 $ hg log -r . # working dir is at rev 3 (successor of 2)
1668 $ hg log -r . # working dir is at rev 3 (successor of 2)
1669 3:be1832deae9a b (no-eol)
1669 3:be1832deae9a b (no-eol)
1670 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1670 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1671 bookmarking hidden changeset 1e9a3c00cbe9
1671 bookmarking hidden changeset 1e9a3c00cbe9
1672 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1672 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1673 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1673 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1674 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1674 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1675 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1675 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1676 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1676 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1677 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1677 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1678 Check that working directory and bookmark was updated to rev 3 although rev 2
1678 Check that working directory and bookmark was updated to rev 3 although rev 2
1679 was skipped
1679 was skipped
1680 $ hg log -r .
1680 $ hg log -r .
1681 3:be1832deae9a b (no-eol)
1681 3:be1832deae9a b (no-eol)
1682 $ hg bookmarks
1682 $ hg bookmarks
1683 mybook 3:be1832deae9a
1683 mybook 3:be1832deae9a
1684 $ hg debugobsolete --rev tip
1684 $ hg debugobsolete --rev tip
1685 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1685 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1686
1686
1687 Obsoleted working parent and bookmark could be moved if an ancestor of working
1687 Obsoleted working parent and bookmark could be moved if an ancestor of working
1688 parent gets moved:
1688 parent gets moved:
1689
1689
1690 $ hg init $TESTTMP/ancestor-wd-move
1690 $ hg init $TESTTMP/ancestor-wd-move
1691 $ cd $TESTTMP/ancestor-wd-move
1691 $ cd $TESTTMP/ancestor-wd-move
1692 $ hg debugdrawdag <<'EOS'
1692 $ hg debugdrawdag <<'EOS'
1693 > E D1 # rebase: D1 -> D2
1693 > E D1 # rebase: D1 -> D2
1694 > | |
1694 > | |
1695 > | C
1695 > | C
1696 > D2 |
1696 > D2 |
1697 > | B
1697 > | B
1698 > |/
1698 > |/
1699 > A
1699 > A
1700 > EOS
1700 > EOS
1701 $ hg update D1 -q
1701 $ hg update D1 -q
1702 $ hg bookmark book -i
1702 $ hg bookmark book -i
1703 $ hg rebase -r B+D1 -d E
1703 $ hg rebase -r B+D1 -d E
1704 rebasing 1:112478962961 "B" (B)
1704 rebasing 1:112478962961 "B" (B)
1705 note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2)
1705 note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2)
1706 1 new orphan changesets
1706 1 new orphan changesets
1707 $ hg log -G -T '{desc} {bookmarks}'
1707 $ hg log -G -T '{desc} {bookmarks}'
1708 @ B book
1708 @ B book
1709 |
1709 |
1710 | x D1
1710 | x D1
1711 | |
1711 | |
1712 o | E
1712 o | E
1713 | |
1713 | |
1714 | * C
1714 | * C
1715 | |
1715 | |
1716 o | D2
1716 o | D2
1717 | |
1717 | |
1718 | x B
1718 | x B
1719 |/
1719 |/
1720 o A
1720 o A
1721
1721
1722 Rebasing a merge with one of its parent having a hidden successor
1722 Rebasing a merge with one of its parent having a hidden successor
1723
1723
1724 $ hg init $TESTTMP/merge-p1-hidden-successor
1724 $ hg init $TESTTMP/merge-p1-hidden-successor
1725 $ cd $TESTTMP/merge-p1-hidden-successor
1725 $ cd $TESTTMP/merge-p1-hidden-successor
1726
1726
1727 $ hg debugdrawdag <<'EOS'
1727 $ hg debugdrawdag <<'EOS'
1728 > E
1728 > E
1729 > |
1729 > |
1730 > B3 B2 # amend: B1 -> B2 -> B3
1730 > B3 B2 # amend: B1 -> B2 -> B3
1731 > |/ # B2 is hidden
1731 > |/ # B2 is hidden
1732 > | D
1732 > | D
1733 > | |\
1733 > | |\
1734 > | B1 C
1734 > | B1 C
1735 > |/
1735 > |/
1736 > A
1736 > A
1737 > EOS
1737 > EOS
1738 1 new orphan changesets
1738 1 new orphan changesets
1739
1739
1740 $ eval `hg tags -T '{tag}={node}\n'`
1740 $ eval `hg tags -T '{tag}={node}\n'`
1741 $ rm .hg/localtags
1741 $ rm .hg/localtags
1742
1742
1743 $ hg rebase -r $D -d $E
1743 $ hg rebase -r $D -d $E
1744 rebasing 5:9e62094e4d94 "D"
1744 rebasing 5:9e62094e4d94 "D"
1745
1745
1746 $ hg log -G
1746 $ hg log -G
1747 o 7:a699d059adcf D
1747 o 7:a699d059adcf D
1748 |\
1748 |\
1749 | o 6:ecc93090a95c E
1749 | o 6:ecc93090a95c E
1750 | |
1750 | |
1751 | o 4:0dc878468a23 B3
1751 | o 4:0dc878468a23 B3
1752 | |
1752 | |
1753 o | 1:96cc3511f894 C
1753 o | 1:96cc3511f894 C
1754 /
1754 /
1755 o 0:426bada5c675 A
1755 o 0:426bada5c675 A
1756
1756
1757 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1757 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1758 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1758 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1759
1759
1760 $ hg init $TESTTMP/hidden-state1
1760 $ hg init $TESTTMP/hidden-state1
1761 $ cd $TESTTMP/hidden-state1
1761 $ cd $TESTTMP/hidden-state1
1762 $ cat >> .hg/hgrc <<EOF
1762 $ cat >> .hg/hgrc <<EOF
1763 > [experimental]
1763 > [experimental]
1764 > rebaseskipobsolete=0
1764 > rebaseskipobsolete=0
1765 > EOF
1765 > EOF
1766
1766
1767 $ hg debugdrawdag <<'EOS'
1767 $ hg debugdrawdag <<'EOS'
1768 > C
1768 > C
1769 > |
1769 > |
1770 > D B # prune: B, C
1770 > D B # prune: B, C
1771 > |/ # B/D=B
1771 > |/ # B/D=B
1772 > A
1772 > A
1773 > EOS
1773 > EOS
1774
1774
1775 $ eval `hg tags -T '{tag}={node}\n'`
1775 $ eval `hg tags -T '{tag}={node}\n'`
1776 $ rm .hg/localtags
1776 $ rm .hg/localtags
1777
1777
1778 $ hg update -q $C --hidden
1778 $ hg update -q $C --hidden
1779 updated to hidden changeset 7829726be4dc
1779 updated to hidden changeset 7829726be4dc
1780 (hidden revision '7829726be4dc' is pruned)
1780 (hidden revision '7829726be4dc' is pruned)
1781 $ hg rebase -s $B -d $D
1781 $ hg rebase -s $B -d $D
1782 rebasing 1:2ec65233581b "B"
1782 rebasing 1:2ec65233581b "B"
1783 merging D
1783 merging D
1784 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1784 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1785 unresolved conflicts (see hg resolve, then hg rebase --continue)
1785 unresolved conflicts (see hg resolve, then hg rebase --continue)
1786 [1]
1786 [1]
1787
1787
1788 $ cp -R . $TESTTMP/hidden-state2
1788 $ cp -R . $TESTTMP/hidden-state2
1789
1789
1790 $ hg log -G
1790 $ hg log -G
1791 @ 2:b18e25de2cf5 D
1791 @ 2:b18e25de2cf5 D
1792 |
1792 |
1793 | @ 1:2ec65233581b B (pruned using prune)
1793 | @ 1:2ec65233581b B (pruned using prune)
1794 |/
1794 |/
1795 o 0:426bada5c675 A
1795 o 0:426bada5c675 A
1796
1796
1797 $ hg summary
1797 $ hg summary
1798 parent: 2:b18e25de2cf5 tip
1798 parent: 2:b18e25de2cf5 tip
1799 D
1799 D
1800 parent: 1:2ec65233581b (obsolete)
1800 parent: 1:2ec65233581b (obsolete)
1801 B
1801 B
1802 branch: default
1802 branch: default
1803 commit: 2 modified, 1 unknown, 1 unresolved (merge)
1803 commit: 2 modified, 1 unknown, 1 unresolved (merge)
1804 update: (current)
1804 update: (current)
1805 phases: 3 draft
1805 phases: 3 draft
1806 rebase: 0 rebased, 2 remaining (rebase --continue)
1806 rebase: 0 rebased, 2 remaining (rebase --continue)
1807
1807
1808 $ hg rebase --abort
1808 $ hg rebase --abort
1809 rebase aborted
1809 rebase aborted
1810
1810
1811 Also test --continue for the above case
1811 Also test --continue for the above case
1812
1812
1813 $ cd $TESTTMP/hidden-state2
1813 $ cd $TESTTMP/hidden-state2
1814 $ hg resolve -m
1814 $ hg resolve -m
1815 (no more unresolved files)
1815 (no more unresolved files)
1816 continue: hg rebase --continue
1816 continue: hg rebase --continue
1817 $ hg rebase --continue
1817 $ hg rebase --continue
1818 rebasing 1:2ec65233581b "B"
1818 rebasing 1:2ec65233581b "B"
1819 rebasing 3:7829726be4dc "C" (tip)
1819 rebasing 3:7829726be4dc "C" (tip)
1820 $ hg log -G
1820 $ hg log -G
1821 @ 5:1964d5d5b547 C
1821 @ 5:1964d5d5b547 C
1822 |
1822 |
1823 o 4:68deb90c12a2 B
1823 o 4:68deb90c12a2 B
1824 |
1824 |
1825 o 2:b18e25de2cf5 D
1825 o 2:b18e25de2cf5 D
1826 |
1826 |
1827 o 0:426bada5c675 A
1827 o 0:426bada5c675 A
1828
1828
1829 ====================
1829 ====================
1830 Test --stop option |
1830 Test --stop option |
1831 ====================
1831 ====================
1832 $ cd ..
1832 $ cd ..
1833 $ hg init rbstop
1833 $ hg init rbstop
1834 $ cd rbstop
1834 $ cd rbstop
1835 $ echo a>a
1835 $ echo a>a
1836 $ hg ci -Aqma
1836 $ hg ci -Aqma
1837 $ echo b>b
1837 $ echo b>b
1838 $ hg ci -Aqmb
1838 $ hg ci -Aqmb
1839 $ echo c>c
1839 $ echo c>c
1840 $ hg ci -Aqmc
1840 $ hg ci -Aqmc
1841 $ echo d>d
1841 $ echo d>d
1842 $ hg ci -Aqmd
1842 $ hg ci -Aqmd
1843 $ hg up 0 -q
1843 $ hg up 0 -q
1844 $ echo f>f
1844 $ echo f>f
1845 $ hg ci -Aqmf
1845 $ hg ci -Aqmf
1846 $ echo D>d
1846 $ echo D>d
1847 $ hg ci -Aqm "conflict with d"
1847 $ hg ci -Aqm "conflict with d"
1848 $ hg up 3 -q
1848 $ hg up 3 -q
1849 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1849 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1850 o 5:00bfc9898aeb test
1850 o 5:00bfc9898aeb test
1851 | conflict with d
1851 | conflict with d
1852 |
1852 |
1853 o 4:dafd40200f93 test
1853 o 4:dafd40200f93 test
1854 | f
1854 | f
1855 |
1855 |
1856 | @ 3:055a42cdd887 test
1856 | @ 3:055a42cdd887 test
1857 | | d
1857 | | d
1858 | |
1858 | |
1859 | o 2:177f92b77385 test
1859 | o 2:177f92b77385 test
1860 | | c
1860 | | c
1861 | |
1861 | |
1862 | o 1:d2ae7f538514 test
1862 | o 1:d2ae7f538514 test
1863 |/ b
1863 |/ b
1864 |
1864 |
1865 o 0:cb9a9f314b8b test
1865 o 0:cb9a9f314b8b test
1866 a
1866 a
1867
1867
1868 $ hg rebase -s 1 -d 5
1868 $ hg rebase -s 1 -d 5
1869 rebasing 1:d2ae7f538514 "b"
1869 rebasing 1:d2ae7f538514 "b"
1870 rebasing 2:177f92b77385 "c"
1870 rebasing 2:177f92b77385 "c"
1871 rebasing 3:055a42cdd887 "d"
1871 rebasing 3:055a42cdd887 "d"
1872 merging d
1872 merging d
1873 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1873 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1874 unresolved conflicts (see hg resolve, then hg rebase --continue)
1874 unresolved conflicts (see hg resolve, then hg rebase --continue)
1875 [1]
1875 [1]
1876 $ hg rebase --stop
1876 $ hg rebase --stop
1877 1 new orphan changesets
1877 1 new orphan changesets
1878 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1878 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1879 o 7:7fffad344617 test
1879 o 7:7fffad344617 test
1880 | c
1880 | c
1881 |
1881 |
1882 o 6:b15528633407 test
1882 o 6:b15528633407 test
1883 | b
1883 | b
1884 |
1884 |
1885 o 5:00bfc9898aeb test
1885 o 5:00bfc9898aeb test
1886 | conflict with d
1886 | conflict with d
1887 |
1887 |
1888 o 4:dafd40200f93 test
1888 o 4:dafd40200f93 test
1889 | f
1889 | f
1890 |
1890 |
1891 | @ 3:055a42cdd887 test
1891 | @ 3:055a42cdd887 test
1892 | | d
1892 | | d
1893 | |
1893 | |
1894 | x 2:177f92b77385 test
1894 | x 2:177f92b77385 test
1895 | | c
1895 | | c
1896 | |
1896 | |
1897 | x 1:d2ae7f538514 test
1897 | x 1:d2ae7f538514 test
1898 |/ b
1898 |/ b
1899 |
1899 |
1900 o 0:cb9a9f314b8b test
1900 o 0:cb9a9f314b8b test
1901 a
1901 a
1902
1902
1903 Test it aborts if unstable csets is not allowed:
1903 Test it aborts if unstable csets is not allowed:
1904 ===============================================
1904 ===============================================
1905 $ cat >> $HGRCPATH << EOF
1905 $ cat >> $HGRCPATH << EOF
1906 > [experimental]
1906 > [experimental]
1907 > evolution.allowunstable=False
1907 > evolution.allowunstable=False
1908 > EOF
1908 > EOF
1909
1909
1910 $ hg strip 6 --no-backup -q
1910 $ hg strip 6 --no-backup -q
1911 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1911 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1912 o 5:00bfc9898aeb test
1912 o 5:00bfc9898aeb test
1913 | conflict with d
1913 | conflict with d
1914 |
1914 |
1915 o 4:dafd40200f93 test
1915 o 4:dafd40200f93 test
1916 | f
1916 | f
1917 |
1917 |
1918 | @ 3:055a42cdd887 test
1918 | @ 3:055a42cdd887 test
1919 | | d
1919 | | d
1920 | |
1920 | |
1921 | o 2:177f92b77385 test
1921 | o 2:177f92b77385 test
1922 | | c
1922 | | c
1923 | |
1923 | |
1924 | o 1:d2ae7f538514 test
1924 | o 1:d2ae7f538514 test
1925 |/ b
1925 |/ b
1926 |
1926 |
1927 o 0:cb9a9f314b8b test
1927 o 0:cb9a9f314b8b test
1928 a
1928 a
1929
1929
1930 $ hg rebase -s 1 -d 5
1930 $ hg rebase -s 1 -d 5
1931 rebasing 1:d2ae7f538514 "b"
1931 rebasing 1:d2ae7f538514 "b"
1932 rebasing 2:177f92b77385 "c"
1932 rebasing 2:177f92b77385 "c"
1933 rebasing 3:055a42cdd887 "d"
1933 rebasing 3:055a42cdd887 "d"
1934 merging d
1934 merging d
1935 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1935 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1936 unresolved conflicts (see hg resolve, then hg rebase --continue)
1936 unresolved conflicts (see hg resolve, then hg rebase --continue)
1937 [1]
1937 [1]
1938 $ hg rebase --stop
1938 $ hg rebase --stop
1939 abort: cannot remove original changesets with unrebased descendants
1939 abort: cannot remove original changesets with unrebased descendants
1940 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1940 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1941 [255]
1941 [255]
1942 $ hg rebase --abort
1942 $ hg rebase --abort
1943 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1943 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1944 rebase aborted
1944 rebase aborted
1945
1945
1946 Test --stop when --keep is passed:
1946 Test --stop when --keep is passed:
1947 ==================================
1947 ==================================
1948 $ hg rebase -s 1 -d 5 --keep
1948 $ hg rebase -s 1 -d 5 --keep
1949 rebasing 1:d2ae7f538514 "b"
1949 rebasing 1:d2ae7f538514 "b"
1950 rebasing 2:177f92b77385 "c"
1950 rebasing 2:177f92b77385 "c"
1951 rebasing 3:055a42cdd887 "d"
1951 rebasing 3:055a42cdd887 "d"
1952 merging d
1952 merging d
1953 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1953 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1954 unresolved conflicts (see hg resolve, then hg rebase --continue)
1954 unresolved conflicts (see hg resolve, then hg rebase --continue)
1955 [1]
1955 [1]
1956 $ hg rebase --stop
1956 $ hg rebase --stop
1957 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1957 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1958 o 7:7fffad344617 test
1958 o 7:7fffad344617 test
1959 | c
1959 | c
1960 |
1960 |
1961 o 6:b15528633407 test
1961 o 6:b15528633407 test
1962 | b
1962 | b
1963 |
1963 |
1964 o 5:00bfc9898aeb test
1964 o 5:00bfc9898aeb test
1965 | conflict with d
1965 | conflict with d
1966 |
1966 |
1967 o 4:dafd40200f93 test
1967 o 4:dafd40200f93 test
1968 | f
1968 | f
1969 |
1969 |
1970 | @ 3:055a42cdd887 test
1970 | @ 3:055a42cdd887 test
1971 | | d
1971 | | d
1972 | |
1972 | |
1973 | o 2:177f92b77385 test
1973 | o 2:177f92b77385 test
1974 | | c
1974 | | c
1975 | |
1975 | |
1976 | o 1:d2ae7f538514 test
1976 | o 1:d2ae7f538514 test
1977 |/ b
1977 |/ b
1978 |
1978 |
1979 o 0:cb9a9f314b8b test
1979 o 0:cb9a9f314b8b test
1980 a
1980 a
1981
1981
1982 Test --stop aborts when --collapse was passed:
1982 Test --stop aborts when --collapse was passed:
1983 =============================================
1983 =============================================
1984 $ cat >> $HGRCPATH << EOF
1984 $ cat >> $HGRCPATH << EOF
1985 > [experimental]
1985 > [experimental]
1986 > evolution.allowunstable=True
1986 > evolution.allowunstable=True
1987 > EOF
1987 > EOF
1988
1988
1989 $ hg strip 6
1989 $ hg strip 6
1990 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1990 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1991 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1991 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1992 o 5:00bfc9898aeb test
1992 o 5:00bfc9898aeb test
1993 | conflict with d
1993 | conflict with d
1994 |
1994 |
1995 o 4:dafd40200f93 test
1995 o 4:dafd40200f93 test
1996 | f
1996 | f
1997 |
1997 |
1998 | @ 3:055a42cdd887 test
1998 | @ 3:055a42cdd887 test
1999 | | d
1999 | | d
2000 | |
2000 | |
2001 | o 2:177f92b77385 test
2001 | o 2:177f92b77385 test
2002 | | c
2002 | | c
2003 | |
2003 | |
2004 | o 1:d2ae7f538514 test
2004 | o 1:d2ae7f538514 test
2005 |/ b
2005 |/ b
2006 |
2006 |
2007 o 0:cb9a9f314b8b test
2007 o 0:cb9a9f314b8b test
2008 a
2008 a
2009
2009
2010 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2010 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2011 rebasing 1:d2ae7f538514 "b"
2011 rebasing 1:d2ae7f538514 "b"
2012 rebasing 2:177f92b77385 "c"
2012 rebasing 2:177f92b77385 "c"
2013 rebasing 3:055a42cdd887 "d"
2013 rebasing 3:055a42cdd887 "d"
2014 merging d
2014 merging d
2015 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2015 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2016 unresolved conflicts (see hg resolve, then hg rebase --continue)
2016 unresolved conflicts (see hg resolve, then hg rebase --continue)
2017 [1]
2017 [1]
2018 $ hg rebase --stop
2018 $ hg rebase --stop
2019 abort: cannot stop in --collapse session
2019 abort: cannot stop in --collapse session
2020 [255]
2020 [255]
2021 $ hg rebase --abort
2021 $ hg rebase --abort
2022 rebase aborted
2022 rebase aborted
2023 $ hg diff
2023 $ hg diff
2024 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2024 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2025 o 5:00bfc9898aeb test
2025 o 5:00bfc9898aeb test
2026 | conflict with d
2026 | conflict with d
2027 |
2027 |
2028 o 4:dafd40200f93 test
2028 o 4:dafd40200f93 test
2029 | f
2029 | f
2030 |
2030 |
2031 | @ 3:055a42cdd887 test
2031 | @ 3:055a42cdd887 test
2032 | | d
2032 | | d
2033 | |
2033 | |
2034 | o 2:177f92b77385 test
2034 | o 2:177f92b77385 test
2035 | | c
2035 | | c
2036 | |
2036 | |
2037 | o 1:d2ae7f538514 test
2037 | o 1:d2ae7f538514 test
2038 |/ b
2038 |/ b
2039 |
2039 |
2040 o 0:cb9a9f314b8b test
2040 o 0:cb9a9f314b8b test
2041 a
2041 a
2042
2042
2043 Test --stop raise errors with conflicting options:
2043 Test --stop raise errors with conflicting options:
2044 =================================================
2044 =================================================
2045 $ hg rebase -s 3 -d 5
2045 $ hg rebase -s 3 -d 5
2046 rebasing 3:055a42cdd887 "d"
2046 rebasing 3:055a42cdd887 "d"
2047 merging d
2047 merging d
2048 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2048 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2049 unresolved conflicts (see hg resolve, then hg rebase --continue)
2049 unresolved conflicts (see hg resolve, then hg rebase --continue)
2050 [1]
2050 [1]
2051 $ hg rebase --stop --dry-run
2051 $ hg rebase --stop --dry-run
2052 abort: cannot specify both --dry-run and --stop
2052 abort: cannot specify both --dry-run and --stop
2053 [255]
2053 [255]
2054
2054
2055 $ hg rebase -s 3 -d 5
2055 $ hg rebase -s 3 -d 5
2056 abort: rebase in progress
2056 abort: rebase in progress
2057 (use 'hg rebase --continue' or 'hg rebase --abort')
2057 (use 'hg rebase --continue' or 'hg rebase --abort')
2058 [255]
2058 [255]
2059 $ hg rebase --stop --continue
2059 $ hg rebase --stop --continue
2060 abort: cannot use --stop with --continue
2060 abort: cannot use --stop with --continue
2061 [255]
2061 [255]
2062
2062
2063 Test --stop moves bookmarks of original revisions to new rebased nodes:
2063 Test --stop moves bookmarks of original revisions to new rebased nodes:
2064 ======================================================================
2064 ======================================================================
2065 $ cd ..
2065 $ cd ..
2066 $ hg init repo
2066 $ hg init repo
2067 $ cd repo
2067 $ cd repo
2068
2068
2069 $ echo a > a
2069 $ echo a > a
2070 $ hg ci -Am A
2070 $ hg ci -Am A
2071 adding a
2071 adding a
2072
2072
2073 $ echo b > b
2073 $ echo b > b
2074 $ hg ci -Am B
2074 $ hg ci -Am B
2075 adding b
2075 adding b
2076 $ hg book X
2076 $ hg book X
2077 $ hg book Y
2077 $ hg book Y
2078
2078
2079 $ echo c > c
2079 $ echo c > c
2080 $ hg ci -Am C
2080 $ hg ci -Am C
2081 adding c
2081 adding c
2082 $ hg book Z
2082 $ hg book Z
2083
2083
2084 $ echo d > d
2084 $ echo d > d
2085 $ hg ci -Am D
2085 $ hg ci -Am D
2086 adding d
2086 adding d
2087
2087
2088 $ hg up 0 -q
2088 $ hg up 0 -q
2089 $ echo e > e
2089 $ echo e > e
2090 $ hg ci -Am E
2090 $ hg ci -Am E
2091 adding e
2091 adding e
2092 created new head
2092 created new head
2093
2093
2094 $ echo doubt > d
2094 $ echo doubt > d
2095 $ hg ci -Am "conflict with d"
2095 $ hg ci -Am "conflict with d"
2096 adding d
2096 adding d
2097
2097
2098 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2098 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2099 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2099 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2100 |
2100 |
2101 o 4: 9c1e55f411b6 'E' bookmarks:
2101 o 4: 9c1e55f411b6 'E' bookmarks:
2102 |
2102 |
2103 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2103 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2104 | |
2104 | |
2105 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2105 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2106 | |
2106 | |
2107 | o 1: 6c81ed0049f8 'B' bookmarks: X
2107 | o 1: 6c81ed0049f8 'B' bookmarks: X
2108 |/
2108 |/
2109 o 0: 1994f17a630e 'A' bookmarks:
2109 o 0: 1994f17a630e 'A' bookmarks:
2110
2110
2111 $ hg rebase -s 1 -d 5
2111 $ hg rebase -s 1 -d 5
2112 rebasing 1:6c81ed0049f8 "B" (X)
2112 rebasing 1:6c81ed0049f8 "B" (X)
2113 rebasing 2:49cb3485fa0c "C" (Y)
2113 rebasing 2:49cb3485fa0c "C" (Y)
2114 rebasing 3:67a385d4e6f2 "D" (Z)
2114 rebasing 3:67a385d4e6f2 "D" (Z)
2115 merging d
2115 merging d
2116 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2116 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2117 unresolved conflicts (see hg resolve, then hg rebase --continue)
2117 unresolved conflicts (see hg resolve, then hg rebase --continue)
2118 [1]
2118 [1]
2119 $ hg rebase --stop
2119 $ hg rebase --stop
2120 1 new orphan changesets
2120 1 new orphan changesets
2121 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2121 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2122 o 7: 9c86c650b686 'C' bookmarks: Y
2122 o 7: 9c86c650b686 'C' bookmarks: Y
2123 |
2123 |
2124 o 6: 9b87b54e5fd8 'B' bookmarks: X
2124 o 6: 9b87b54e5fd8 'B' bookmarks: X
2125 |
2125 |
2126 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2126 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2127 |
2127 |
2128 o 4: 9c1e55f411b6 'E' bookmarks:
2128 o 4: 9c1e55f411b6 'E' bookmarks:
2129 |
2129 |
2130 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2130 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2131 | |
2131 | |
2132 | x 2: 49cb3485fa0c 'C' bookmarks:
2132 | x 2: 49cb3485fa0c 'C' bookmarks:
2133 | |
2133 | |
2134 | x 1: 6c81ed0049f8 'B' bookmarks:
2134 | x 1: 6c81ed0049f8 'B' bookmarks:
2135 |/
2135 |/
2136 o 0: 1994f17a630e 'A' bookmarks:
2136 o 0: 1994f17a630e 'A' bookmarks:
2137
2137
@@ -1,521 +1,521 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 >
4 >
5 > [phases]
5 > [phases]
6 > publish=False
6 > publish=False
7 >
7 >
8 > [alias]
8 > [alias]
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
9 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
10 > EOF
10 > EOF
11
11
12
12
13 $ hg init a
13 $ hg init a
14 $ cd a
14 $ cd a
15 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
15 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
16 adding changesets
16 adding changesets
17 adding manifests
17 adding manifests
18 adding file changes
18 adding file changes
19 added 8 changesets with 7 changes to 7 files (+2 heads)
19 added 8 changesets with 7 changes to 7 files (+2 heads)
20 new changesets cd010b8cd998:02de42196ebe (8 drafts)
20 new changesets cd010b8cd998:02de42196ebe (8 drafts)
21 (run 'hg heads' to see heads, 'hg merge' to merge)
21 (run 'hg heads' to see heads, 'hg merge' to merge)
22 $ hg up tip
22 $ hg up tip
23 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
24
24
25 $ echo I > I
25 $ echo I > I
26 $ hg ci -AmI
26 $ hg ci -AmI
27 adding I
27 adding I
28
28
29 $ hg tglog
29 $ hg tglog
30 @ 8: e7ec4e813ba6 'I'
30 @ 8: e7ec4e813ba6 'I'
31 |
31 |
32 o 7: 02de42196ebe 'H'
32 o 7: 02de42196ebe 'H'
33 |
33 |
34 | o 6: eea13746799a 'G'
34 | o 6: eea13746799a 'G'
35 |/|
35 |/|
36 o | 5: 24b6387c8c8c 'F'
36 o | 5: 24b6387c8c8c 'F'
37 | |
37 | |
38 | o 4: 9520eea781bc 'E'
38 | o 4: 9520eea781bc 'E'
39 |/
39 |/
40 | o 3: 32af7686d403 'D'
40 | o 3: 32af7686d403 'D'
41 | |
41 | |
42 | o 2: 5fddd98957c8 'C'
42 | o 2: 5fddd98957c8 'C'
43 | |
43 | |
44 | o 1: 42ccdea3bb16 'B'
44 | o 1: 42ccdea3bb16 'B'
45 |/
45 |/
46 o 0: cd010b8cd998 'A'
46 o 0: cd010b8cd998 'A'
47
47
48 $ cd ..
48 $ cd ..
49
49
50 Version with only two heads (to allow default destination to work)
50 Version with only two heads (to allow default destination to work)
51
51
52 $ hg clone -q -u . a a2heads -r 3 -r 8
52 $ hg clone -q -u . a a2heads -r 3 -r 8
53
53
54 These fail:
54 These fail:
55
55
56 $ hg clone -q -u . a a0
56 $ hg clone -q -u . a a0
57 $ cd a0
57 $ cd a0
58
58
59 $ hg rebase -s 8 -d 7
59 $ hg rebase -s 8 -d 7
60 nothing to rebase
60 nothing to rebase
61 [1]
61 [1]
62
62
63 $ hg rebase --continue --abort
63 $ hg rebase --continue --abort
64 abort: cannot use --abort with --continue
64 abort: cannot use --abort with --continue
65 [255]
65 [255]
66
66
67 $ hg rebase --continue --collapse
67 $ hg rebase --continue --collapse
68 abort: cannot use collapse with continue or abort
68 abort: cannot use collapse with continue or abort
69 [255]
69 [255]
70
70
71 $ hg rebase --continue --dest 4
71 $ hg rebase --continue --dest 4
72 abort: abort and continue do not allow specifying revisions
72 abort: abort and continue do not allow specifying revisions
73 [255]
73 [255]
74
74
75 $ hg rebase --base 5 --source 4
75 $ hg rebase --base 5 --source 4
76 abort: cannot specify both a source and a base
76 abort: cannot specify both a source and a base
77 [255]
77 [255]
78
78
79 $ hg rebase --rev 5 --source 4
79 $ hg rebase --rev 5 --source 4
80 abort: cannot specify both a revision and a source
80 abort: cannot specify both a revision and a source
81 [255]
81 [255]
82 $ hg rebase --base 5 --rev 4
82 $ hg rebase --base 5 --rev 4
83 abort: cannot specify both a revision and a base
83 abort: cannot specify both a revision and a base
84 [255]
84 [255]
85
85
86 $ hg rebase --base 6
86 $ hg rebase --base 6
87 abort: branch 'default' has 3 heads - please rebase to an explicit rev
87 abort: branch 'default' has 3 heads - please rebase to an explicit rev
88 (run 'hg heads .' to see heads)
88 (run 'hg heads .' to see heads)
89 [255]
89 [255]
90
90
91 $ hg rebase --rev '1 & !1' --dest 8
91 $ hg rebase --rev '1 & !1' --dest 8
92 empty "rev" revision set - nothing to rebase
92 empty "rev" revision set - nothing to rebase
93 [1]
93 [1]
94
94
95 $ hg rebase --source '1 & !1' --dest 8
95 $ hg rebase --source '1 & !1' --dest 8
96 empty "source" revision set - nothing to rebase
96 empty "source" revision set - nothing to rebase
97 [1]
97 [1]
98
98
99 $ hg rebase --base '1 & !1' --dest 8
99 $ hg rebase --base '1 & !1' --dest 8
100 empty "base" revision set - can't compute rebase set
100 empty "base" revision set - can't compute rebase set
101 [1]
101 [1]
102
102
103 $ hg rebase --dest 8
103 $ hg rebase --dest 8
104 nothing to rebase - working directory parent is also destination
104 nothing to rebase - working directory parent is also destination
105 [1]
105 [1]
106
106
107 $ hg rebase -b . --dest 8
107 $ hg rebase -b . --dest 8
108 nothing to rebase - e7ec4e813ba6 is both "base" and destination
108 nothing to rebase - e7ec4e813ba6 is both "base" and destination
109 [1]
109 [1]
110
110
111 $ hg up -q 7
111 $ hg up -q 7
112
112
113 $ hg rebase --dest 8 --traceback
113 $ hg rebase --dest 8 --traceback
114 nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6
114 nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6
115 [1]
115 [1]
116
116
117 $ hg rebase --dest 8 -b.
117 $ hg rebase --dest 8 -b.
118 nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6
118 nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6
119 [1]
119 [1]
120
120
121 $ hg rebase --dest '1 & !1'
121 $ hg rebase --dest '1 & !1'
122 abort: empty revision set
122 abort: empty revision set
123 [255]
123 [255]
124
124
125 These work:
125 These work:
126
126
127 Rebase with no arguments (from 3 onto 8):
127 Rebase with no arguments (from 3 onto 8):
128
128
129 $ cd ..
129 $ cd ..
130 $ hg clone -q -u . a2heads a1
130 $ hg clone -q -u . a2heads a1
131 $ cd a1
131 $ cd a1
132 $ hg up -q -C 3
132 $ hg up -q -C 3
133
133
134 $ hg rebase
134 $ hg rebase
135 rebasing 1:42ccdea3bb16 "B"
135 rebasing 1:42ccdea3bb16 "B"
136 rebasing 2:5fddd98957c8 "C"
136 rebasing 2:5fddd98957c8 "C"
137 rebasing 3:32af7686d403 "D"
137 rebasing 3:32af7686d403 "D"
138 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
138 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
139
139
140 $ hg tglog
140 $ hg tglog
141 @ 6: ed65089c18f8 'D'
141 @ 6: ed65089c18f8 'D'
142 |
142 |
143 o 5: 7621bf1a2f17 'C'
143 o 5: 7621bf1a2f17 'C'
144 |
144 |
145 o 4: 9430a62369c6 'B'
145 o 4: 9430a62369c6 'B'
146 |
146 |
147 o 3: e7ec4e813ba6 'I'
147 o 3: e7ec4e813ba6 'I'
148 |
148 |
149 o 2: 02de42196ebe 'H'
149 o 2: 02de42196ebe 'H'
150 |
150 |
151 o 1: 24b6387c8c8c 'F'
151 o 1: 24b6387c8c8c 'F'
152 |
152 |
153 o 0: cd010b8cd998 'A'
153 o 0: cd010b8cd998 'A'
154
154
155 Try to rollback after a rebase (fail):
155 Try to rollback after a rebase (fail):
156
156
157 $ hg rollback
157 $ hg rollback
158 no rollback information available
158 no rollback information available
159 [1]
159 [1]
160
160
161 $ cd ..
161 $ cd ..
162
162
163 Rebase with base == '.' => same as no arguments (from 3 onto 8):
163 Rebase with base == '.' => same as no arguments (from 3 onto 8):
164
164
165 $ hg clone -q -u 3 a2heads a2
165 $ hg clone -q -u 3 a2heads a2
166 $ cd a2
166 $ cd a2
167
167
168 $ hg rebase --base .
168 $ hg rebase --base .
169 rebasing 1:42ccdea3bb16 "B"
169 rebasing 1:42ccdea3bb16 "B"
170 rebasing 2:5fddd98957c8 "C"
170 rebasing 2:5fddd98957c8 "C"
171 rebasing 3:32af7686d403 "D"
171 rebasing 3:32af7686d403 "D"
172 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
172 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
173
173
174 $ hg tglog
174 $ hg tglog
175 @ 6: ed65089c18f8 'D'
175 @ 6: ed65089c18f8 'D'
176 |
176 |
177 o 5: 7621bf1a2f17 'C'
177 o 5: 7621bf1a2f17 'C'
178 |
178 |
179 o 4: 9430a62369c6 'B'
179 o 4: 9430a62369c6 'B'
180 |
180 |
181 o 3: e7ec4e813ba6 'I'
181 o 3: e7ec4e813ba6 'I'
182 |
182 |
183 o 2: 02de42196ebe 'H'
183 o 2: 02de42196ebe 'H'
184 |
184 |
185 o 1: 24b6387c8c8c 'F'
185 o 1: 24b6387c8c8c 'F'
186 |
186 |
187 o 0: cd010b8cd998 'A'
187 o 0: cd010b8cd998 'A'
188
188
189 $ cd ..
189 $ cd ..
190
190
191
191
192 Rebase with dest == branch(.) => same as no arguments (from 3 onto 8):
192 Rebase with dest == branch(.) => same as no arguments (from 3 onto 8):
193
193
194 $ hg clone -q -u 3 a a3
194 $ hg clone -q -u 3 a a3
195 $ cd a3
195 $ cd a3
196
196
197 $ hg rebase --dest 'branch(.)'
197 $ hg rebase --dest 'branch(.)'
198 rebasing 1:42ccdea3bb16 "B"
198 rebasing 1:42ccdea3bb16 "B"
199 rebasing 2:5fddd98957c8 "C"
199 rebasing 2:5fddd98957c8 "C"
200 rebasing 3:32af7686d403 "D"
200 rebasing 3:32af7686d403 "D"
201 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
201 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
202
202
203 $ hg tglog
203 $ hg tglog
204 @ 8: ed65089c18f8 'D'
204 @ 8: ed65089c18f8 'D'
205 |
205 |
206 o 7: 7621bf1a2f17 'C'
206 o 7: 7621bf1a2f17 'C'
207 |
207 |
208 o 6: 9430a62369c6 'B'
208 o 6: 9430a62369c6 'B'
209 |
209 |
210 o 5: e7ec4e813ba6 'I'
210 o 5: e7ec4e813ba6 'I'
211 |
211 |
212 o 4: 02de42196ebe 'H'
212 o 4: 02de42196ebe 'H'
213 |
213 |
214 | o 3: eea13746799a 'G'
214 | o 3: eea13746799a 'G'
215 |/|
215 |/|
216 o | 2: 24b6387c8c8c 'F'
216 o | 2: 24b6387c8c8c 'F'
217 | |
217 | |
218 | o 1: 9520eea781bc 'E'
218 | o 1: 9520eea781bc 'E'
219 |/
219 |/
220 o 0: cd010b8cd998 'A'
220 o 0: cd010b8cd998 'A'
221
221
222 $ cd ..
222 $ cd ..
223
223
224
224
225 Specify only source (from 2 onto 8):
225 Specify only source (from 2 onto 8):
226
226
227 $ hg clone -q -u . a2heads a4
227 $ hg clone -q -u . a2heads a4
228 $ cd a4
228 $ cd a4
229
229
230 $ hg rebase --source 'desc("C")'
230 $ hg rebase --source 'desc("C")'
231 rebasing 2:5fddd98957c8 "C"
231 rebasing 2:5fddd98957c8 "C"
232 rebasing 3:32af7686d403 "D"
232 rebasing 3:32af7686d403 "D"
233 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
233 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
234
234
235 $ hg tglog
235 $ hg tglog
236 o 6: 7726e9fd58f7 'D'
236 o 6: 7726e9fd58f7 'D'
237 |
237 |
238 o 5: 72c8333623d0 'C'
238 o 5: 72c8333623d0 'C'
239 |
239 |
240 @ 4: e7ec4e813ba6 'I'
240 @ 4: e7ec4e813ba6 'I'
241 |
241 |
242 o 3: 02de42196ebe 'H'
242 o 3: 02de42196ebe 'H'
243 |
243 |
244 o 2: 24b6387c8c8c 'F'
244 o 2: 24b6387c8c8c 'F'
245 |
245 |
246 | o 1: 42ccdea3bb16 'B'
246 | o 1: 42ccdea3bb16 'B'
247 |/
247 |/
248 o 0: cd010b8cd998 'A'
248 o 0: cd010b8cd998 'A'
249
249
250 $ cd ..
250 $ cd ..
251
251
252
252
253 Specify only dest (from 3 onto 6):
253 Specify only dest (from 3 onto 6):
254
254
255 $ hg clone -q -u 3 a a5
255 $ hg clone -q -u 3 a a5
256 $ cd a5
256 $ cd a5
257
257
258 $ hg rebase --dest 6
258 $ hg rebase --dest 6
259 rebasing 1:42ccdea3bb16 "B"
259 rebasing 1:42ccdea3bb16 "B"
260 rebasing 2:5fddd98957c8 "C"
260 rebasing 2:5fddd98957c8 "C"
261 rebasing 3:32af7686d403 "D"
261 rebasing 3:32af7686d403 "D"
262 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
262 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
263
263
264 $ hg tglog
264 $ hg tglog
265 @ 8: 8eeb3c33ad33 'D'
265 @ 8: 8eeb3c33ad33 'D'
266 |
266 |
267 o 7: 2327fea05063 'C'
267 o 7: 2327fea05063 'C'
268 |
268 |
269 o 6: e4e5be0395b2 'B'
269 o 6: e4e5be0395b2 'B'
270 |
270 |
271 | o 5: e7ec4e813ba6 'I'
271 | o 5: e7ec4e813ba6 'I'
272 | |
272 | |
273 | o 4: 02de42196ebe 'H'
273 | o 4: 02de42196ebe 'H'
274 | |
274 | |
275 o | 3: eea13746799a 'G'
275 o | 3: eea13746799a 'G'
276 |\|
276 |\|
277 | o 2: 24b6387c8c8c 'F'
277 | o 2: 24b6387c8c8c 'F'
278 | |
278 | |
279 o | 1: 9520eea781bc 'E'
279 o | 1: 9520eea781bc 'E'
280 |/
280 |/
281 o 0: cd010b8cd998 'A'
281 o 0: cd010b8cd998 'A'
282
282
283 $ cd ..
283 $ cd ..
284
284
285
285
286 Specify only base (from 1 onto 8):
286 Specify only base (from 1 onto 8):
287
287
288 $ hg clone -q -u . a2heads a6
288 $ hg clone -q -u . a2heads a6
289 $ cd a6
289 $ cd a6
290
290
291 $ hg rebase --base 'desc("D")'
291 $ hg rebase --base 'desc("D")'
292 rebasing 1:42ccdea3bb16 "B"
292 rebasing 1:42ccdea3bb16 "B"
293 rebasing 2:5fddd98957c8 "C"
293 rebasing 2:5fddd98957c8 "C"
294 rebasing 3:32af7686d403 "D"
294 rebasing 3:32af7686d403 "D"
295 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
295 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
296
296
297 $ hg tglog
297 $ hg tglog
298 o 6: ed65089c18f8 'D'
298 o 6: ed65089c18f8 'D'
299 |
299 |
300 o 5: 7621bf1a2f17 'C'
300 o 5: 7621bf1a2f17 'C'
301 |
301 |
302 o 4: 9430a62369c6 'B'
302 o 4: 9430a62369c6 'B'
303 |
303 |
304 @ 3: e7ec4e813ba6 'I'
304 @ 3: e7ec4e813ba6 'I'
305 |
305 |
306 o 2: 02de42196ebe 'H'
306 o 2: 02de42196ebe 'H'
307 |
307 |
308 o 1: 24b6387c8c8c 'F'
308 o 1: 24b6387c8c8c 'F'
309 |
309 |
310 o 0: cd010b8cd998 'A'
310 o 0: cd010b8cd998 'A'
311
311
312 $ cd ..
312 $ cd ..
313
313
314
314
315 Specify source and dest (from 2 onto 7):
315 Specify source and dest (from 2 onto 7):
316
316
317 $ hg clone -q -u . a a7
317 $ hg clone -q -u . a a7
318 $ cd a7
318 $ cd a7
319
319
320 $ hg rebase --source 2 --dest 7
320 $ hg rebase --source 2 --dest 7
321 rebasing 2:5fddd98957c8 "C"
321 rebasing 2:5fddd98957c8 "C"
322 rebasing 3:32af7686d403 "D"
322 rebasing 3:32af7686d403 "D"
323 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
323 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
324
324
325 $ hg tglog
325 $ hg tglog
326 o 8: 668acadedd30 'D'
326 o 8: 668acadedd30 'D'
327 |
327 |
328 o 7: 09eb682ba906 'C'
328 o 7: 09eb682ba906 'C'
329 |
329 |
330 | @ 6: e7ec4e813ba6 'I'
330 | @ 6: e7ec4e813ba6 'I'
331 |/
331 |/
332 o 5: 02de42196ebe 'H'
332 o 5: 02de42196ebe 'H'
333 |
333 |
334 | o 4: eea13746799a 'G'
334 | o 4: eea13746799a 'G'
335 |/|
335 |/|
336 o | 3: 24b6387c8c8c 'F'
336 o | 3: 24b6387c8c8c 'F'
337 | |
337 | |
338 | o 2: 9520eea781bc 'E'
338 | o 2: 9520eea781bc 'E'
339 |/
339 |/
340 | o 1: 42ccdea3bb16 'B'
340 | o 1: 42ccdea3bb16 'B'
341 |/
341 |/
342 o 0: cd010b8cd998 'A'
342 o 0: cd010b8cd998 'A'
343
343
344 $ cd ..
344 $ cd ..
345
345
346
346
347 Specify base and dest (from 1 onto 7):
347 Specify base and dest (from 1 onto 7):
348
348
349 $ hg clone -q -u . a a8
349 $ hg clone -q -u . a a8
350 $ cd a8
350 $ cd a8
351
351
352 $ hg rebase --base 3 --dest 7
352 $ hg rebase --base 3 --dest 7
353 rebasing 1:42ccdea3bb16 "B"
353 rebasing 1:42ccdea3bb16 "B"
354 rebasing 2:5fddd98957c8 "C"
354 rebasing 2:5fddd98957c8 "C"
355 rebasing 3:32af7686d403 "D"
355 rebasing 3:32af7686d403 "D"
356 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
356 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/42ccdea3bb16-3cb021d3-rebase.hg
357
357
358 $ hg tglog
358 $ hg tglog
359 o 8: 287cc92ba5a4 'D'
359 o 8: 287cc92ba5a4 'D'
360 |
360 |
361 o 7: 6824f610a250 'C'
361 o 7: 6824f610a250 'C'
362 |
362 |
363 o 6: 7c6027df6a99 'B'
363 o 6: 7c6027df6a99 'B'
364 |
364 |
365 | @ 5: e7ec4e813ba6 'I'
365 | @ 5: e7ec4e813ba6 'I'
366 |/
366 |/
367 o 4: 02de42196ebe 'H'
367 o 4: 02de42196ebe 'H'
368 |
368 |
369 | o 3: eea13746799a 'G'
369 | o 3: eea13746799a 'G'
370 |/|
370 |/|
371 o | 2: 24b6387c8c8c 'F'
371 o | 2: 24b6387c8c8c 'F'
372 | |
372 | |
373 | o 1: 9520eea781bc 'E'
373 | o 1: 9520eea781bc 'E'
374 |/
374 |/
375 o 0: cd010b8cd998 'A'
375 o 0: cd010b8cd998 'A'
376
376
377 $ cd ..
377 $ cd ..
378
378
379
379
380 Specify only revs (from 2 onto 8)
380 Specify only revs (from 2 onto 8)
381
381
382 $ hg clone -q -u . a2heads a9
382 $ hg clone -q -u . a2heads a9
383 $ cd a9
383 $ cd a9
384
384
385 $ hg rebase --rev 'desc("C")::'
385 $ hg rebase --rev 'desc("C")::'
386 rebasing 2:5fddd98957c8 "C"
386 rebasing 2:5fddd98957c8 "C"
387 rebasing 3:32af7686d403 "D"
387 rebasing 3:32af7686d403 "D"
388 saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
388 saved backup bundle to $TESTTMP/a9/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
389
389
390 $ hg tglog
390 $ hg tglog
391 o 6: 7726e9fd58f7 'D'
391 o 6: 7726e9fd58f7 'D'
392 |
392 |
393 o 5: 72c8333623d0 'C'
393 o 5: 72c8333623d0 'C'
394 |
394 |
395 @ 4: e7ec4e813ba6 'I'
395 @ 4: e7ec4e813ba6 'I'
396 |
396 |
397 o 3: 02de42196ebe 'H'
397 o 3: 02de42196ebe 'H'
398 |
398 |
399 o 2: 24b6387c8c8c 'F'
399 o 2: 24b6387c8c8c 'F'
400 |
400 |
401 | o 1: 42ccdea3bb16 'B'
401 | o 1: 42ccdea3bb16 'B'
402 |/
402 |/
403 o 0: cd010b8cd998 'A'
403 o 0: cd010b8cd998 'A'
404
404
405 $ cd ..
405 $ cd ..
406
406
407 Rebasing both a single revision and a merge in one command
407 Rebasing both a single revision and a merge in one command
408
408
409 $ hg clone -q -u . a aX
409 $ hg clone -q -u . a aX
410 $ cd aX
410 $ cd aX
411 $ hg rebase -r 3 -r 6 --dest 8
411 $ hg rebase -r 3 -r 6 --dest 8
412 rebasing 3:32af7686d403 "D"
412 rebasing 3:32af7686d403 "D"
413 rebasing 6:eea13746799a "G"
413 rebasing 6:eea13746799a "G"
414 saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg
414 saved backup bundle to $TESTTMP/aX/.hg/strip-backup/eea13746799a-ad273fd6-rebase.hg
415 $ cd ..
415 $ cd ..
416
416
417 Test --tool parameter:
417 Test --tool parameter:
418
418
419 $ hg init b
419 $ hg init b
420 $ cd b
420 $ cd b
421
421
422 $ echo c1 > c1
422 $ echo c1 > c1
423 $ hg ci -Am c1
423 $ hg ci -Am c1
424 adding c1
424 adding c1
425
425
426 $ echo c2 > c2
426 $ echo c2 > c2
427 $ hg ci -Am c2
427 $ hg ci -Am c2
428 adding c2
428 adding c2
429
429
430 $ hg up -q 0
430 $ hg up -q 0
431 $ echo c2b > c2
431 $ echo c2b > c2
432 $ hg ci -Am c2b
432 $ hg ci -Am c2b
433 adding c2
433 adding c2
434 created new head
434 created new head
435
435
436 $ cd ..
436 $ cd ..
437
437
438 $ hg clone -q -u . b b1
438 $ hg clone -q -u . b b1
439 $ cd b1
439 $ cd b1
440
440
441 $ hg rebase -s 2 -d 1 --tool internal:local
441 $ hg rebase -s 2 -d 1 --tool internal:local
442 rebasing 2:e4e3f3546619 "c2b" (tip)
442 rebasing 2:e4e3f3546619 "c2b" (tip)
443 note: rebase of 2:e4e3f3546619 "c2b" (tip) created no changes to commit
443 note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes
444 saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
444 saved backup bundle to $TESTTMP/b1/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
445
445
446 $ hg cat c2
446 $ hg cat c2
447 c2
447 c2
448
448
449 $ cd ..
449 $ cd ..
450
450
451
451
452 $ hg clone -q -u . b b2
452 $ hg clone -q -u . b b2
453 $ cd b2
453 $ cd b2
454
454
455 $ hg rebase -s 2 -d 1 --tool internal:other
455 $ hg rebase -s 2 -d 1 --tool internal:other
456 rebasing 2:e4e3f3546619 "c2b" (tip)
456 rebasing 2:e4e3f3546619 "c2b" (tip)
457 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
457 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
458
458
459 $ hg cat c2
459 $ hg cat c2
460 c2b
460 c2b
461
461
462 $ cd ..
462 $ cd ..
463
463
464
464
465 $ hg clone -q -u . b b3
465 $ hg clone -q -u . b b3
466 $ cd b3
466 $ cd b3
467
467
468 $ hg rebase -s 2 -d 1 --tool internal:fail
468 $ hg rebase -s 2 -d 1 --tool internal:fail
469 rebasing 2:e4e3f3546619 "c2b" (tip)
469 rebasing 2:e4e3f3546619 "c2b" (tip)
470 unresolved conflicts (see hg resolve, then hg rebase --continue)
470 unresolved conflicts (see hg resolve, then hg rebase --continue)
471 [1]
471 [1]
472
472
473 $ hg summary
473 $ hg summary
474 parent: 1:56daeba07f4b
474 parent: 1:56daeba07f4b
475 c2
475 c2
476 parent: 2:e4e3f3546619 tip
476 parent: 2:e4e3f3546619 tip
477 c2b
477 c2b
478 branch: default
478 branch: default
479 commit: 1 modified, 1 unresolved (merge)
479 commit: 1 modified, 1 unresolved (merge)
480 update: (current)
480 update: (current)
481 phases: 3 draft
481 phases: 3 draft
482 rebase: 0 rebased, 1 remaining (rebase --continue)
482 rebase: 0 rebased, 1 remaining (rebase --continue)
483
483
484 $ hg resolve -l
484 $ hg resolve -l
485 U c2
485 U c2
486
486
487 $ hg resolve -m c2
487 $ hg resolve -m c2
488 (no more unresolved files)
488 (no more unresolved files)
489 continue: hg rebase --continue
489 continue: hg rebase --continue
490 $ hg graft --continue
490 $ hg graft --continue
491 abort: no graft in progress
491 abort: no graft in progress
492 (continue: hg rebase --continue)
492 (continue: hg rebase --continue)
493 [255]
493 [255]
494 $ hg rebase -c --tool internal:fail
494 $ hg rebase -c --tool internal:fail
495 rebasing 2:e4e3f3546619 "c2b" (tip)
495 rebasing 2:e4e3f3546619 "c2b" (tip)
496 note: rebase of 2:e4e3f3546619 "c2b" (tip) created no changes to commit
496 note: not rebasing 2:e4e3f3546619 "c2b" (tip), its destination already has all its changes
497 saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
497 saved backup bundle to $TESTTMP/b3/.hg/strip-backup/e4e3f3546619-b0841178-rebase.hg
498
498
499 $ hg rebase -i
499 $ hg rebase -i
500 abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
500 abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
501 [255]
501 [255]
502
502
503 $ hg rebase --interactive
503 $ hg rebase --interactive
504 abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
504 abort: interactive history editing is supported by the 'histedit' extension (see "hg --config extensions.histedit= help -e histedit")
505 [255]
505 [255]
506
506
507 $ cd ..
507 $ cd ..
508
508
509 No common ancestor
509 No common ancestor
510
510
511 $ hg init separaterepo
511 $ hg init separaterepo
512 $ cd separaterepo
512 $ cd separaterepo
513 $ touch a
513 $ touch a
514 $ hg commit -Aqm a
514 $ hg commit -Aqm a
515 $ hg up -q null
515 $ hg up -q null
516 $ touch b
516 $ touch b
517 $ hg commit -Aqm b
517 $ hg commit -Aqm b
518 $ hg rebase -d 0
518 $ hg rebase -d 0
519 nothing to rebase from d7486e00c6f1 to 3903775176ed
519 nothing to rebase from d7486e00c6f1 to 3903775176ed
520 [1]
520 [1]
521 $ cd ..
521 $ cd ..
@@ -1,984 +1,984 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > rebase=
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
4 > drawdag=$TESTDIR/drawdag.py
5 >
5 >
6 > [phases]
6 > [phases]
7 > publish=False
7 > publish=False
8 >
8 >
9 > [alias]
9 > [alias]
10 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
10 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
11 > EOF
11 > EOF
12
12
13
13
14 $ hg init a
14 $ hg init a
15 $ cd a
15 $ cd a
16 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
16 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
17 adding changesets
17 adding changesets
18 adding manifests
18 adding manifests
19 adding file changes
19 adding file changes
20 added 8 changesets with 7 changes to 7 files (+2 heads)
20 added 8 changesets with 7 changes to 7 files (+2 heads)
21 new changesets cd010b8cd998:02de42196ebe (8 drafts)
21 new changesets cd010b8cd998:02de42196ebe (8 drafts)
22 (run 'hg heads' to see heads, 'hg merge' to merge)
22 (run 'hg heads' to see heads, 'hg merge' to merge)
23 $ hg up tip
23 $ hg up tip
24 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 $ cd ..
25 $ cd ..
26
26
27
27
28 Rebasing
28 Rebasing
29 D onto H - simple rebase:
29 D onto H - simple rebase:
30 (this also tests that editor is invoked if '--edit' is specified, and that we
30 (this also tests that editor is invoked if '--edit' is specified, and that we
31 can abort or warn for colliding untracked files)
31 can abort or warn for colliding untracked files)
32
32
33 $ hg clone -q -u . a a1
33 $ hg clone -q -u . a a1
34 $ cd a1
34 $ cd a1
35
35
36 $ hg tglog
36 $ hg tglog
37 @ 7: 02de42196ebe 'H'
37 @ 7: 02de42196ebe 'H'
38 |
38 |
39 | o 6: eea13746799a 'G'
39 | o 6: eea13746799a 'G'
40 |/|
40 |/|
41 o | 5: 24b6387c8c8c 'F'
41 o | 5: 24b6387c8c8c 'F'
42 | |
42 | |
43 | o 4: 9520eea781bc 'E'
43 | o 4: 9520eea781bc 'E'
44 |/
44 |/
45 | o 3: 32af7686d403 'D'
45 | o 3: 32af7686d403 'D'
46 | |
46 | |
47 | o 2: 5fddd98957c8 'C'
47 | o 2: 5fddd98957c8 'C'
48 | |
48 | |
49 | o 1: 42ccdea3bb16 'B'
49 | o 1: 42ccdea3bb16 'B'
50 |/
50 |/
51 o 0: cd010b8cd998 'A'
51 o 0: cd010b8cd998 'A'
52
52
53
53
54 $ hg status --rev "3^1" --rev 3
54 $ hg status --rev "3^1" --rev 3
55 A D
55 A D
56 $ echo collide > D
56 $ echo collide > D
57 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
57 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
58 rebasing 3:32af7686d403 "D"
58 rebasing 3:32af7686d403 "D"
59 D: replacing untracked file
59 D: replacing untracked file
60 D
60 D
61
61
62
62
63 HG: Enter commit message. Lines beginning with 'HG:' are removed.
63 HG: Enter commit message. Lines beginning with 'HG:' are removed.
64 HG: Leave message empty to abort commit.
64 HG: Leave message empty to abort commit.
65 HG: --
65 HG: --
66 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
66 HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com>
67 HG: branch 'default'
67 HG: branch 'default'
68 HG: added D
68 HG: added D
69 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg
69 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg
70 $ cat D.orig
70 $ cat D.orig
71 collide
71 collide
72 $ rm D.orig
72 $ rm D.orig
73
73
74 $ hg tglog
74 $ hg tglog
75 o 7: 1619f02ff7dd 'D'
75 o 7: 1619f02ff7dd 'D'
76 |
76 |
77 @ 6: 02de42196ebe 'H'
77 @ 6: 02de42196ebe 'H'
78 |
78 |
79 | o 5: eea13746799a 'G'
79 | o 5: eea13746799a 'G'
80 |/|
80 |/|
81 o | 4: 24b6387c8c8c 'F'
81 o | 4: 24b6387c8c8c 'F'
82 | |
82 | |
83 | o 3: 9520eea781bc 'E'
83 | o 3: 9520eea781bc 'E'
84 |/
84 |/
85 | o 2: 5fddd98957c8 'C'
85 | o 2: 5fddd98957c8 'C'
86 | |
86 | |
87 | o 1: 42ccdea3bb16 'B'
87 | o 1: 42ccdea3bb16 'B'
88 |/
88 |/
89 o 0: cd010b8cd998 'A'
89 o 0: cd010b8cd998 'A'
90
90
91 $ cd ..
91 $ cd ..
92
92
93
93
94 D onto F - intermediate point:
94 D onto F - intermediate point:
95 (this also tests that editor is not invoked if '--edit' is not specified, and
95 (this also tests that editor is not invoked if '--edit' is not specified, and
96 that we can ignore for colliding untracked files)
96 that we can ignore for colliding untracked files)
97
97
98 $ hg clone -q -u . a a2
98 $ hg clone -q -u . a a2
99 $ cd a2
99 $ cd a2
100 $ echo collide > D
100 $ echo collide > D
101
101
102 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
102 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
103 rebasing 3:32af7686d403 "D"
103 rebasing 3:32af7686d403 "D"
104 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg
104 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg
105 $ cat D.orig
105 $ cat D.orig
106 collide
106 collide
107 $ rm D.orig
107 $ rm D.orig
108
108
109 $ hg tglog
109 $ hg tglog
110 o 7: 2107530e74ab 'D'
110 o 7: 2107530e74ab 'D'
111 |
111 |
112 | @ 6: 02de42196ebe 'H'
112 | @ 6: 02de42196ebe 'H'
113 |/
113 |/
114 | o 5: eea13746799a 'G'
114 | o 5: eea13746799a 'G'
115 |/|
115 |/|
116 o | 4: 24b6387c8c8c 'F'
116 o | 4: 24b6387c8c8c 'F'
117 | |
117 | |
118 | o 3: 9520eea781bc 'E'
118 | o 3: 9520eea781bc 'E'
119 |/
119 |/
120 | o 2: 5fddd98957c8 'C'
120 | o 2: 5fddd98957c8 'C'
121 | |
121 | |
122 | o 1: 42ccdea3bb16 'B'
122 | o 1: 42ccdea3bb16 'B'
123 |/
123 |/
124 o 0: cd010b8cd998 'A'
124 o 0: cd010b8cd998 'A'
125
125
126 $ cd ..
126 $ cd ..
127
127
128
128
129 E onto H - skip of G:
129 E onto H - skip of G:
130 (this also tests that we can overwrite untracked files and don't create backups
130 (this also tests that we can overwrite untracked files and don't create backups
131 if they have the same contents)
131 if they have the same contents)
132
132
133 $ hg clone -q -u . a a3
133 $ hg clone -q -u . a a3
134 $ cd a3
134 $ cd a3
135 $ hg cat -r 4 E | tee E
135 $ hg cat -r 4 E | tee E
136 E
136 E
137
137
138 $ hg rebase -s 4 -d 7
138 $ hg rebase -s 4 -d 7
139 rebasing 4:9520eea781bc "E"
139 rebasing 4:9520eea781bc "E"
140 rebasing 6:eea13746799a "G"
140 rebasing 6:eea13746799a "G"
141 note: rebase of 6:eea13746799a "G" created no changes to commit
141 note: not rebasing 6:eea13746799a "G", its destination already has all its changes
142 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
142 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg
143 $ f E.orig
143 $ f E.orig
144 E.orig: file not found
144 E.orig: file not found
145
145
146 $ hg tglog
146 $ hg tglog
147 o 6: 9f8b8ec77260 'E'
147 o 6: 9f8b8ec77260 'E'
148 |
148 |
149 @ 5: 02de42196ebe 'H'
149 @ 5: 02de42196ebe 'H'
150 |
150 |
151 o 4: 24b6387c8c8c 'F'
151 o 4: 24b6387c8c8c 'F'
152 |
152 |
153 | o 3: 32af7686d403 'D'
153 | o 3: 32af7686d403 'D'
154 | |
154 | |
155 | o 2: 5fddd98957c8 'C'
155 | o 2: 5fddd98957c8 'C'
156 | |
156 | |
157 | o 1: 42ccdea3bb16 'B'
157 | o 1: 42ccdea3bb16 'B'
158 |/
158 |/
159 o 0: cd010b8cd998 'A'
159 o 0: cd010b8cd998 'A'
160
160
161 $ cd ..
161 $ cd ..
162
162
163
163
164 F onto E - rebase of a branching point (skip G):
164 F onto E - rebase of a branching point (skip G):
165
165
166 $ hg clone -q -u . a a4
166 $ hg clone -q -u . a a4
167 $ cd a4
167 $ cd a4
168
168
169 $ hg rebase -s 5 -d 4
169 $ hg rebase -s 5 -d 4
170 rebasing 5:24b6387c8c8c "F"
170 rebasing 5:24b6387c8c8c "F"
171 rebasing 6:eea13746799a "G"
171 rebasing 6:eea13746799a "G"
172 note: rebase of 6:eea13746799a "G" created no changes to commit
172 note: not rebasing 6:eea13746799a "G", its destination already has all its changes
173 rebasing 7:02de42196ebe "H" (tip)
173 rebasing 7:02de42196ebe "H" (tip)
174 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg
174 saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg
175
175
176 $ hg tglog
176 $ hg tglog
177 @ 6: e9240aeaa6ad 'H'
177 @ 6: e9240aeaa6ad 'H'
178 |
178 |
179 o 5: 5d0ccadb6e3e 'F'
179 o 5: 5d0ccadb6e3e 'F'
180 |
180 |
181 o 4: 9520eea781bc 'E'
181 o 4: 9520eea781bc 'E'
182 |
182 |
183 | o 3: 32af7686d403 'D'
183 | o 3: 32af7686d403 'D'
184 | |
184 | |
185 | o 2: 5fddd98957c8 'C'
185 | o 2: 5fddd98957c8 'C'
186 | |
186 | |
187 | o 1: 42ccdea3bb16 'B'
187 | o 1: 42ccdea3bb16 'B'
188 |/
188 |/
189 o 0: cd010b8cd998 'A'
189 o 0: cd010b8cd998 'A'
190
190
191 $ cd ..
191 $ cd ..
192
192
193
193
194 G onto H - merged revision having a parent in ancestors of target:
194 G onto H - merged revision having a parent in ancestors of target:
195
195
196 $ hg clone -q -u . a a5
196 $ hg clone -q -u . a a5
197 $ cd a5
197 $ cd a5
198
198
199 $ hg rebase -s 6 -d 7
199 $ hg rebase -s 6 -d 7
200 rebasing 6:eea13746799a "G"
200 rebasing 6:eea13746799a "G"
201 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg
201 saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg
202
202
203 $ hg tglog
203 $ hg tglog
204 o 7: 397834907a90 'G'
204 o 7: 397834907a90 'G'
205 |\
205 |\
206 | @ 6: 02de42196ebe 'H'
206 | @ 6: 02de42196ebe 'H'
207 | |
207 | |
208 | o 5: 24b6387c8c8c 'F'
208 | o 5: 24b6387c8c8c 'F'
209 | |
209 | |
210 o | 4: 9520eea781bc 'E'
210 o | 4: 9520eea781bc 'E'
211 |/
211 |/
212 | o 3: 32af7686d403 'D'
212 | o 3: 32af7686d403 'D'
213 | |
213 | |
214 | o 2: 5fddd98957c8 'C'
214 | o 2: 5fddd98957c8 'C'
215 | |
215 | |
216 | o 1: 42ccdea3bb16 'B'
216 | o 1: 42ccdea3bb16 'B'
217 |/
217 |/
218 o 0: cd010b8cd998 'A'
218 o 0: cd010b8cd998 'A'
219
219
220 $ cd ..
220 $ cd ..
221
221
222
222
223 F onto B - G maintains E as parent:
223 F onto B - G maintains E as parent:
224
224
225 $ hg clone -q -u . a a6
225 $ hg clone -q -u . a a6
226 $ cd a6
226 $ cd a6
227
227
228 $ hg rebase -s 5 -d 1
228 $ hg rebase -s 5 -d 1
229 rebasing 5:24b6387c8c8c "F"
229 rebasing 5:24b6387c8c8c "F"
230 rebasing 6:eea13746799a "G"
230 rebasing 6:eea13746799a "G"
231 rebasing 7:02de42196ebe "H" (tip)
231 rebasing 7:02de42196ebe "H" (tip)
232 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg
232 saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg
233
233
234 $ hg tglog
234 $ hg tglog
235 @ 7: c87be72f9641 'H'
235 @ 7: c87be72f9641 'H'
236 |
236 |
237 | o 6: 17badd73d4f1 'G'
237 | o 6: 17badd73d4f1 'G'
238 |/|
238 |/|
239 o | 5: 74fb9ed646c4 'F'
239 o | 5: 74fb9ed646c4 'F'
240 | |
240 | |
241 | o 4: 9520eea781bc 'E'
241 | o 4: 9520eea781bc 'E'
242 | |
242 | |
243 | | o 3: 32af7686d403 'D'
243 | | o 3: 32af7686d403 'D'
244 | | |
244 | | |
245 +---o 2: 5fddd98957c8 'C'
245 +---o 2: 5fddd98957c8 'C'
246 | |
246 | |
247 o | 1: 42ccdea3bb16 'B'
247 o | 1: 42ccdea3bb16 'B'
248 |/
248 |/
249 o 0: cd010b8cd998 'A'
249 o 0: cd010b8cd998 'A'
250
250
251 $ cd ..
251 $ cd ..
252
252
253
253
254 These will fail (using --source):
254 These will fail (using --source):
255
255
256 G onto F - rebase onto an ancestor:
256 G onto F - rebase onto an ancestor:
257
257
258 $ hg clone -q -u . a a7
258 $ hg clone -q -u . a a7
259 $ cd a7
259 $ cd a7
260
260
261 $ hg rebase -s 6 -d 5
261 $ hg rebase -s 6 -d 5
262 nothing to rebase
262 nothing to rebase
263 [1]
263 [1]
264
264
265 F onto G - rebase onto a descendant:
265 F onto G - rebase onto a descendant:
266
266
267 $ hg rebase -s 5 -d 6
267 $ hg rebase -s 5 -d 6
268 abort: source and destination form a cycle
268 abort: source and destination form a cycle
269 [255]
269 [255]
270
270
271 G onto B - merge revision with both parents not in ancestors of target:
271 G onto B - merge revision with both parents not in ancestors of target:
272
272
273 $ hg rebase -s 6 -d 1
273 $ hg rebase -s 6 -d 1
274 rebasing 6:eea13746799a "G"
274 rebasing 6:eea13746799a "G"
275 abort: cannot rebase 6:eea13746799a without moving at least one of its parents
275 abort: cannot rebase 6:eea13746799a without moving at least one of its parents
276 [255]
276 [255]
277 $ hg rebase --abort
277 $ hg rebase --abort
278 rebase aborted
278 rebase aborted
279
279
280 These will abort gracefully (using --base):
280 These will abort gracefully (using --base):
281
281
282 G onto G - rebase onto same changeset:
282 G onto G - rebase onto same changeset:
283
283
284 $ hg rebase -b 6 -d 6
284 $ hg rebase -b 6 -d 6
285 nothing to rebase - eea13746799a is both "base" and destination
285 nothing to rebase - eea13746799a is both "base" and destination
286 [1]
286 [1]
287
287
288 G onto F - rebase onto an ancestor:
288 G onto F - rebase onto an ancestor:
289
289
290 $ hg rebase -b 6 -d 5
290 $ hg rebase -b 6 -d 5
291 nothing to rebase
291 nothing to rebase
292 [1]
292 [1]
293
293
294 F onto G - rebase onto a descendant:
294 F onto G - rebase onto a descendant:
295
295
296 $ hg rebase -b 5 -d 6
296 $ hg rebase -b 5 -d 6
297 nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a
297 nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a
298 [1]
298 [1]
299
299
300 C onto A - rebase onto an ancestor:
300 C onto A - rebase onto an ancestor:
301
301
302 $ hg rebase -d 0 -s 2
302 $ hg rebase -d 0 -s 2
303 rebasing 2:5fddd98957c8 "C"
303 rebasing 2:5fddd98957c8 "C"
304 rebasing 3:32af7686d403 "D"
304 rebasing 3:32af7686d403 "D"
305 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
305 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg
306 $ hg tglog
306 $ hg tglog
307 o 7: c9659aac0000 'D'
307 o 7: c9659aac0000 'D'
308 |
308 |
309 o 6: e1c4361dd923 'C'
309 o 6: e1c4361dd923 'C'
310 |
310 |
311 | @ 5: 02de42196ebe 'H'
311 | @ 5: 02de42196ebe 'H'
312 | |
312 | |
313 | | o 4: eea13746799a 'G'
313 | | o 4: eea13746799a 'G'
314 | |/|
314 | |/|
315 | o | 3: 24b6387c8c8c 'F'
315 | o | 3: 24b6387c8c8c 'F'
316 |/ /
316 |/ /
317 | o 2: 9520eea781bc 'E'
317 | o 2: 9520eea781bc 'E'
318 |/
318 |/
319 | o 1: 42ccdea3bb16 'B'
319 | o 1: 42ccdea3bb16 'B'
320 |/
320 |/
321 o 0: cd010b8cd998 'A'
321 o 0: cd010b8cd998 'A'
322
322
323
323
324 Check rebasing public changeset
324 Check rebasing public changeset
325
325
326 $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6
326 $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6
327 $ hg rebase -d 0 -b 6
327 $ hg rebase -d 0 -b 6
328 nothing to rebase
328 nothing to rebase
329 [1]
329 [1]
330 $ hg rebase -d 5 -b 6
330 $ hg rebase -d 5 -b 6
331 abort: can't rebase public changeset e1c4361dd923
331 abort: can't rebase public changeset e1c4361dd923
332 (see 'hg help phases' for details)
332 (see 'hg help phases' for details)
333 [255]
333 [255]
334 $ hg rebase -d 5 -r '1 + (6::)'
334 $ hg rebase -d 5 -r '1 + (6::)'
335 abort: can't rebase public changeset e1c4361dd923
335 abort: can't rebase public changeset e1c4361dd923
336 (see 'hg help phases' for details)
336 (see 'hg help phases' for details)
337 [255]
337 [255]
338
338
339 $ hg rebase -d 5 -b 6 --keep
339 $ hg rebase -d 5 -b 6 --keep
340 rebasing 6:e1c4361dd923 "C"
340 rebasing 6:e1c4361dd923 "C"
341 rebasing 7:c9659aac0000 "D" (tip)
341 rebasing 7:c9659aac0000 "D" (tip)
342
342
343 Check rebasing mutable changeset
343 Check rebasing mutable changeset
344 Source phase greater or equal to destination phase: new changeset get the phase of source:
344 Source phase greater or equal to destination phase: new changeset get the phase of source:
345 $ hg id -n
345 $ hg id -n
346 5
346 5
347 $ hg rebase -s9 -d0
347 $ hg rebase -s9 -d0
348 rebasing 9:2b23e52411f4 "D" (tip)
348 rebasing 9:2b23e52411f4 "D" (tip)
349 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg
349 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg
350 $ hg id -n # check we updated back to parent
350 $ hg id -n # check we updated back to parent
351 5
351 5
352 $ hg log --template "{phase}\n" -r 9
352 $ hg log --template "{phase}\n" -r 9
353 draft
353 draft
354 $ hg rebase -s9 -d1
354 $ hg rebase -s9 -d1
355 rebasing 9:2cb10d0cfc6c "D" (tip)
355 rebasing 9:2cb10d0cfc6c "D" (tip)
356 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg
356 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg
357 $ hg log --template "{phase}\n" -r 9
357 $ hg log --template "{phase}\n" -r 9
358 draft
358 draft
359 $ hg phase --force --secret 9
359 $ hg phase --force --secret 9
360 $ hg rebase -s9 -d0
360 $ hg rebase -s9 -d0
361 rebasing 9:c5b12b67163a "D" (tip)
361 rebasing 9:c5b12b67163a "D" (tip)
362 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg
362 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg
363 $ hg log --template "{phase}\n" -r 9
363 $ hg log --template "{phase}\n" -r 9
364 secret
364 secret
365 $ hg rebase -s9 -d1
365 $ hg rebase -s9 -d1
366 rebasing 9:2a0524f868ac "D" (tip)
366 rebasing 9:2a0524f868ac "D" (tip)
367 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg
367 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg
368 $ hg log --template "{phase}\n" -r 9
368 $ hg log --template "{phase}\n" -r 9
369 secret
369 secret
370 Source phase lower than destination phase: new changeset get the phase of destination:
370 Source phase lower than destination phase: new changeset get the phase of destination:
371 $ hg rebase -s8 -d9
371 $ hg rebase -s8 -d9
372 rebasing 8:6d4f22462821 "C"
372 rebasing 8:6d4f22462821 "C"
373 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg
373 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg
374 $ hg log --template "{phase}\n" -r 'rev(9)'
374 $ hg log --template "{phase}\n" -r 'rev(9)'
375 secret
375 secret
376
376
377 $ cd ..
377 $ cd ..
378
378
379 Check that temporary bundle doesn't lose phase when not using generaldelta
379 Check that temporary bundle doesn't lose phase when not using generaldelta
380
380
381 $ hg --config format.usegeneraldelta=no init issue5678
381 $ hg --config format.usegeneraldelta=no init issue5678
382 $ cd issue5678
382 $ cd issue5678
383 $ grep generaldelta .hg/requires
383 $ grep generaldelta .hg/requires
384 [1]
384 [1]
385 $ echo a > a
385 $ echo a > a
386 $ hg ci -Aqm a
386 $ hg ci -Aqm a
387 $ echo b > b
387 $ echo b > b
388 $ hg ci -Aqm b
388 $ hg ci -Aqm b
389 $ hg co -q '.^'
389 $ hg co -q '.^'
390 $ echo c > c
390 $ echo c > c
391 $ hg ci -Aqm c
391 $ hg ci -Aqm c
392 $ hg phase --public
392 $ hg phase --public
393 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
393 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
394 @ 2:d36c public c
394 @ 2:d36c public c
395 |
395 |
396 | o 1:d2ae draft b
396 | o 1:d2ae draft b
397 |/
397 |/
398 o 0:cb9a public a
398 o 0:cb9a public a
399
399
400 $ hg rebase -s 1 -d 2
400 $ hg rebase -s 1 -d 2
401 rebasing 1:d2ae7f538514 "b"
401 rebasing 1:d2ae7f538514 "b"
402 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg
402 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg
403 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
403 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
404 o 2:c882 draft b
404 o 2:c882 draft b
405 |
405 |
406 @ 1:d36c public c
406 @ 1:d36c public c
407 |
407 |
408 o 0:cb9a public a
408 o 0:cb9a public a
409
409
410 $ cd ..
410 $ cd ..
411
411
412 Test for revset
412 Test for revset
413
413
414 We need a bit different graph
414 We need a bit different graph
415 All destination are B
415 All destination are B
416
416
417 $ hg init ah
417 $ hg init ah
418 $ cd ah
418 $ cd ah
419 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
419 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
420 adding changesets
420 adding changesets
421 adding manifests
421 adding manifests
422 adding file changes
422 adding file changes
423 added 9 changesets with 9 changes to 9 files (+2 heads)
423 added 9 changesets with 9 changes to 9 files (+2 heads)
424 new changesets 9ae2ed22e576:479ddb54a924 (9 drafts)
424 new changesets 9ae2ed22e576:479ddb54a924 (9 drafts)
425 (run 'hg heads' to see heads, 'hg merge' to merge)
425 (run 'hg heads' to see heads, 'hg merge' to merge)
426 $ hg tglog
426 $ hg tglog
427 o 8: 479ddb54a924 'I'
427 o 8: 479ddb54a924 'I'
428 |
428 |
429 o 7: 72434a4e60b0 'H'
429 o 7: 72434a4e60b0 'H'
430 |
430 |
431 o 6: 3d8a618087a7 'G'
431 o 6: 3d8a618087a7 'G'
432 |
432 |
433 | o 5: 41bfcc75ed73 'F'
433 | o 5: 41bfcc75ed73 'F'
434 | |
434 | |
435 | o 4: c01897464e7f 'E'
435 | o 4: c01897464e7f 'E'
436 |/
436 |/
437 o 3: ffd453c31098 'D'
437 o 3: ffd453c31098 'D'
438 |
438 |
439 o 2: c9e50f6cdc55 'C'
439 o 2: c9e50f6cdc55 'C'
440 |
440 |
441 | o 1: 8fd0f7e49f53 'B'
441 | o 1: 8fd0f7e49f53 'B'
442 |/
442 |/
443 o 0: 9ae2ed22e576 'A'
443 o 0: 9ae2ed22e576 'A'
444
444
445 $ cd ..
445 $ cd ..
446
446
447
447
448 Simple case with keep:
448 Simple case with keep:
449
449
450 Source on have two descendant heads but ask for one
450 Source on have two descendant heads but ask for one
451
451
452 $ hg clone -q -u . ah ah1
452 $ hg clone -q -u . ah ah1
453 $ cd ah1
453 $ cd ah1
454 $ hg rebase -r '2::8' -d 1
454 $ hg rebase -r '2::8' -d 1
455 abort: can't remove original changesets with unrebased descendants
455 abort: can't remove original changesets with unrebased descendants
456 (use --keep to keep original changesets)
456 (use --keep to keep original changesets)
457 [255]
457 [255]
458 $ hg rebase -r '2::8' -d 1 -k
458 $ hg rebase -r '2::8' -d 1 -k
459 rebasing 2:c9e50f6cdc55 "C"
459 rebasing 2:c9e50f6cdc55 "C"
460 rebasing 3:ffd453c31098 "D"
460 rebasing 3:ffd453c31098 "D"
461 rebasing 6:3d8a618087a7 "G"
461 rebasing 6:3d8a618087a7 "G"
462 rebasing 7:72434a4e60b0 "H"
462 rebasing 7:72434a4e60b0 "H"
463 rebasing 8:479ddb54a924 "I" (tip)
463 rebasing 8:479ddb54a924 "I" (tip)
464 $ hg tglog
464 $ hg tglog
465 o 13: 9bf1d9358a90 'I'
465 o 13: 9bf1d9358a90 'I'
466 |
466 |
467 o 12: 274623a778d4 'H'
467 o 12: 274623a778d4 'H'
468 |
468 |
469 o 11: ab8c8617c8e8 'G'
469 o 11: ab8c8617c8e8 'G'
470 |
470 |
471 o 10: c8cbf59f70da 'D'
471 o 10: c8cbf59f70da 'D'
472 |
472 |
473 o 9: 563e4faab485 'C'
473 o 9: 563e4faab485 'C'
474 |
474 |
475 | o 8: 479ddb54a924 'I'
475 | o 8: 479ddb54a924 'I'
476 | |
476 | |
477 | o 7: 72434a4e60b0 'H'
477 | o 7: 72434a4e60b0 'H'
478 | |
478 | |
479 | o 6: 3d8a618087a7 'G'
479 | o 6: 3d8a618087a7 'G'
480 | |
480 | |
481 | | o 5: 41bfcc75ed73 'F'
481 | | o 5: 41bfcc75ed73 'F'
482 | | |
482 | | |
483 | | o 4: c01897464e7f 'E'
483 | | o 4: c01897464e7f 'E'
484 | |/
484 | |/
485 | o 3: ffd453c31098 'D'
485 | o 3: ffd453c31098 'D'
486 | |
486 | |
487 | o 2: c9e50f6cdc55 'C'
487 | o 2: c9e50f6cdc55 'C'
488 | |
488 | |
489 o | 1: 8fd0f7e49f53 'B'
489 o | 1: 8fd0f7e49f53 'B'
490 |/
490 |/
491 o 0: 9ae2ed22e576 'A'
491 o 0: 9ae2ed22e576 'A'
492
492
493
493
494 $ cd ..
494 $ cd ..
495
495
496 Base on have one descendant heads we ask for but common ancestor have two
496 Base on have one descendant heads we ask for but common ancestor have two
497
497
498 $ hg clone -q -u . ah ah2
498 $ hg clone -q -u . ah ah2
499 $ cd ah2
499 $ cd ah2
500 $ hg rebase -r '3::8' -d 1
500 $ hg rebase -r '3::8' -d 1
501 abort: can't remove original changesets with unrebased descendants
501 abort: can't remove original changesets with unrebased descendants
502 (use --keep to keep original changesets)
502 (use --keep to keep original changesets)
503 [255]
503 [255]
504 $ hg rebase -r '3::8' -d 1 --keep
504 $ hg rebase -r '3::8' -d 1 --keep
505 rebasing 3:ffd453c31098 "D"
505 rebasing 3:ffd453c31098 "D"
506 rebasing 6:3d8a618087a7 "G"
506 rebasing 6:3d8a618087a7 "G"
507 rebasing 7:72434a4e60b0 "H"
507 rebasing 7:72434a4e60b0 "H"
508 rebasing 8:479ddb54a924 "I" (tip)
508 rebasing 8:479ddb54a924 "I" (tip)
509 $ hg tglog
509 $ hg tglog
510 o 12: 9d7da0053b1c 'I'
510 o 12: 9d7da0053b1c 'I'
511 |
511 |
512 o 11: 8fbd00952cbc 'H'
512 o 11: 8fbd00952cbc 'H'
513 |
513 |
514 o 10: 51d434a615ee 'G'
514 o 10: 51d434a615ee 'G'
515 |
515 |
516 o 9: a9c125634b0b 'D'
516 o 9: a9c125634b0b 'D'
517 |
517 |
518 | o 8: 479ddb54a924 'I'
518 | o 8: 479ddb54a924 'I'
519 | |
519 | |
520 | o 7: 72434a4e60b0 'H'
520 | o 7: 72434a4e60b0 'H'
521 | |
521 | |
522 | o 6: 3d8a618087a7 'G'
522 | o 6: 3d8a618087a7 'G'
523 | |
523 | |
524 | | o 5: 41bfcc75ed73 'F'
524 | | o 5: 41bfcc75ed73 'F'
525 | | |
525 | | |
526 | | o 4: c01897464e7f 'E'
526 | | o 4: c01897464e7f 'E'
527 | |/
527 | |/
528 | o 3: ffd453c31098 'D'
528 | o 3: ffd453c31098 'D'
529 | |
529 | |
530 | o 2: c9e50f6cdc55 'C'
530 | o 2: c9e50f6cdc55 'C'
531 | |
531 | |
532 o | 1: 8fd0f7e49f53 'B'
532 o | 1: 8fd0f7e49f53 'B'
533 |/
533 |/
534 o 0: 9ae2ed22e576 'A'
534 o 0: 9ae2ed22e576 'A'
535
535
536
536
537 $ cd ..
537 $ cd ..
538
538
539 rebase subset
539 rebase subset
540
540
541 $ hg clone -q -u . ah ah3
541 $ hg clone -q -u . ah ah3
542 $ cd ah3
542 $ cd ah3
543 $ hg rebase -r '3::7' -d 1
543 $ hg rebase -r '3::7' -d 1
544 abort: can't remove original changesets with unrebased descendants
544 abort: can't remove original changesets with unrebased descendants
545 (use --keep to keep original changesets)
545 (use --keep to keep original changesets)
546 [255]
546 [255]
547 $ hg rebase -r '3::7' -d 1 --keep
547 $ hg rebase -r '3::7' -d 1 --keep
548 rebasing 3:ffd453c31098 "D"
548 rebasing 3:ffd453c31098 "D"
549 rebasing 6:3d8a618087a7 "G"
549 rebasing 6:3d8a618087a7 "G"
550 rebasing 7:72434a4e60b0 "H"
550 rebasing 7:72434a4e60b0 "H"
551 $ hg tglog
551 $ hg tglog
552 o 11: 8fbd00952cbc 'H'
552 o 11: 8fbd00952cbc 'H'
553 |
553 |
554 o 10: 51d434a615ee 'G'
554 o 10: 51d434a615ee 'G'
555 |
555 |
556 o 9: a9c125634b0b 'D'
556 o 9: a9c125634b0b 'D'
557 |
557 |
558 | o 8: 479ddb54a924 'I'
558 | o 8: 479ddb54a924 'I'
559 | |
559 | |
560 | o 7: 72434a4e60b0 'H'
560 | o 7: 72434a4e60b0 'H'
561 | |
561 | |
562 | o 6: 3d8a618087a7 'G'
562 | o 6: 3d8a618087a7 'G'
563 | |
563 | |
564 | | o 5: 41bfcc75ed73 'F'
564 | | o 5: 41bfcc75ed73 'F'
565 | | |
565 | | |
566 | | o 4: c01897464e7f 'E'
566 | | o 4: c01897464e7f 'E'
567 | |/
567 | |/
568 | o 3: ffd453c31098 'D'
568 | o 3: ffd453c31098 'D'
569 | |
569 | |
570 | o 2: c9e50f6cdc55 'C'
570 | o 2: c9e50f6cdc55 'C'
571 | |
571 | |
572 o | 1: 8fd0f7e49f53 'B'
572 o | 1: 8fd0f7e49f53 'B'
573 |/
573 |/
574 o 0: 9ae2ed22e576 'A'
574 o 0: 9ae2ed22e576 'A'
575
575
576
576
577 $ cd ..
577 $ cd ..
578
578
579 rebase subset with multiple head
579 rebase subset with multiple head
580
580
581 $ hg clone -q -u . ah ah4
581 $ hg clone -q -u . ah ah4
582 $ cd ah4
582 $ cd ah4
583 $ hg rebase -r '3::(7+5)' -d 1
583 $ hg rebase -r '3::(7+5)' -d 1
584 abort: can't remove original changesets with unrebased descendants
584 abort: can't remove original changesets with unrebased descendants
585 (use --keep to keep original changesets)
585 (use --keep to keep original changesets)
586 [255]
586 [255]
587 $ hg rebase -r '3::(7+5)' -d 1 --keep
587 $ hg rebase -r '3::(7+5)' -d 1 --keep
588 rebasing 3:ffd453c31098 "D"
588 rebasing 3:ffd453c31098 "D"
589 rebasing 4:c01897464e7f "E"
589 rebasing 4:c01897464e7f "E"
590 rebasing 5:41bfcc75ed73 "F"
590 rebasing 5:41bfcc75ed73 "F"
591 rebasing 6:3d8a618087a7 "G"
591 rebasing 6:3d8a618087a7 "G"
592 rebasing 7:72434a4e60b0 "H"
592 rebasing 7:72434a4e60b0 "H"
593 $ hg tglog
593 $ hg tglog
594 o 13: 8fbd00952cbc 'H'
594 o 13: 8fbd00952cbc 'H'
595 |
595 |
596 o 12: 51d434a615ee 'G'
596 o 12: 51d434a615ee 'G'
597 |
597 |
598 | o 11: df23d8bda0b7 'F'
598 | o 11: df23d8bda0b7 'F'
599 | |
599 | |
600 | o 10: 47b7889448ff 'E'
600 | o 10: 47b7889448ff 'E'
601 |/
601 |/
602 o 9: a9c125634b0b 'D'
602 o 9: a9c125634b0b 'D'
603 |
603 |
604 | o 8: 479ddb54a924 'I'
604 | o 8: 479ddb54a924 'I'
605 | |
605 | |
606 | o 7: 72434a4e60b0 'H'
606 | o 7: 72434a4e60b0 'H'
607 | |
607 | |
608 | o 6: 3d8a618087a7 'G'
608 | o 6: 3d8a618087a7 'G'
609 | |
609 | |
610 | | o 5: 41bfcc75ed73 'F'
610 | | o 5: 41bfcc75ed73 'F'
611 | | |
611 | | |
612 | | o 4: c01897464e7f 'E'
612 | | o 4: c01897464e7f 'E'
613 | |/
613 | |/
614 | o 3: ffd453c31098 'D'
614 | o 3: ffd453c31098 'D'
615 | |
615 | |
616 | o 2: c9e50f6cdc55 'C'
616 | o 2: c9e50f6cdc55 'C'
617 | |
617 | |
618 o | 1: 8fd0f7e49f53 'B'
618 o | 1: 8fd0f7e49f53 'B'
619 |/
619 |/
620 o 0: 9ae2ed22e576 'A'
620 o 0: 9ae2ed22e576 'A'
621
621
622
622
623 $ cd ..
623 $ cd ..
624
624
625 More advanced tests
625 More advanced tests
626
626
627 rebase on ancestor with revset
627 rebase on ancestor with revset
628
628
629 $ hg clone -q -u . ah ah5
629 $ hg clone -q -u . ah ah5
630 $ cd ah5
630 $ cd ah5
631 $ hg rebase -r '6::' -d 2
631 $ hg rebase -r '6::' -d 2
632 rebasing 6:3d8a618087a7 "G"
632 rebasing 6:3d8a618087a7 "G"
633 rebasing 7:72434a4e60b0 "H"
633 rebasing 7:72434a4e60b0 "H"
634 rebasing 8:479ddb54a924 "I" (tip)
634 rebasing 8:479ddb54a924 "I" (tip)
635 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg
635 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg
636 $ hg tglog
636 $ hg tglog
637 o 8: fcb52e68a694 'I'
637 o 8: fcb52e68a694 'I'
638 |
638 |
639 o 7: 77bd65cd7600 'H'
639 o 7: 77bd65cd7600 'H'
640 |
640 |
641 o 6: 12d0e738fb18 'G'
641 o 6: 12d0e738fb18 'G'
642 |
642 |
643 | o 5: 41bfcc75ed73 'F'
643 | o 5: 41bfcc75ed73 'F'
644 | |
644 | |
645 | o 4: c01897464e7f 'E'
645 | o 4: c01897464e7f 'E'
646 | |
646 | |
647 | o 3: ffd453c31098 'D'
647 | o 3: ffd453c31098 'D'
648 |/
648 |/
649 o 2: c9e50f6cdc55 'C'
649 o 2: c9e50f6cdc55 'C'
650 |
650 |
651 | o 1: 8fd0f7e49f53 'B'
651 | o 1: 8fd0f7e49f53 'B'
652 |/
652 |/
653 o 0: 9ae2ed22e576 'A'
653 o 0: 9ae2ed22e576 'A'
654
654
655 $ cd ..
655 $ cd ..
656
656
657
657
658 rebase with multiple root.
658 rebase with multiple root.
659 We rebase E and G on B
659 We rebase E and G on B
660 We would expect heads are I, F if it was supported
660 We would expect heads are I, F if it was supported
661
661
662 $ hg clone -q -u . ah ah6
662 $ hg clone -q -u . ah ah6
663 $ cd ah6
663 $ cd ah6
664 $ hg rebase -r '(4+6)::' -d 1
664 $ hg rebase -r '(4+6)::' -d 1
665 rebasing 4:c01897464e7f "E"
665 rebasing 4:c01897464e7f "E"
666 rebasing 5:41bfcc75ed73 "F"
666 rebasing 5:41bfcc75ed73 "F"
667 rebasing 6:3d8a618087a7 "G"
667 rebasing 6:3d8a618087a7 "G"
668 rebasing 7:72434a4e60b0 "H"
668 rebasing 7:72434a4e60b0 "H"
669 rebasing 8:479ddb54a924 "I" (tip)
669 rebasing 8:479ddb54a924 "I" (tip)
670 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg
670 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg
671 $ hg tglog
671 $ hg tglog
672 o 8: 9136df9a87cf 'I'
672 o 8: 9136df9a87cf 'I'
673 |
673 |
674 o 7: 23e8f30da832 'H'
674 o 7: 23e8f30da832 'H'
675 |
675 |
676 o 6: b0efe8534e8b 'G'
676 o 6: b0efe8534e8b 'G'
677 |
677 |
678 | o 5: 6eb5b496ab79 'F'
678 | o 5: 6eb5b496ab79 'F'
679 | |
679 | |
680 | o 4: d15eade9b0b1 'E'
680 | o 4: d15eade9b0b1 'E'
681 |/
681 |/
682 | o 3: ffd453c31098 'D'
682 | o 3: ffd453c31098 'D'
683 | |
683 | |
684 | o 2: c9e50f6cdc55 'C'
684 | o 2: c9e50f6cdc55 'C'
685 | |
685 | |
686 o | 1: 8fd0f7e49f53 'B'
686 o | 1: 8fd0f7e49f53 'B'
687 |/
687 |/
688 o 0: 9ae2ed22e576 'A'
688 o 0: 9ae2ed22e576 'A'
689
689
690 $ cd ..
690 $ cd ..
691
691
692 More complex rebase with multiple roots
692 More complex rebase with multiple roots
693 each root have a different common ancestor with the destination and this is a detach
693 each root have a different common ancestor with the destination and this is a detach
694
694
695 (setup)
695 (setup)
696
696
697 $ hg clone -q -u . a a8
697 $ hg clone -q -u . a a8
698 $ cd a8
698 $ cd a8
699 $ echo I > I
699 $ echo I > I
700 $ hg add I
700 $ hg add I
701 $ hg commit -m I
701 $ hg commit -m I
702 $ hg up 4
702 $ hg up 4
703 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
703 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
704 $ echo I > J
704 $ echo I > J
705 $ hg add J
705 $ hg add J
706 $ hg commit -m J
706 $ hg commit -m J
707 created new head
707 created new head
708 $ echo I > K
708 $ echo I > K
709 $ hg add K
709 $ hg add K
710 $ hg commit -m K
710 $ hg commit -m K
711 $ hg tglog
711 $ hg tglog
712 @ 10: 23a4ace37988 'K'
712 @ 10: 23a4ace37988 'K'
713 |
713 |
714 o 9: 1301922eeb0c 'J'
714 o 9: 1301922eeb0c 'J'
715 |
715 |
716 | o 8: e7ec4e813ba6 'I'
716 | o 8: e7ec4e813ba6 'I'
717 | |
717 | |
718 | o 7: 02de42196ebe 'H'
718 | o 7: 02de42196ebe 'H'
719 | |
719 | |
720 +---o 6: eea13746799a 'G'
720 +---o 6: eea13746799a 'G'
721 | |/
721 | |/
722 | o 5: 24b6387c8c8c 'F'
722 | o 5: 24b6387c8c8c 'F'
723 | |
723 | |
724 o | 4: 9520eea781bc 'E'
724 o | 4: 9520eea781bc 'E'
725 |/
725 |/
726 | o 3: 32af7686d403 'D'
726 | o 3: 32af7686d403 'D'
727 | |
727 | |
728 | o 2: 5fddd98957c8 'C'
728 | o 2: 5fddd98957c8 'C'
729 | |
729 | |
730 | o 1: 42ccdea3bb16 'B'
730 | o 1: 42ccdea3bb16 'B'
731 |/
731 |/
732 o 0: cd010b8cd998 'A'
732 o 0: cd010b8cd998 'A'
733
733
734 (actual test)
734 (actual test)
735
735
736 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
736 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
737 rebasing 8:e7ec4e813ba6 "I"
737 rebasing 8:e7ec4e813ba6 "I"
738 rebasing 10:23a4ace37988 "K" (tip)
738 rebasing 10:23a4ace37988 "K" (tip)
739 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg
739 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg
740 $ hg log --rev 'children(desc(G))'
740 $ hg log --rev 'children(desc(G))'
741 changeset: 9:adb617877056
741 changeset: 9:adb617877056
742 parent: 6:eea13746799a
742 parent: 6:eea13746799a
743 user: test
743 user: test
744 date: Thu Jan 01 00:00:00 1970 +0000
744 date: Thu Jan 01 00:00:00 1970 +0000
745 summary: I
745 summary: I
746
746
747 changeset: 10:882431a34a0e
747 changeset: 10:882431a34a0e
748 tag: tip
748 tag: tip
749 parent: 6:eea13746799a
749 parent: 6:eea13746799a
750 user: test
750 user: test
751 date: Thu Jan 01 00:00:00 1970 +0000
751 date: Thu Jan 01 00:00:00 1970 +0000
752 summary: K
752 summary: K
753
753
754 $ hg tglog
754 $ hg tglog
755 @ 10: 882431a34a0e 'K'
755 @ 10: 882431a34a0e 'K'
756 |
756 |
757 | o 9: adb617877056 'I'
757 | o 9: adb617877056 'I'
758 |/
758 |/
759 | o 8: 1301922eeb0c 'J'
759 | o 8: 1301922eeb0c 'J'
760 | |
760 | |
761 | | o 7: 02de42196ebe 'H'
761 | | o 7: 02de42196ebe 'H'
762 | | |
762 | | |
763 o---+ 6: eea13746799a 'G'
763 o---+ 6: eea13746799a 'G'
764 |/ /
764 |/ /
765 | o 5: 24b6387c8c8c 'F'
765 | o 5: 24b6387c8c8c 'F'
766 | |
766 | |
767 o | 4: 9520eea781bc 'E'
767 o | 4: 9520eea781bc 'E'
768 |/
768 |/
769 | o 3: 32af7686d403 'D'
769 | o 3: 32af7686d403 'D'
770 | |
770 | |
771 | o 2: 5fddd98957c8 'C'
771 | o 2: 5fddd98957c8 'C'
772 | |
772 | |
773 | o 1: 42ccdea3bb16 'B'
773 | o 1: 42ccdea3bb16 'B'
774 |/
774 |/
775 o 0: cd010b8cd998 'A'
775 o 0: cd010b8cd998 'A'
776
776
777
777
778 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
778 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
779
779
780 $ cd ..
780 $ cd ..
781 $ hg init cwd-vanish
781 $ hg init cwd-vanish
782 $ cd cwd-vanish
782 $ cd cwd-vanish
783 $ touch initial-file
783 $ touch initial-file
784 $ hg add initial-file
784 $ hg add initial-file
785 $ hg commit -m 'initial commit'
785 $ hg commit -m 'initial commit'
786 $ touch dest-file
786 $ touch dest-file
787 $ hg add dest-file
787 $ hg add dest-file
788 $ hg commit -m 'dest commit'
788 $ hg commit -m 'dest commit'
789 $ hg up 0
789 $ hg up 0
790 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
790 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
791 $ touch other-file
791 $ touch other-file
792 $ hg add other-file
792 $ hg add other-file
793 $ hg commit -m 'first source commit'
793 $ hg commit -m 'first source commit'
794 created new head
794 created new head
795 $ mkdir subdir
795 $ mkdir subdir
796 $ cd subdir
796 $ cd subdir
797 $ touch subfile
797 $ touch subfile
798 $ hg add subfile
798 $ hg add subfile
799 $ hg commit -m 'second source with subdir'
799 $ hg commit -m 'second source with subdir'
800
800
801 $ hg rebase -b . -d 1 --traceback
801 $ hg rebase -b . -d 1 --traceback
802 rebasing 2:779a07b1b7a0 "first source commit"
802 rebasing 2:779a07b1b7a0 "first source commit"
803 current directory was removed (rmcwd !)
803 current directory was removed (rmcwd !)
804 (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !)
804 (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !)
805 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
805 rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip)
806 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg
806 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg
807
807
808 Get back to the root of cwd-vanish. Note that even though `cd ..`
808 Get back to the root of cwd-vanish. Note that even though `cd ..`
809 works on most systems, it does not work on FreeBSD 10, so we use an
809 works on most systems, it does not work on FreeBSD 10, so we use an
810 absolute path to get back to the repository.
810 absolute path to get back to the repository.
811 $ cd $TESTTMP
811 $ cd $TESTTMP
812
812
813 Test that rebase is done in topo order (issue5370)
813 Test that rebase is done in topo order (issue5370)
814
814
815 $ hg init order
815 $ hg init order
816 $ cd order
816 $ cd order
817 $ touch a && hg add a && hg ci -m A
817 $ touch a && hg add a && hg ci -m A
818 $ touch b && hg add b && hg ci -m B
818 $ touch b && hg add b && hg ci -m B
819 $ touch c && hg add c && hg ci -m C
819 $ touch c && hg add c && hg ci -m C
820 $ hg up 1
820 $ hg up 1
821 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 $ touch d && hg add d && hg ci -m D
822 $ touch d && hg add d && hg ci -m D
823 created new head
823 created new head
824 $ hg up 2
824 $ hg up 2
825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
826 $ touch e && hg add e && hg ci -m E
826 $ touch e && hg add e && hg ci -m E
827 $ hg up 3
827 $ hg up 3
828 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
828 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
829 $ touch f && hg add f && hg ci -m F
829 $ touch f && hg add f && hg ci -m F
830 $ hg up 0
830 $ hg up 0
831 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
831 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
832 $ touch g && hg add g && hg ci -m G
832 $ touch g && hg add g && hg ci -m G
833 created new head
833 created new head
834
834
835 $ hg tglog
835 $ hg tglog
836 @ 6: 124bb27b6f28 'G'
836 @ 6: 124bb27b6f28 'G'
837 |
837 |
838 | o 5: 412b391de760 'F'
838 | o 5: 412b391de760 'F'
839 | |
839 | |
840 | | o 4: 82ae8dc7a9b7 'E'
840 | | o 4: 82ae8dc7a9b7 'E'
841 | | |
841 | | |
842 | o | 3: ab709c9f7171 'D'
842 | o | 3: ab709c9f7171 'D'
843 | | |
843 | | |
844 | | o 2: d84f5cfaaf14 'C'
844 | | o 2: d84f5cfaaf14 'C'
845 | |/
845 | |/
846 | o 1: 76035bbd54bd 'B'
846 | o 1: 76035bbd54bd 'B'
847 |/
847 |/
848 o 0: 216878401574 'A'
848 o 0: 216878401574 'A'
849
849
850
850
851 $ hg rebase -s 1 -d 6
851 $ hg rebase -s 1 -d 6
852 rebasing 1:76035bbd54bd "B"
852 rebasing 1:76035bbd54bd "B"
853 rebasing 2:d84f5cfaaf14 "C"
853 rebasing 2:d84f5cfaaf14 "C"
854 rebasing 4:82ae8dc7a9b7 "E"
854 rebasing 4:82ae8dc7a9b7 "E"
855 rebasing 3:ab709c9f7171 "D"
855 rebasing 3:ab709c9f7171 "D"
856 rebasing 5:412b391de760 "F"
856 rebasing 5:412b391de760 "F"
857 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg
857 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg
858
858
859 $ hg tglog
859 $ hg tglog
860 o 6: 31884cfb735e 'F'
860 o 6: 31884cfb735e 'F'
861 |
861 |
862 o 5: 6d89fa5b0909 'D'
862 o 5: 6d89fa5b0909 'D'
863 |
863 |
864 | o 4: de64d97c697b 'E'
864 | o 4: de64d97c697b 'E'
865 | |
865 | |
866 | o 3: b18e4d2d0aa1 'C'
866 | o 3: b18e4d2d0aa1 'C'
867 |/
867 |/
868 o 2: 0983daf9ff6a 'B'
868 o 2: 0983daf9ff6a 'B'
869 |
869 |
870 @ 1: 124bb27b6f28 'G'
870 @ 1: 124bb27b6f28 'G'
871 |
871 |
872 o 0: 216878401574 'A'
872 o 0: 216878401574 'A'
873
873
874
874
875 Test experimental revset
875 Test experimental revset
876 ========================
876 ========================
877
877
878 $ cd ../cwd-vanish
878 $ cd ../cwd-vanish
879
879
880 Make the repo a bit more interesting
880 Make the repo a bit more interesting
881
881
882 $ hg up 1
882 $ hg up 1
883 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
883 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
884 $ echo aaa > aaa
884 $ echo aaa > aaa
885 $ hg add aaa
885 $ hg add aaa
886 $ hg commit -m aaa
886 $ hg commit -m aaa
887 created new head
887 created new head
888 $ hg log -G
888 $ hg log -G
889 @ changeset: 4:5f7bc9025ed2
889 @ changeset: 4:5f7bc9025ed2
890 | tag: tip
890 | tag: tip
891 | parent: 1:58d79cc1cf43
891 | parent: 1:58d79cc1cf43
892 | user: test
892 | user: test
893 | date: Thu Jan 01 00:00:00 1970 +0000
893 | date: Thu Jan 01 00:00:00 1970 +0000
894 | summary: aaa
894 | summary: aaa
895 |
895 |
896 | o changeset: 3:1910d5ff34ea
896 | o changeset: 3:1910d5ff34ea
897 | | user: test
897 | | user: test
898 | | date: Thu Jan 01 00:00:00 1970 +0000
898 | | date: Thu Jan 01 00:00:00 1970 +0000
899 | | summary: second source with subdir
899 | | summary: second source with subdir
900 | |
900 | |
901 | o changeset: 2:82901330b6ef
901 | o changeset: 2:82901330b6ef
902 |/ user: test
902 |/ user: test
903 | date: Thu Jan 01 00:00:00 1970 +0000
903 | date: Thu Jan 01 00:00:00 1970 +0000
904 | summary: first source commit
904 | summary: first source commit
905 |
905 |
906 o changeset: 1:58d79cc1cf43
906 o changeset: 1:58d79cc1cf43
907 | user: test
907 | user: test
908 | date: Thu Jan 01 00:00:00 1970 +0000
908 | date: Thu Jan 01 00:00:00 1970 +0000
909 | summary: dest commit
909 | summary: dest commit
910 |
910 |
911 o changeset: 0:e94b687f7da3
911 o changeset: 0:e94b687f7da3
912 user: test
912 user: test
913 date: Thu Jan 01 00:00:00 1970 +0000
913 date: Thu Jan 01 00:00:00 1970 +0000
914 summary: initial commit
914 summary: initial commit
915
915
916
916
917 Testing from lower head
917 Testing from lower head
918
918
919 $ hg up 3
919 $ hg up 3
920 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
920 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
921 $ hg log -r '_destrebase()'
921 $ hg log -r '_destrebase()'
922 changeset: 4:5f7bc9025ed2
922 changeset: 4:5f7bc9025ed2
923 tag: tip
923 tag: tip
924 parent: 1:58d79cc1cf43
924 parent: 1:58d79cc1cf43
925 user: test
925 user: test
926 date: Thu Jan 01 00:00:00 1970 +0000
926 date: Thu Jan 01 00:00:00 1970 +0000
927 summary: aaa
927 summary: aaa
928
928
929
929
930 Testing from upper head
930 Testing from upper head
931
931
932 $ hg log -r '_destrebase(4)'
932 $ hg log -r '_destrebase(4)'
933 changeset: 3:1910d5ff34ea
933 changeset: 3:1910d5ff34ea
934 user: test
934 user: test
935 date: Thu Jan 01 00:00:00 1970 +0000
935 date: Thu Jan 01 00:00:00 1970 +0000
936 summary: second source with subdir
936 summary: second source with subdir
937
937
938 $ hg up 4
938 $ hg up 4
939 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
939 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
940 $ hg log -r '_destrebase()'
940 $ hg log -r '_destrebase()'
941 changeset: 3:1910d5ff34ea
941 changeset: 3:1910d5ff34ea
942 user: test
942 user: test
943 date: Thu Jan 01 00:00:00 1970 +0000
943 date: Thu Jan 01 00:00:00 1970 +0000
944 summary: second source with subdir
944 summary: second source with subdir
945
945
946 Testing rebase being called inside another transaction
946 Testing rebase being called inside another transaction
947
947
948 $ cd $TESTTMP
948 $ cd $TESTTMP
949 $ hg init tr-state
949 $ hg init tr-state
950 $ cd tr-state
950 $ cd tr-state
951 $ cat > $TESTTMP/wraprebase.py <<EOF
951 $ cat > $TESTTMP/wraprebase.py <<EOF
952 > from __future__ import absolute_import
952 > from __future__ import absolute_import
953 > from mercurial import extensions
953 > from mercurial import extensions
954 > def _rebase(orig, ui, repo, *args, **kwargs):
954 > def _rebase(orig, ui, repo, *args, **kwargs):
955 > with repo.wlock():
955 > with repo.wlock():
956 > with repo.lock():
956 > with repo.lock():
957 > with repo.transaction(b'wrappedrebase'):
957 > with repo.transaction(b'wrappedrebase'):
958 > return orig(ui, repo, *args, **kwargs)
958 > return orig(ui, repo, *args, **kwargs)
959 > def wraprebase(loaded):
959 > def wraprebase(loaded):
960 > assert loaded
960 > assert loaded
961 > rebasemod = extensions.find(b'rebase')
961 > rebasemod = extensions.find(b'rebase')
962 > extensions.wrapcommand(rebasemod.cmdtable, b'rebase', _rebase)
962 > extensions.wrapcommand(rebasemod.cmdtable, b'rebase', _rebase)
963 > def extsetup(ui):
963 > def extsetup(ui):
964 > extensions.afterloaded(b'rebase', wraprebase)
964 > extensions.afterloaded(b'rebase', wraprebase)
965 > EOF
965 > EOF
966
966
967 $ cat >> .hg/hgrc <<EOF
967 $ cat >> .hg/hgrc <<EOF
968 > [extensions]
968 > [extensions]
969 > wraprebase=$TESTTMP/wraprebase.py
969 > wraprebase=$TESTTMP/wraprebase.py
970 > [experimental]
970 > [experimental]
971 > evolution=true
971 > evolution=true
972 > EOF
972 > EOF
973
973
974 $ hg debugdrawdag <<'EOS'
974 $ hg debugdrawdag <<'EOS'
975 > B C
975 > B C
976 > |/
976 > |/
977 > A
977 > A
978 > EOS
978 > EOS
979
979
980 $ hg rebase -s C -d B
980 $ hg rebase -s C -d B
981 rebasing 2:dc0947a82db8 "C" (C tip)
981 rebasing 2:dc0947a82db8 "C" (C tip)
982
982
983 $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist'
983 $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist'
984 [1]
984 [1]
@@ -1,194 +1,194 b''
1 #require no-windows
1 #require no-windows
2
2
3 # Tests for the complicated linknode logic in remotefilelog.py::ancestormap()
3 # Tests for the complicated linknode logic in remotefilelog.py::ancestormap()
4
4
5 $ . "$TESTDIR/remotefilelog-library.sh"
5 $ . "$TESTDIR/remotefilelog-library.sh"
6
6
7 $ hg init master
7 $ hg init master
8 $ cd master
8 $ cd master
9 $ cat >> .hg/hgrc <<EOF
9 $ cat >> .hg/hgrc <<EOF
10 > [remotefilelog]
10 > [remotefilelog]
11 > server=True
11 > server=True
12 > serverexpiration=-1
12 > serverexpiration=-1
13 > EOF
13 > EOF
14 $ echo x > x
14 $ echo x > x
15 $ hg commit -qAm x
15 $ hg commit -qAm x
16 $ cd ..
16 $ cd ..
17
17
18 $ hgcloneshallow ssh://user@dummy/master shallow -q
18 $ hgcloneshallow ssh://user@dummy/master shallow -q
19 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
19 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
20
20
21 # Rebase produces correct log -f linknodes
21 # Rebase produces correct log -f linknodes
22
22
23 $ cd shallow
23 $ cd shallow
24 $ echo y > y
24 $ echo y > y
25 $ hg commit -qAm y
25 $ hg commit -qAm y
26 $ hg up 0
26 $ hg up 0
27 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
28 $ echo x >> x
28 $ echo x >> x
29 $ hg commit -qAm xx
29 $ hg commit -qAm xx
30 $ hg log -f x --template "{node|short}\n"
30 $ hg log -f x --template "{node|short}\n"
31 0632994590a8
31 0632994590a8
32 b292c1e3311f
32 b292c1e3311f
33
33
34 $ hg rebase -d 1
34 $ hg rebase -d 1
35 rebasing 2:0632994590a8 "xx" (tip)
35 rebasing 2:0632994590a8 "xx" (tip)
36 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/0632994590a8-0bc786d8-rebase.hg (glob)
36 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/0632994590a8-0bc786d8-rebase.hg (glob)
37 $ hg log -f x --template "{node|short}\n"
37 $ hg log -f x --template "{node|short}\n"
38 81deab2073bc
38 81deab2073bc
39 b292c1e3311f
39 b292c1e3311f
40
40
41 # Rebase back, log -f still works
41 # Rebase back, log -f still works
42
42
43 $ hg rebase -d 0 -r 2
43 $ hg rebase -d 0 -r 2
44 rebasing 2:81deab2073bc "xx" (tip)
44 rebasing 2:81deab2073bc "xx" (tip)
45 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/81deab2073bc-80cb4fda-rebase.hg (glob)
45 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/81deab2073bc-80cb4fda-rebase.hg (glob)
46 $ hg log -f x --template "{node|short}\n"
46 $ hg log -f x --template "{node|short}\n"
47 b3fca10fb42d
47 b3fca10fb42d
48 b292c1e3311f
48 b292c1e3311f
49
49
50 $ hg rebase -d 1 -r 2
50 $ hg rebase -d 1 -r 2
51 rebasing 2:b3fca10fb42d "xx" (tip)
51 rebasing 2:b3fca10fb42d "xx" (tip)
52 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/b3fca10fb42d-da73a0c7-rebase.hg (glob)
52 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/b3fca10fb42d-da73a0c7-rebase.hg (glob)
53
53
54 $ cd ..
54 $ cd ..
55
55
56 # Reset repos
56 # Reset repos
57 $ clearcache
57 $ clearcache
58
58
59 $ rm -rf master
59 $ rm -rf master
60 $ rm -rf shallow
60 $ rm -rf shallow
61 $ hg init master
61 $ hg init master
62 $ cd master
62 $ cd master
63 $ cat >> .hg/hgrc <<EOF
63 $ cat >> .hg/hgrc <<EOF
64 > [remotefilelog]
64 > [remotefilelog]
65 > server=True
65 > server=True
66 > serverexpiration=-1
66 > serverexpiration=-1
67 > EOF
67 > EOF
68 $ echo x > x
68 $ echo x > x
69 $ hg commit -qAm x
69 $ hg commit -qAm x
70 $ cd ..
70 $ cd ..
71
71
72 $ hgcloneshallow ssh://user@dummy/master shallow -q
72 $ hgcloneshallow ssh://user@dummy/master shallow -q
73 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
73 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
74
74
75 # Rebase stack onto landed commit
75 # Rebase stack onto landed commit
76
76
77 $ cd master
77 $ cd master
78 $ echo x >> x
78 $ echo x >> x
79 $ hg commit -Aqm xx
79 $ hg commit -Aqm xx
80
80
81 $ cd ../shallow
81 $ cd ../shallow
82 $ echo x >> x
82 $ echo x >> x
83 $ hg commit -Aqm xx2
83 $ hg commit -Aqm xx2
84 $ echo y >> x
84 $ echo y >> x
85 $ hg commit -Aqm xxy
85 $ hg commit -Aqm xxy
86
86
87 $ hg pull -q
87 $ hg pull -q
88 $ hg rebase -d tip
88 $ hg rebase -d tip
89 rebasing 1:4549721d828f "xx2"
89 rebasing 1:4549721d828f "xx2"
90 note: rebase of 1:4549721d828f "xx2" created no changes to commit
90 note: not rebasing 1:4549721d828f "xx2", its destination already has all its changes
91 rebasing 2:5ef6d97e851c "xxy"
91 rebasing 2:5ef6d97e851c "xxy"
92 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/4549721d828f-b084e33c-rebase.hg (glob)
92 saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/4549721d828f-b084e33c-rebase.hg (glob)
93 $ hg log -f x --template '{node|short}\n'
93 $ hg log -f x --template '{node|short}\n'
94 4ae8e31c85ef
94 4ae8e31c85ef
95 0632994590a8
95 0632994590a8
96 b292c1e3311f
96 b292c1e3311f
97
97
98 $ cd ..
98 $ cd ..
99
99
100 # system cache has invalid linknode, but .hg/store/data has valid
100 # system cache has invalid linknode, but .hg/store/data has valid
101
101
102 $ cd shallow
102 $ cd shallow
103 $ hg strip -r 1 -q
103 $ hg strip -r 1 -q
104 $ rm -rf .hg/store/data/*
104 $ rm -rf .hg/store/data/*
105 $ echo x >> x
105 $ echo x >> x
106 $ hg commit -Aqm xx_local
106 $ hg commit -Aqm xx_local
107 $ hg log -f x --template '{rev}:{node|short}\n'
107 $ hg log -f x --template '{rev}:{node|short}\n'
108 1:21847713771d
108 1:21847713771d
109 0:b292c1e3311f
109 0:b292c1e3311f
110
110
111 $ cd ..
111 $ cd ..
112 $ rm -rf shallow
112 $ rm -rf shallow
113
113
114 /* Local linknode is invalid; remote linknode is valid (formerly slow case) */
114 /* Local linknode is invalid; remote linknode is valid (formerly slow case) */
115
115
116 $ hgcloneshallow ssh://user@dummy/master shallow -q
116 $ hgcloneshallow ssh://user@dummy/master shallow -q
117 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
117 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
118 $ cd shallow
118 $ cd shallow
119 $ echo x >> x
119 $ echo x >> x
120 $ hg commit -Aqm xx2
120 $ hg commit -Aqm xx2
121 $ cd ../master
121 $ cd ../master
122 $ echo y >> y
122 $ echo y >> y
123 $ hg commit -Aqm yy2
123 $ hg commit -Aqm yy2
124 $ echo x >> x
124 $ echo x >> x
125 $ hg commit -Aqm xx2-fake-rebased
125 $ hg commit -Aqm xx2-fake-rebased
126 $ echo y >> y
126 $ echo y >> y
127 $ hg commit -Aqm yy3
127 $ hg commit -Aqm yy3
128 $ cd ../shallow
128 $ cd ../shallow
129 $ hg pull --config remotefilelog.debug=True
129 $ hg pull --config remotefilelog.debug=True
130 pulling from ssh://user@dummy/master
130 pulling from ssh://user@dummy/master
131 searching for changes
131 searching for changes
132 adding changesets
132 adding changesets
133 adding manifests
133 adding manifests
134 adding file changes
134 adding file changes
135 added 3 changesets with 0 changes to 0 files (+1 heads)
135 added 3 changesets with 0 changes to 0 files (+1 heads)
136 new changesets 01979f9404f8:7200df4e0aca
136 new changesets 01979f9404f8:7200df4e0aca
137 (run 'hg heads' to see heads, 'hg merge' to merge)
137 (run 'hg heads' to see heads, 'hg merge' to merge)
138 $ hg update tip -q
138 $ hg update tip -q
139 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
139 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
140 $ echo x > x
140 $ echo x > x
141 $ hg commit -qAm xx3
141 $ hg commit -qAm xx3
142
142
143 # At this point, the linknode points to c1254e70bad1 instead of 32e6611f6149
143 # At this point, the linknode points to c1254e70bad1 instead of 32e6611f6149
144 $ hg log -G -T '{node|short} {desc} {phase} {files}\n'
144 $ hg log -G -T '{node|short} {desc} {phase} {files}\n'
145 @ a5957b6bf0bd xx3 draft x
145 @ a5957b6bf0bd xx3 draft x
146 |
146 |
147 o 7200df4e0aca yy3 public y
147 o 7200df4e0aca yy3 public y
148 |
148 |
149 o 32e6611f6149 xx2-fake-rebased public x
149 o 32e6611f6149 xx2-fake-rebased public x
150 |
150 |
151 o 01979f9404f8 yy2 public y
151 o 01979f9404f8 yy2 public y
152 |
152 |
153 | o c1254e70bad1 xx2 draft x
153 | o c1254e70bad1 xx2 draft x
154 |/
154 |/
155 o 0632994590a8 xx public x
155 o 0632994590a8 xx public x
156 |
156 |
157 o b292c1e3311f x public x
157 o b292c1e3311f x public x
158
158
159 # Check the contents of the local blob for incorrect linknode
159 # Check the contents of the local blob for incorrect linknode
160 $ hg debugremotefilelog .hg/store/data/11f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
160 $ hg debugremotefilelog .hg/store/data/11f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
161 size: 6 bytes
161 size: 6 bytes
162 path: .hg/store/data/11f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
162 path: .hg/store/data/11f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
163 key: d4a3ed9310e5
163 key: d4a3ed9310e5
164
164
165 node => p1 p2 linknode copyfrom
165 node => p1 p2 linknode copyfrom
166 d4a3ed9310e5 => aee31534993a 000000000000 c1254e70bad1
166 d4a3ed9310e5 => aee31534993a 000000000000 c1254e70bad1
167 aee31534993a => 1406e7411862 000000000000 0632994590a8
167 aee31534993a => 1406e7411862 000000000000 0632994590a8
168 1406e7411862 => 000000000000 000000000000 b292c1e3311f
168 1406e7411862 => 000000000000 000000000000 b292c1e3311f
169
169
170 # Verify that we do a fetch on the first log (remote blob fetch for linkrev fix)
170 # Verify that we do a fetch on the first log (remote blob fetch for linkrev fix)
171 $ hg log -f x -T '{node|short} {desc} {phase} {files}\n'
171 $ hg log -f x -T '{node|short} {desc} {phase} {files}\n'
172 a5957b6bf0bd xx3 draft x
172 a5957b6bf0bd xx3 draft x
173 32e6611f6149 xx2-fake-rebased public x
173 32e6611f6149 xx2-fake-rebased public x
174 0632994590a8 xx public x
174 0632994590a8 xx public x
175 b292c1e3311f x public x
175 b292c1e3311f x public x
176 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
176 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
177
177
178 # But not after that
178 # But not after that
179 $ hg log -f x -T '{node|short} {desc} {phase} {files}\n'
179 $ hg log -f x -T '{node|short} {desc} {phase} {files}\n'
180 a5957b6bf0bd xx3 draft x
180 a5957b6bf0bd xx3 draft x
181 32e6611f6149 xx2-fake-rebased public x
181 32e6611f6149 xx2-fake-rebased public x
182 0632994590a8 xx public x
182 0632994590a8 xx public x
183 b292c1e3311f x public x
183 b292c1e3311f x public x
184
184
185 # Check the contents of the remote blob for correct linknode
185 # Check the contents of the remote blob for correct linknode
186 $ hg debugremotefilelog $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
186 $ hg debugremotefilelog $CACHEDIR/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
187 size: 6 bytes
187 size: 6 bytes
188 path: $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
188 path: $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/d4a3ed9310e5bd9887e3bf779da5077efab28216
189 key: d4a3ed9310e5
189 key: d4a3ed9310e5
190
190
191 node => p1 p2 linknode copyfrom
191 node => p1 p2 linknode copyfrom
192 d4a3ed9310e5 => aee31534993a 000000000000 32e6611f6149
192 d4a3ed9310e5 => aee31534993a 000000000000 32e6611f6149
193 aee31534993a => 1406e7411862 000000000000 0632994590a8
193 aee31534993a => 1406e7411862 000000000000 0632994590a8
194 1406e7411862 => 000000000000 000000000000 b292c1e3311f
194 1406e7411862 => 000000000000 000000000000 b292c1e3311f
General Comments 0
You need to be logged in to leave comments. Login now