##// END OF EJS Templates
morestatus: mention --stop even if not using --verbose...
Kyle Lippincott -
r45774:a253ded5 default
parent child Browse files
Show More
@@ -1,374 +1,383 b''
1 # state.py - writing and reading state files in Mercurial
1 # state.py - writing and reading state files in Mercurial
2 #
2 #
3 # Copyright 2018 Pulkit Goyal <pulkitmgoyal@gmail.com>
3 # Copyright 2018 Pulkit Goyal <pulkitmgoyal@gmail.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 """
8 """
9 This file contains class to wrap the state for commands and other
9 This file contains class to wrap the state for commands and other
10 related logic.
10 related logic.
11
11
12 All the data related to the command state is stored as dictionary in the object.
12 All the data related to the command state is stored as dictionary in the object.
13 The class has methods using which the data can be stored to disk in a file under
13 The class has methods using which the data can be stored to disk in a file under
14 .hg/ directory.
14 .hg/ directory.
15
15
16 We store the data on disk in cbor, for which we use the CBOR format to encode
16 We store the data on disk in cbor, for which we use the CBOR format to encode
17 the data.
17 the data.
18 """
18 """
19
19
20 from __future__ import absolute_import
20 from __future__ import absolute_import
21
21
22 import contextlib
22 import contextlib
23
23
24 from .i18n import _
24 from .i18n import _
25
25
26 from . import (
26 from . import (
27 error,
27 error,
28 pycompat,
28 pycompat,
29 util,
29 util,
30 )
30 )
31 from .utils import cborutil
31 from .utils import cborutil
32
32
33 if pycompat.TYPE_CHECKING:
33 if pycompat.TYPE_CHECKING:
34 from typing import (
34 from typing import (
35 Any,
35 Any,
36 Dict,
36 Dict,
37 )
37 )
38
38
39 for t in (Any, Dict):
39 for t in (Any, Dict):
40 assert t
40 assert t
41
41
42
42
43 class cmdstate(object):
43 class cmdstate(object):
44 """a wrapper class to store the state of commands like `rebase`, `graft`,
44 """a wrapper class to store the state of commands like `rebase`, `graft`,
45 `histedit`, `shelve` etc. Extensions can also use this to write state files.
45 `histedit`, `shelve` etc. Extensions can also use this to write state files.
46
46
47 All the data for the state is stored in the form of key-value pairs in a
47 All the data for the state is stored in the form of key-value pairs in a
48 dictionary.
48 dictionary.
49
49
50 The class object can write all the data to a file in .hg/ directory and
50 The class object can write all the data to a file in .hg/ directory and
51 can populate the object data reading that file.
51 can populate the object data reading that file.
52
52
53 Uses cbor to serialize and deserialize data while writing and reading from
53 Uses cbor to serialize and deserialize data while writing and reading from
54 disk.
54 disk.
55 """
55 """
56
56
57 def __init__(self, repo, fname):
57 def __init__(self, repo, fname):
58 """ repo is the repo object
58 """ repo is the repo object
59 fname is the file name in which data should be stored in .hg directory
59 fname is the file name in which data should be stored in .hg directory
60 """
60 """
61 self._repo = repo
61 self._repo = repo
62 self.fname = fname
62 self.fname = fname
63
63
64 def read(self):
64 def read(self):
65 # type: () -> Dict[bytes, Any]
65 # type: () -> Dict[bytes, Any]
66 """read the existing state file and return a dict of data stored"""
66 """read the existing state file and return a dict of data stored"""
67 return self._read()
67 return self._read()
68
68
69 def save(self, version, data):
69 def save(self, version, data):
70 """write all the state data stored to .hg/<filename> file
70 """write all the state data stored to .hg/<filename> file
71
71
72 we use third-party library cbor to serialize data to write in the file.
72 we use third-party library cbor to serialize data to write in the file.
73 """
73 """
74 if not isinstance(version, int):
74 if not isinstance(version, int):
75 raise error.ProgrammingError(
75 raise error.ProgrammingError(
76 b"version of state file should be an integer"
76 b"version of state file should be an integer"
77 )
77 )
78
78
79 with self._repo.vfs(self.fname, b'wb', atomictemp=True) as fp:
79 with self._repo.vfs(self.fname, b'wb', atomictemp=True) as fp:
80 fp.write(b'%d\n' % version)
80 fp.write(b'%d\n' % version)
81 for chunk in cborutil.streamencode(data):
81 for chunk in cborutil.streamencode(data):
82 fp.write(chunk)
82 fp.write(chunk)
83
83
84 def _read(self):
84 def _read(self):
85 """reads the state file and returns a dictionary which contain
85 """reads the state file and returns a dictionary which contain
86 data in the same format as it was before storing"""
86 data in the same format as it was before storing"""
87 with self._repo.vfs(self.fname, b'rb') as fp:
87 with self._repo.vfs(self.fname, b'rb') as fp:
88 try:
88 try:
89 int(fp.readline())
89 int(fp.readline())
90 except ValueError:
90 except ValueError:
91 raise error.CorruptedState(
91 raise error.CorruptedState(
92 b"unknown version of state file found"
92 b"unknown version of state file found"
93 )
93 )
94
94
95 return cborutil.decodeall(fp.read())[0]
95 return cborutil.decodeall(fp.read())[0]
96
96
97 def delete(self):
97 def delete(self):
98 """drop the state file if exists"""
98 """drop the state file if exists"""
99 util.unlinkpath(self._repo.vfs.join(self.fname), ignoremissing=True)
99 util.unlinkpath(self._repo.vfs.join(self.fname), ignoremissing=True)
100
100
101 def exists(self):
101 def exists(self):
102 """check whether the state file exists or not"""
102 """check whether the state file exists or not"""
103 return self._repo.vfs.exists(self.fname)
103 return self._repo.vfs.exists(self.fname)
104
104
105
105
106 class _statecheck(object):
106 class _statecheck(object):
107 """a utility class that deals with multistep operations like graft,
107 """a utility class that deals with multistep operations like graft,
108 histedit, bisect, update etc and check whether such commands
108 histedit, bisect, update etc and check whether such commands
109 are in an unfinished conditition or not and return appropriate message
109 are in an unfinished conditition or not and return appropriate message
110 and hint.
110 and hint.
111 It also has the ability to register and determine the states of any new
111 It also has the ability to register and determine the states of any new
112 multistep operation or multistep command extension.
112 multistep operation or multistep command extension.
113 """
113 """
114
114
115 def __init__(
115 def __init__(
116 self,
116 self,
117 opname,
117 opname,
118 fname,
118 fname,
119 clearable,
119 clearable,
120 allowcommit,
120 allowcommit,
121 reportonly,
121 reportonly,
122 continueflag,
122 continueflag,
123 stopflag,
123 stopflag,
124 childopnames,
124 childopnames,
125 cmdmsg,
125 cmdmsg,
126 cmdhint,
126 cmdhint,
127 statushint,
127 statushint,
128 abortfunc,
128 abortfunc,
129 continuefunc,
129 continuefunc,
130 ):
130 ):
131 self._opname = opname
131 self._opname = opname
132 self._fname = fname
132 self._fname = fname
133 self._clearable = clearable
133 self._clearable = clearable
134 self._allowcommit = allowcommit
134 self._allowcommit = allowcommit
135 self._reportonly = reportonly
135 self._reportonly = reportonly
136 self._continueflag = continueflag
136 self._continueflag = continueflag
137 self._stopflag = stopflag
137 self._stopflag = stopflag
138 self._childopnames = childopnames
138 self._childopnames = childopnames
139 self._delegating = False
139 self._delegating = False
140 self._cmdmsg = cmdmsg
140 self._cmdmsg = cmdmsg
141 self._cmdhint = cmdhint
141 self._cmdhint = cmdhint
142 self._statushint = statushint
142 self._statushint = statushint
143 self.abortfunc = abortfunc
143 self.abortfunc = abortfunc
144 self.continuefunc = continuefunc
144 self.continuefunc = continuefunc
145
145
146 def statusmsg(self):
146 def statusmsg(self):
147 """returns the hint message corresponding to the command for
147 """returns the hint message corresponding to the command for
148 hg status --verbose
148 hg status --verbose
149 """
149 """
150 if not self._statushint:
150 if not self._statushint:
151 hint = _(
151 hint = _(
152 b'To continue: hg %s --continue\n'
152 b'To continue: hg %s --continue\n'
153 b'To abort: hg %s --abort'
153 b'To abort: hg %s --abort'
154 ) % (self._opname, self._opname)
154 ) % (self._opname, self._opname)
155 if self._stopflag:
155 if self._stopflag:
156 hint = hint + (
156 hint = hint + (
157 _(b'\nTo stop: hg %s --stop') % (self._opname)
157 _(b'\nTo stop: hg %s --stop') % (self._opname)
158 )
158 )
159 return hint
159 return hint
160 return self._statushint
160 return self._statushint
161
161
162 def hint(self):
162 def hint(self):
163 """returns the hint message corresponding to an interrupted
163 """returns the hint message corresponding to an interrupted
164 operation
164 operation
165 """
165 """
166 if not self._cmdhint:
166 if not self._cmdhint:
167 return _(b"use 'hg %s --continue' or 'hg %s --abort'") % (
167 if not self._stopflag:
168 self._opname,
168 return _(b"use 'hg %s --continue' or 'hg %s --abort'") % (
169 self._opname,
169 self._opname,
170 )
170 self._opname,
171 )
172 else:
173 return _(b"use 'hg %s --continue', 'hg %s --abort', "
174 b"or 'hg %s --stop'") % (
175 self._opname,
176 self._opname,
177 self._opname,
178 )
179
171 return self._cmdhint
180 return self._cmdhint
172
181
173 def msg(self):
182 def msg(self):
174 """returns the status message corresponding to the command"""
183 """returns the status message corresponding to the command"""
175 if not self._cmdmsg:
184 if not self._cmdmsg:
176 return _(b'%s in progress') % (self._opname)
185 return _(b'%s in progress') % (self._opname)
177 return self._cmdmsg
186 return self._cmdmsg
178
187
179 def continuemsg(self):
188 def continuemsg(self):
180 """ returns appropriate continue message corresponding to command"""
189 """ returns appropriate continue message corresponding to command"""
181 return _(b'hg %s --continue') % (self._opname)
190 return _(b'hg %s --continue') % (self._opname)
182
191
183 def isunfinished(self, repo):
192 def isunfinished(self, repo):
184 """determines whether a multi-step operation is in progress
193 """determines whether a multi-step operation is in progress
185 or not
194 or not
186 """
195 """
187 if self._opname == b'merge':
196 if self._opname == b'merge':
188 return len(repo[None].parents()) > 1
197 return len(repo[None].parents()) > 1
189 elif self._delegating:
198 elif self._delegating:
190 return False
199 return False
191 else:
200 else:
192 return repo.vfs.exists(self._fname)
201 return repo.vfs.exists(self._fname)
193
202
194
203
195 # A list of statecheck objects for multistep operations like graft.
204 # A list of statecheck objects for multistep operations like graft.
196 _unfinishedstates = []
205 _unfinishedstates = []
197 _unfinishedstatesbyname = {}
206 _unfinishedstatesbyname = {}
198
207
199
208
200 def addunfinished(
209 def addunfinished(
201 opname,
210 opname,
202 fname,
211 fname,
203 clearable=False,
212 clearable=False,
204 allowcommit=False,
213 allowcommit=False,
205 reportonly=False,
214 reportonly=False,
206 continueflag=False,
215 continueflag=False,
207 stopflag=False,
216 stopflag=False,
208 childopnames=None,
217 childopnames=None,
209 cmdmsg=b"",
218 cmdmsg=b"",
210 cmdhint=b"",
219 cmdhint=b"",
211 statushint=b"",
220 statushint=b"",
212 abortfunc=None,
221 abortfunc=None,
213 continuefunc=None,
222 continuefunc=None,
214 ):
223 ):
215 """this registers a new command or operation to unfinishedstates
224 """this registers a new command or operation to unfinishedstates
216 opname is the name the command or operation
225 opname is the name the command or operation
217 fname is the file name in which data should be stored in .hg directory.
226 fname is the file name in which data should be stored in .hg directory.
218 It is None for merge command.
227 It is None for merge command.
219 clearable boolean determines whether or not interrupted states can be
228 clearable boolean determines whether or not interrupted states can be
220 cleared by running `hg update -C .` which in turn deletes the
229 cleared by running `hg update -C .` which in turn deletes the
221 state file.
230 state file.
222 allowcommit boolean decides whether commit is allowed during interrupted
231 allowcommit boolean decides whether commit is allowed during interrupted
223 state or not.
232 state or not.
224 reportonly flag is used for operations like bisect where we just
233 reportonly flag is used for operations like bisect where we just
225 need to detect the operation using 'hg status --verbose'
234 need to detect the operation using 'hg status --verbose'
226 continueflag is a boolean determines whether or not a command supports
235 continueflag is a boolean determines whether or not a command supports
227 `--continue` option or not.
236 `--continue` option or not.
228 stopflag is a boolean that determines whether or not a command supports
237 stopflag is a boolean that determines whether or not a command supports
229 --stop flag
238 --stop flag
230 childopnames is a list of other opnames this op uses as sub-steps of its
239 childopnames is a list of other opnames this op uses as sub-steps of its
231 own execution. They must already be added.
240 own execution. They must already be added.
232 cmdmsg is used to pass a different status message in case standard
241 cmdmsg is used to pass a different status message in case standard
233 message of the format "abort: cmdname in progress" is not desired.
242 message of the format "abort: cmdname in progress" is not desired.
234 cmdhint is used to pass a different hint message in case standard
243 cmdhint is used to pass a different hint message in case standard
235 message of the format "To continue: hg cmdname --continue
244 message of the format "To continue: hg cmdname --continue
236 To abort: hg cmdname --abort" is not desired.
245 To abort: hg cmdname --abort" is not desired.
237 statushint is used to pass a different status message in case standard
246 statushint is used to pass a different status message in case standard
238 message of the format ('To continue: hg cmdname --continue'
247 message of the format ('To continue: hg cmdname --continue'
239 'To abort: hg cmdname --abort') is not desired
248 'To abort: hg cmdname --abort') is not desired
240 abortfunc stores the function required to abort an unfinished state.
249 abortfunc stores the function required to abort an unfinished state.
241 continuefunc stores the function required to finish an interrupted
250 continuefunc stores the function required to finish an interrupted
242 operation.
251 operation.
243 """
252 """
244 childopnames = childopnames or []
253 childopnames = childopnames or []
245 statecheckobj = _statecheck(
254 statecheckobj = _statecheck(
246 opname,
255 opname,
247 fname,
256 fname,
248 clearable,
257 clearable,
249 allowcommit,
258 allowcommit,
250 reportonly,
259 reportonly,
251 continueflag,
260 continueflag,
252 stopflag,
261 stopflag,
253 childopnames,
262 childopnames,
254 cmdmsg,
263 cmdmsg,
255 cmdhint,
264 cmdhint,
256 statushint,
265 statushint,
257 abortfunc,
266 abortfunc,
258 continuefunc,
267 continuefunc,
259 )
268 )
260
269
261 if opname == b'merge':
270 if opname == b'merge':
262 _unfinishedstates.append(statecheckobj)
271 _unfinishedstates.append(statecheckobj)
263 else:
272 else:
264 # This check enforces that for any op 'foo' which depends on op 'bar',
273 # This check enforces that for any op 'foo' which depends on op 'bar',
265 # 'foo' comes before 'bar' in _unfinishedstates. This ensures that
274 # 'foo' comes before 'bar' in _unfinishedstates. This ensures that
266 # getrepostate() always returns the most specific applicable answer.
275 # getrepostate() always returns the most specific applicable answer.
267 for childopname in childopnames:
276 for childopname in childopnames:
268 if childopname not in _unfinishedstatesbyname:
277 if childopname not in _unfinishedstatesbyname:
269 raise error.ProgrammingError(
278 raise error.ProgrammingError(
270 _(b'op %s depends on unknown op %s') % (opname, childopname)
279 _(b'op %s depends on unknown op %s') % (opname, childopname)
271 )
280 )
272
281
273 _unfinishedstates.insert(0, statecheckobj)
282 _unfinishedstates.insert(0, statecheckobj)
274
283
275 if opname in _unfinishedstatesbyname:
284 if opname in _unfinishedstatesbyname:
276 raise error.ProgrammingError(_(b'op %s registered twice') % opname)
285 raise error.ProgrammingError(_(b'op %s registered twice') % opname)
277 _unfinishedstatesbyname[opname] = statecheckobj
286 _unfinishedstatesbyname[opname] = statecheckobj
278
287
279
288
280 def _getparentandchild(opname, childopname):
289 def _getparentandchild(opname, childopname):
281 p = _unfinishedstatesbyname.get(opname, None)
290 p = _unfinishedstatesbyname.get(opname, None)
282 if not p:
291 if not p:
283 raise error.ProgrammingError(_(b'unknown op %s') % opname)
292 raise error.ProgrammingError(_(b'unknown op %s') % opname)
284 if childopname not in p._childopnames:
293 if childopname not in p._childopnames:
285 raise error.ProgrammingError(
294 raise error.ProgrammingError(
286 _(b'op %s does not delegate to %s') % (opname, childopname)
295 _(b'op %s does not delegate to %s') % (opname, childopname)
287 )
296 )
288 c = _unfinishedstatesbyname[childopname]
297 c = _unfinishedstatesbyname[childopname]
289 return p, c
298 return p, c
290
299
291
300
292 @contextlib.contextmanager
301 @contextlib.contextmanager
293 def delegating(repo, opname, childopname):
302 def delegating(repo, opname, childopname):
294 """context wrapper for delegations from opname to childopname.
303 """context wrapper for delegations from opname to childopname.
295
304
296 requires that childopname was specified when opname was registered.
305 requires that childopname was specified when opname was registered.
297
306
298 Usage:
307 Usage:
299 def my_command_foo_that_uses_rebase(...):
308 def my_command_foo_that_uses_rebase(...):
300 ...
309 ...
301 with state.delegating(repo, 'foo', 'rebase'):
310 with state.delegating(repo, 'foo', 'rebase'):
302 _run_rebase(...)
311 _run_rebase(...)
303 ...
312 ...
304 """
313 """
305
314
306 p, c = _getparentandchild(opname, childopname)
315 p, c = _getparentandchild(opname, childopname)
307 if p._delegating:
316 if p._delegating:
308 raise error.ProgrammingError(
317 raise error.ProgrammingError(
309 _(b'cannot delegate from op %s recursively') % opname
318 _(b'cannot delegate from op %s recursively') % opname
310 )
319 )
311 p._delegating = True
320 p._delegating = True
312 try:
321 try:
313 yield
322 yield
314 except error.ConflictResolutionRequired as e:
323 except error.ConflictResolutionRequired as e:
315 # Rewrite conflict resolution advice for the parent opname.
324 # Rewrite conflict resolution advice for the parent opname.
316 if e.opname == childopname:
325 if e.opname == childopname:
317 raise error.ConflictResolutionRequired(opname)
326 raise error.ConflictResolutionRequired(opname)
318 raise e
327 raise e
319 finally:
328 finally:
320 p._delegating = False
329 p._delegating = False
321
330
322
331
323 def ischildunfinished(repo, opname, childopname):
332 def ischildunfinished(repo, opname, childopname):
324 """Returns true if both opname and childopname are unfinished."""
333 """Returns true if both opname and childopname are unfinished."""
325
334
326 p, c = _getparentandchild(opname, childopname)
335 p, c = _getparentandchild(opname, childopname)
327 return (p._delegating or p.isunfinished(repo)) and c.isunfinished(repo)
336 return (p._delegating or p.isunfinished(repo)) and c.isunfinished(repo)
328
337
329
338
330 def continuechild(ui, repo, opname, childopname):
339 def continuechild(ui, repo, opname, childopname):
331 """Checks that childopname is in progress, and continues it."""
340 """Checks that childopname is in progress, and continues it."""
332
341
333 p, c = _getparentandchild(opname, childopname)
342 p, c = _getparentandchild(opname, childopname)
334 if not ischildunfinished(repo, opname, childopname):
343 if not ischildunfinished(repo, opname, childopname):
335 raise error.ProgrammingError(
344 raise error.ProgrammingError(
336 _(b'child op %s of parent %s is not unfinished')
345 _(b'child op %s of parent %s is not unfinished')
337 % (childopname, opname)
346 % (childopname, opname)
338 )
347 )
339 if not c.continuefunc:
348 if not c.continuefunc:
340 raise error.ProgrammingError(
349 raise error.ProgrammingError(
341 _(b'op %s has no continue function') % childopname
350 _(b'op %s has no continue function') % childopname
342 )
351 )
343 return c.continuefunc(ui, repo)
352 return c.continuefunc(ui, repo)
344
353
345
354
346 addunfinished(
355 addunfinished(
347 b'update',
356 b'update',
348 fname=b'updatestate',
357 fname=b'updatestate',
349 clearable=True,
358 clearable=True,
350 cmdmsg=_(b'last update was interrupted'),
359 cmdmsg=_(b'last update was interrupted'),
351 cmdhint=_(b"use 'hg update' to get a consistent checkout"),
360 cmdhint=_(b"use 'hg update' to get a consistent checkout"),
352 statushint=_(b"To continue: hg update ."),
361 statushint=_(b"To continue: hg update ."),
353 )
362 )
354 addunfinished(
363 addunfinished(
355 b'bisect',
364 b'bisect',
356 fname=b'bisect.state',
365 fname=b'bisect.state',
357 allowcommit=True,
366 allowcommit=True,
358 reportonly=True,
367 reportonly=True,
359 statushint=_(
368 statushint=_(
360 b'To mark the changeset good: hg bisect --good\n'
369 b'To mark the changeset good: hg bisect --good\n'
361 b'To mark the changeset bad: hg bisect --bad\n'
370 b'To mark the changeset bad: hg bisect --bad\n'
362 b'To abort: hg bisect --reset\n'
371 b'To abort: hg bisect --reset\n'
363 ),
372 ),
364 )
373 )
365
374
366
375
367 def getrepostate(repo):
376 def getrepostate(repo):
368 # experimental config: commands.status.skipstates
377 # experimental config: commands.status.skipstates
369 skip = set(repo.ui.configlist(b'commands', b'status.skipstates'))
378 skip = set(repo.ui.configlist(b'commands', b'status.skipstates'))
370 for state in _unfinishedstates:
379 for state in _unfinishedstates:
371 if state._opname in skip:
380 if state._opname in skip:
372 continue
381 continue
373 if state.isunfinished(repo):
382 if state.isunfinished(repo):
374 return (state._opname, state.statusmsg())
383 return (state._opname, state.statusmsg())
@@ -1,30 +1,30 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [extensions]
2 > [extensions]
3 > absorb=
3 > absorb=
4 > EOF
4 > EOF
5
5
6 Abort absorb if there is an unfinished operation.
6 Abort absorb if there is an unfinished operation.
7
7
8 $ hg init abortunresolved
8 $ hg init abortunresolved
9 $ cd abortunresolved
9 $ cd abortunresolved
10
10
11 $ echo "foo1" > foo.whole
11 $ echo "foo1" > foo.whole
12 $ hg commit -Aqm "foo 1"
12 $ hg commit -Aqm "foo 1"
13
13
14 $ hg update null
14 $ hg update null
15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
16 $ echo "foo2" > foo.whole
16 $ echo "foo2" > foo.whole
17 $ hg commit -Aqm "foo 2"
17 $ hg commit -Aqm "foo 2"
18
18
19 $ hg --config extensions.rebase= rebase -r 1 -d 0
19 $ hg --config extensions.rebase= rebase -r 1 -d 0
20 rebasing 1:c3b6dc0e177a "foo 2" (tip)
20 rebasing 1:c3b6dc0e177a "foo 2" (tip)
21 merging foo.whole
21 merging foo.whole
22 warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
22 warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
23 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
23 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
24 [1]
24 [1]
25
25
26 $ hg --config extensions.rebase= absorb
26 $ hg --config extensions.rebase= absorb
27 abort: rebase in progress
27 abort: rebase in progress
28 (use 'hg rebase --continue' or 'hg rebase --abort')
28 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
29 [255]
29 [255]
30
30
@@ -1,1693 +1,1693 b''
1 A script that implements uppercasing of specific lines in a file. This
1 A script that implements uppercasing of specific lines in a file. This
2 approximates the behavior of code formatters well enough for our tests.
2 approximates the behavior of code formatters well enough for our tests.
3
3
4 $ UPPERCASEPY="$TESTTMP/uppercase.py"
4 $ UPPERCASEPY="$TESTTMP/uppercase.py"
5 $ cat > $UPPERCASEPY <<EOF
5 $ cat > $UPPERCASEPY <<EOF
6 > import sys
6 > import sys
7 > from mercurial.utils.procutil import setbinary
7 > from mercurial.utils.procutil import setbinary
8 > setbinary(sys.stdin)
8 > setbinary(sys.stdin)
9 > setbinary(sys.stdout)
9 > setbinary(sys.stdout)
10 > lines = set()
10 > lines = set()
11 > for arg in sys.argv[1:]:
11 > for arg in sys.argv[1:]:
12 > if arg == 'all':
12 > if arg == 'all':
13 > sys.stdout.write(sys.stdin.read().upper())
13 > sys.stdout.write(sys.stdin.read().upper())
14 > sys.exit(0)
14 > sys.exit(0)
15 > else:
15 > else:
16 > first, last = arg.split('-')
16 > first, last = arg.split('-')
17 > lines.update(range(int(first), int(last) + 1))
17 > lines.update(range(int(first), int(last) + 1))
18 > for i, line in enumerate(sys.stdin.readlines()):
18 > for i, line in enumerate(sys.stdin.readlines()):
19 > if i + 1 in lines:
19 > if i + 1 in lines:
20 > sys.stdout.write(line.upper())
20 > sys.stdout.write(line.upper())
21 > else:
21 > else:
22 > sys.stdout.write(line)
22 > sys.stdout.write(line)
23 > EOF
23 > EOF
24 $ TESTLINES="foo\nbar\nbaz\nqux\n"
24 $ TESTLINES="foo\nbar\nbaz\nqux\n"
25 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY
25 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY
26 foo
26 foo
27 bar
27 bar
28 baz
28 baz
29 qux
29 qux
30 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY all
30 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY all
31 FOO
31 FOO
32 BAR
32 BAR
33 BAZ
33 BAZ
34 QUX
34 QUX
35 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-1
35 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-1
36 FOO
36 FOO
37 bar
37 bar
38 baz
38 baz
39 qux
39 qux
40 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-2
40 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-2
41 FOO
41 FOO
42 BAR
42 BAR
43 baz
43 baz
44 qux
44 qux
45 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-3
45 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-3
46 foo
46 foo
47 BAR
47 BAR
48 BAZ
48 BAZ
49 qux
49 qux
50 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-2 4-4
50 $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-2 4-4
51 foo
51 foo
52 BAR
52 BAR
53 baz
53 baz
54 QUX
54 QUX
55
55
56 Set up the config with two simple fixers: one that fixes specific line ranges,
56 Set up the config with two simple fixers: one that fixes specific line ranges,
57 and one that always fixes the whole file. They both "fix" files by converting
57 and one that always fixes the whole file. They both "fix" files by converting
58 letters to uppercase. They use different file extensions, so each test case can
58 letters to uppercase. They use different file extensions, so each test case can
59 choose which behavior to use by naming files.
59 choose which behavior to use by naming files.
60
60
61 $ cat >> $HGRCPATH <<EOF
61 $ cat >> $HGRCPATH <<EOF
62 > [extensions]
62 > [extensions]
63 > fix =
63 > fix =
64 > [experimental]
64 > [experimental]
65 > evolution.createmarkers=True
65 > evolution.createmarkers=True
66 > evolution.allowunstable=True
66 > evolution.allowunstable=True
67 > [fix]
67 > [fix]
68 > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY all
68 > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY all
69 > uppercase-whole-file:pattern=set:**.whole
69 > uppercase-whole-file:pattern=set:**.whole
70 > uppercase-changed-lines:command="$PYTHON" $UPPERCASEPY
70 > uppercase-changed-lines:command="$PYTHON" $UPPERCASEPY
71 > uppercase-changed-lines:linerange={first}-{last}
71 > uppercase-changed-lines:linerange={first}-{last}
72 > uppercase-changed-lines:pattern=set:**.changed
72 > uppercase-changed-lines:pattern=set:**.changed
73 > EOF
73 > EOF
74
74
75 Help text for fix.
75 Help text for fix.
76
76
77 $ hg help fix
77 $ hg help fix
78 hg fix [OPTION]... [FILE]...
78 hg fix [OPTION]... [FILE]...
79
79
80 rewrite file content in changesets or working directory
80 rewrite file content in changesets or working directory
81
81
82 Runs any configured tools to fix the content of files. Only affects files
82 Runs any configured tools to fix the content of files. Only affects files
83 with changes, unless file arguments are provided. Only affects changed
83 with changes, unless file arguments are provided. Only affects changed
84 lines of files, unless the --whole flag is used. Some tools may always
84 lines of files, unless the --whole flag is used. Some tools may always
85 affect the whole file regardless of --whole.
85 affect the whole file regardless of --whole.
86
86
87 If revisions are specified with --rev, those revisions will be checked,
87 If revisions are specified with --rev, those revisions will be checked,
88 and they may be replaced with new revisions that have fixed file content.
88 and they may be replaced with new revisions that have fixed file content.
89 It is desirable to specify all descendants of each specified revision, so
89 It is desirable to specify all descendants of each specified revision, so
90 that the fixes propagate to the descendants. If all descendants are fixed
90 that the fixes propagate to the descendants. If all descendants are fixed
91 at the same time, no merging, rebasing, or evolution will be required.
91 at the same time, no merging, rebasing, or evolution will be required.
92
92
93 If --working-dir is used, files with uncommitted changes in the working
93 If --working-dir is used, files with uncommitted changes in the working
94 copy will be fixed. If the checked-out revision is also fixed, the working
94 copy will be fixed. If the checked-out revision is also fixed, the working
95 directory will update to the replacement revision.
95 directory will update to the replacement revision.
96
96
97 When determining what lines of each file to fix at each revision, the
97 When determining what lines of each file to fix at each revision, the
98 whole set of revisions being fixed is considered, so that fixes to earlier
98 whole set of revisions being fixed is considered, so that fixes to earlier
99 revisions are not forgotten in later ones. The --base flag can be used to
99 revisions are not forgotten in later ones. The --base flag can be used to
100 override this default behavior, though it is not usually desirable to do
100 override this default behavior, though it is not usually desirable to do
101 so.
101 so.
102
102
103 (use 'hg help -e fix' to show help for the fix extension)
103 (use 'hg help -e fix' to show help for the fix extension)
104
104
105 options ([+] can be repeated):
105 options ([+] can be repeated):
106
106
107 --all fix all non-public non-obsolete revisions
107 --all fix all non-public non-obsolete revisions
108 --base REV [+] revisions to diff against (overrides automatic selection,
108 --base REV [+] revisions to diff against (overrides automatic selection,
109 and applies to every revision being fixed)
109 and applies to every revision being fixed)
110 -s --source REV [+] fix the specified revisions and their descendants
110 -s --source REV [+] fix the specified revisions and their descendants
111 -w --working-dir fix the working directory
111 -w --working-dir fix the working directory
112 --whole always fix every line of a file
112 --whole always fix every line of a file
113
113
114 (some details hidden, use --verbose to show complete help)
114 (some details hidden, use --verbose to show complete help)
115
115
116 $ hg help -e fix
116 $ hg help -e fix
117 fix extension - rewrite file content in changesets or working copy
117 fix extension - rewrite file content in changesets or working copy
118 (EXPERIMENTAL)
118 (EXPERIMENTAL)
119
119
120 Provides a command that runs configured tools on the contents of modified
120 Provides a command that runs configured tools on the contents of modified
121 files, writing back any fixes to the working copy or replacing changesets.
121 files, writing back any fixes to the working copy or replacing changesets.
122
122
123 Here is an example configuration that causes 'hg fix' to apply automatic
123 Here is an example configuration that causes 'hg fix' to apply automatic
124 formatting fixes to modified lines in C++ code:
124 formatting fixes to modified lines in C++ code:
125
125
126 [fix]
126 [fix]
127 clang-format:command=clang-format --assume-filename={rootpath}
127 clang-format:command=clang-format --assume-filename={rootpath}
128 clang-format:linerange=--lines={first}:{last}
128 clang-format:linerange=--lines={first}:{last}
129 clang-format:pattern=set:**.cpp or **.hpp
129 clang-format:pattern=set:**.cpp or **.hpp
130
130
131 The :command suboption forms the first part of the shell command that will be
131 The :command suboption forms the first part of the shell command that will be
132 used to fix a file. The content of the file is passed on standard input, and
132 used to fix a file. The content of the file is passed on standard input, and
133 the fixed file content is expected on standard output. Any output on standard
133 the fixed file content is expected on standard output. Any output on standard
134 error will be displayed as a warning. If the exit status is not zero, the file
134 error will be displayed as a warning. If the exit status is not zero, the file
135 will not be affected. A placeholder warning is displayed if there is a non-
135 will not be affected. A placeholder warning is displayed if there is a non-
136 zero exit status but no standard error output. Some values may be substituted
136 zero exit status but no standard error output. Some values may be substituted
137 into the command:
137 into the command:
138
138
139 {rootpath} The path of the file being fixed, relative to the repo root
139 {rootpath} The path of the file being fixed, relative to the repo root
140 {basename} The name of the file being fixed, without the directory path
140 {basename} The name of the file being fixed, without the directory path
141
141
142 If the :linerange suboption is set, the tool will only be run if there are
142 If the :linerange suboption is set, the tool will only be run if there are
143 changed lines in a file. The value of this suboption is appended to the shell
143 changed lines in a file. The value of this suboption is appended to the shell
144 command once for every range of changed lines in the file. Some values may be
144 command once for every range of changed lines in the file. Some values may be
145 substituted into the command:
145 substituted into the command:
146
146
147 {first} The 1-based line number of the first line in the modified range
147 {first} The 1-based line number of the first line in the modified range
148 {last} The 1-based line number of the last line in the modified range
148 {last} The 1-based line number of the last line in the modified range
149
149
150 Deleted sections of a file will be ignored by :linerange, because there is no
150 Deleted sections of a file will be ignored by :linerange, because there is no
151 corresponding line range in the version being fixed.
151 corresponding line range in the version being fixed.
152
152
153 By default, tools that set :linerange will only be executed if there is at
153 By default, tools that set :linerange will only be executed if there is at
154 least one changed line range. This is meant to prevent accidents like running
154 least one changed line range. This is meant to prevent accidents like running
155 a code formatter in such a way that it unexpectedly reformats the whole file.
155 a code formatter in such a way that it unexpectedly reformats the whole file.
156 If such a tool needs to operate on unchanged files, it should set the
156 If such a tool needs to operate on unchanged files, it should set the
157 :skipclean suboption to false.
157 :skipclean suboption to false.
158
158
159 The :pattern suboption determines which files will be passed through each
159 The :pattern suboption determines which files will be passed through each
160 configured tool. See 'hg help patterns' for possible values. However, all
160 configured tool. See 'hg help patterns' for possible values. However, all
161 patterns are relative to the repo root, even if that text says they are
161 patterns are relative to the repo root, even if that text says they are
162 relative to the current working directory. If there are file arguments to 'hg
162 relative to the current working directory. If there are file arguments to 'hg
163 fix', the intersection of these patterns is used.
163 fix', the intersection of these patterns is used.
164
164
165 There is also a configurable limit for the maximum size of file that will be
165 There is also a configurable limit for the maximum size of file that will be
166 processed by 'hg fix':
166 processed by 'hg fix':
167
167
168 [fix]
168 [fix]
169 maxfilesize = 2MB
169 maxfilesize = 2MB
170
170
171 Normally, execution of configured tools will continue after a failure
171 Normally, execution of configured tools will continue after a failure
172 (indicated by a non-zero exit status). It can also be configured to abort
172 (indicated by a non-zero exit status). It can also be configured to abort
173 after the first such failure, so that no files will be affected if any tool
173 after the first such failure, so that no files will be affected if any tool
174 fails. This abort will also cause 'hg fix' to exit with a non-zero status:
174 fails. This abort will also cause 'hg fix' to exit with a non-zero status:
175
175
176 [fix]
176 [fix]
177 failure = abort
177 failure = abort
178
178
179 When multiple tools are configured to affect a file, they execute in an order
179 When multiple tools are configured to affect a file, they execute in an order
180 defined by the :priority suboption. The priority suboption has a default value
180 defined by the :priority suboption. The priority suboption has a default value
181 of zero for each tool. Tools are executed in order of descending priority. The
181 of zero for each tool. Tools are executed in order of descending priority. The
182 execution order of tools with equal priority is unspecified. For example, you
182 execution order of tools with equal priority is unspecified. For example, you
183 could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers
183 could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers
184 in a text file by ensuring that 'sort' runs before 'head':
184 in a text file by ensuring that 'sort' runs before 'head':
185
185
186 [fix]
186 [fix]
187 sort:command = sort -n
187 sort:command = sort -n
188 head:command = head -n 10
188 head:command = head -n 10
189 sort:pattern = numbers.txt
189 sort:pattern = numbers.txt
190 head:pattern = numbers.txt
190 head:pattern = numbers.txt
191 sort:priority = 2
191 sort:priority = 2
192 head:priority = 1
192 head:priority = 1
193
193
194 To account for changes made by each tool, the line numbers used for
194 To account for changes made by each tool, the line numbers used for
195 incremental formatting are recomputed before executing the next tool. So, each
195 incremental formatting are recomputed before executing the next tool. So, each
196 tool may see different values for the arguments added by the :linerange
196 tool may see different values for the arguments added by the :linerange
197 suboption.
197 suboption.
198
198
199 Each fixer tool is allowed to return some metadata in addition to the fixed
199 Each fixer tool is allowed to return some metadata in addition to the fixed
200 file content. The metadata must be placed before the file content on stdout,
200 file content. The metadata must be placed before the file content on stdout,
201 separated from the file content by a zero byte. The metadata is parsed as a
201 separated from the file content by a zero byte. The metadata is parsed as a
202 JSON value (so, it should be UTF-8 encoded and contain no zero bytes). A fixer
202 JSON value (so, it should be UTF-8 encoded and contain no zero bytes). A fixer
203 tool is expected to produce this metadata encoding if and only if the
203 tool is expected to produce this metadata encoding if and only if the
204 :metadata suboption is true:
204 :metadata suboption is true:
205
205
206 [fix]
206 [fix]
207 tool:command = tool --prepend-json-metadata
207 tool:command = tool --prepend-json-metadata
208 tool:metadata = true
208 tool:metadata = true
209
209
210 The metadata values are passed to hooks, which can be used to print summaries
210 The metadata values are passed to hooks, which can be used to print summaries
211 or perform other post-fixing work. The supported hooks are:
211 or perform other post-fixing work. The supported hooks are:
212
212
213 "postfixfile"
213 "postfixfile"
214 Run once for each file in each revision where any fixer tools made changes
214 Run once for each file in each revision where any fixer tools made changes
215 to the file content. Provides "$HG_REV" and "$HG_PATH" to identify the file,
215 to the file content. Provides "$HG_REV" and "$HG_PATH" to identify the file,
216 and "$HG_METADATA" with a map of fixer names to metadata values from fixer
216 and "$HG_METADATA" with a map of fixer names to metadata values from fixer
217 tools that affected the file. Fixer tools that didn't affect the file have a
217 tools that affected the file. Fixer tools that didn't affect the file have a
218 value of None. Only fixer tools that executed are present in the metadata.
218 value of None. Only fixer tools that executed are present in the metadata.
219
219
220 "postfix"
220 "postfix"
221 Run once after all files and revisions have been handled. Provides
221 Run once after all files and revisions have been handled. Provides
222 "$HG_REPLACEMENTS" with information about what revisions were created and
222 "$HG_REPLACEMENTS" with information about what revisions were created and
223 made obsolete. Provides a boolean "$HG_WDIRWRITTEN" to indicate whether any
223 made obsolete. Provides a boolean "$HG_WDIRWRITTEN" to indicate whether any
224 files in the working copy were updated. Provides a list "$HG_METADATA"
224 files in the working copy were updated. Provides a list "$HG_METADATA"
225 mapping fixer tool names to lists of metadata values returned from
225 mapping fixer tool names to lists of metadata values returned from
226 executions that modified a file. This aggregates the same metadata
226 executions that modified a file. This aggregates the same metadata
227 previously passed to the "postfixfile" hook.
227 previously passed to the "postfixfile" hook.
228
228
229 Fixer tools are run in the repository's root directory. This allows them to
229 Fixer tools are run in the repository's root directory. This allows them to
230 read configuration files from the working copy, or even write to the working
230 read configuration files from the working copy, or even write to the working
231 copy. The working copy is not updated to match the revision being fixed. In
231 copy. The working copy is not updated to match the revision being fixed. In
232 fact, several revisions may be fixed in parallel. Writes to the working copy
232 fact, several revisions may be fixed in parallel. Writes to the working copy
233 are not amended into the revision being fixed; fixer tools should always write
233 are not amended into the revision being fixed; fixer tools should always write
234 fixed file content back to stdout as documented above.
234 fixed file content back to stdout as documented above.
235
235
236 list of commands:
236 list of commands:
237
237
238 fix rewrite file content in changesets or working directory
238 fix rewrite file content in changesets or working directory
239
239
240 (use 'hg help -v -e fix' to show built-in aliases and global options)
240 (use 'hg help -v -e fix' to show built-in aliases and global options)
241
241
242 There is no default behavior in the absence of --rev and --working-dir.
242 There is no default behavior in the absence of --rev and --working-dir.
243
243
244 $ hg init badusage
244 $ hg init badusage
245 $ cd badusage
245 $ cd badusage
246
246
247 $ hg fix
247 $ hg fix
248 abort: no changesets specified
248 abort: no changesets specified
249 (use --rev or --working-dir)
249 (use --rev or --working-dir)
250 [255]
250 [255]
251 $ hg fix --whole
251 $ hg fix --whole
252 abort: no changesets specified
252 abort: no changesets specified
253 (use --rev or --working-dir)
253 (use --rev or --working-dir)
254 [255]
254 [255]
255 $ hg fix --base 0
255 $ hg fix --base 0
256 abort: no changesets specified
256 abort: no changesets specified
257 (use --rev or --working-dir)
257 (use --rev or --working-dir)
258 [255]
258 [255]
259
259
260 Fixing a public revision isn't allowed. It should abort early enough that
260 Fixing a public revision isn't allowed. It should abort early enough that
261 nothing happens, even to the working directory.
261 nothing happens, even to the working directory.
262
262
263 $ printf "hello\n" > hello.whole
263 $ printf "hello\n" > hello.whole
264 $ hg commit -Aqm "hello"
264 $ hg commit -Aqm "hello"
265 $ hg phase -r 0 --public
265 $ hg phase -r 0 --public
266 $ hg fix -r 0
266 $ hg fix -r 0
267 abort: cannot fix public changesets
267 abort: cannot fix public changesets
268 (see 'hg help phases' for details)
268 (see 'hg help phases' for details)
269 [255]
269 [255]
270 $ hg fix -r 0 --working-dir
270 $ hg fix -r 0 --working-dir
271 abort: cannot fix public changesets
271 abort: cannot fix public changesets
272 (see 'hg help phases' for details)
272 (see 'hg help phases' for details)
273 [255]
273 [255]
274 $ hg cat -r tip hello.whole
274 $ hg cat -r tip hello.whole
275 hello
275 hello
276 $ cat hello.whole
276 $ cat hello.whole
277 hello
277 hello
278
278
279 $ cd ..
279 $ cd ..
280
280
281 Fixing a clean working directory should do nothing. Even the --whole flag
281 Fixing a clean working directory should do nothing. Even the --whole flag
282 shouldn't cause any clean files to be fixed. Specifying a clean file explicitly
282 shouldn't cause any clean files to be fixed. Specifying a clean file explicitly
283 should only fix it if the fixer always fixes the whole file. The combination of
283 should only fix it if the fixer always fixes the whole file. The combination of
284 an explicit filename and --whole should format the entire file regardless.
284 an explicit filename and --whole should format the entire file regardless.
285
285
286 $ hg init fixcleanwdir
286 $ hg init fixcleanwdir
287 $ cd fixcleanwdir
287 $ cd fixcleanwdir
288
288
289 $ printf "hello\n" > hello.changed
289 $ printf "hello\n" > hello.changed
290 $ printf "world\n" > hello.whole
290 $ printf "world\n" > hello.whole
291 $ hg commit -Aqm "foo"
291 $ hg commit -Aqm "foo"
292 $ hg fix --working-dir
292 $ hg fix --working-dir
293 $ hg diff
293 $ hg diff
294 $ hg fix --working-dir --whole
294 $ hg fix --working-dir --whole
295 $ hg diff
295 $ hg diff
296 $ hg fix --working-dir *
296 $ hg fix --working-dir *
297 $ cat *
297 $ cat *
298 hello
298 hello
299 WORLD
299 WORLD
300 $ hg revert --all --no-backup
300 $ hg revert --all --no-backup
301 reverting hello.whole
301 reverting hello.whole
302 $ hg fix --working-dir * --whole
302 $ hg fix --working-dir * --whole
303 $ cat *
303 $ cat *
304 HELLO
304 HELLO
305 WORLD
305 WORLD
306
306
307 The same ideas apply to fixing a revision, so we create a revision that doesn't
307 The same ideas apply to fixing a revision, so we create a revision that doesn't
308 modify either of the files in question and try fixing it. This also tests that
308 modify either of the files in question and try fixing it. This also tests that
309 we ignore a file that doesn't match any configured fixer.
309 we ignore a file that doesn't match any configured fixer.
310
310
311 $ hg revert --all --no-backup
311 $ hg revert --all --no-backup
312 reverting hello.changed
312 reverting hello.changed
313 reverting hello.whole
313 reverting hello.whole
314 $ printf "unimportant\n" > some.file
314 $ printf "unimportant\n" > some.file
315 $ hg commit -Aqm "some other file"
315 $ hg commit -Aqm "some other file"
316
316
317 $ hg fix -r .
317 $ hg fix -r .
318 $ hg cat -r tip *
318 $ hg cat -r tip *
319 hello
319 hello
320 world
320 world
321 unimportant
321 unimportant
322 $ hg fix -r . --whole
322 $ hg fix -r . --whole
323 $ hg cat -r tip *
323 $ hg cat -r tip *
324 hello
324 hello
325 world
325 world
326 unimportant
326 unimportant
327 $ hg fix -r . *
327 $ hg fix -r . *
328 $ hg cat -r tip *
328 $ hg cat -r tip *
329 hello
329 hello
330 WORLD
330 WORLD
331 unimportant
331 unimportant
332 $ hg fix -r . * --whole --config experimental.evolution.allowdivergence=true
332 $ hg fix -r . * --whole --config experimental.evolution.allowdivergence=true
333 2 new content-divergent changesets
333 2 new content-divergent changesets
334 $ hg cat -r tip *
334 $ hg cat -r tip *
335 HELLO
335 HELLO
336 WORLD
336 WORLD
337 unimportant
337 unimportant
338
338
339 $ cd ..
339 $ cd ..
340
340
341 Fixing the working directory should still work if there are no revisions.
341 Fixing the working directory should still work if there are no revisions.
342
342
343 $ hg init norevisions
343 $ hg init norevisions
344 $ cd norevisions
344 $ cd norevisions
345
345
346 $ printf "something\n" > something.whole
346 $ printf "something\n" > something.whole
347 $ hg add
347 $ hg add
348 adding something.whole
348 adding something.whole
349 $ hg fix --working-dir
349 $ hg fix --working-dir
350 $ cat something.whole
350 $ cat something.whole
351 SOMETHING
351 SOMETHING
352
352
353 $ cd ..
353 $ cd ..
354
354
355 Test the effect of fixing the working directory for each possible status, with
355 Test the effect of fixing the working directory for each possible status, with
356 and without providing explicit file arguments.
356 and without providing explicit file arguments.
357
357
358 $ hg init implicitlyfixstatus
358 $ hg init implicitlyfixstatus
359 $ cd implicitlyfixstatus
359 $ cd implicitlyfixstatus
360
360
361 $ printf "modified\n" > modified.whole
361 $ printf "modified\n" > modified.whole
362 $ printf "removed\n" > removed.whole
362 $ printf "removed\n" > removed.whole
363 $ printf "deleted\n" > deleted.whole
363 $ printf "deleted\n" > deleted.whole
364 $ printf "clean\n" > clean.whole
364 $ printf "clean\n" > clean.whole
365 $ printf "ignored.whole" > .hgignore
365 $ printf "ignored.whole" > .hgignore
366 $ hg commit -Aqm "stuff"
366 $ hg commit -Aqm "stuff"
367
367
368 $ printf "modified!!!\n" > modified.whole
368 $ printf "modified!!!\n" > modified.whole
369 $ printf "unknown\n" > unknown.whole
369 $ printf "unknown\n" > unknown.whole
370 $ printf "ignored\n" > ignored.whole
370 $ printf "ignored\n" > ignored.whole
371 $ printf "added\n" > added.whole
371 $ printf "added\n" > added.whole
372 $ hg add added.whole
372 $ hg add added.whole
373 $ hg remove removed.whole
373 $ hg remove removed.whole
374 $ rm deleted.whole
374 $ rm deleted.whole
375
375
376 $ hg status --all
376 $ hg status --all
377 M modified.whole
377 M modified.whole
378 A added.whole
378 A added.whole
379 R removed.whole
379 R removed.whole
380 ! deleted.whole
380 ! deleted.whole
381 ? unknown.whole
381 ? unknown.whole
382 I ignored.whole
382 I ignored.whole
383 C .hgignore
383 C .hgignore
384 C clean.whole
384 C clean.whole
385
385
386 $ hg fix --working-dir
386 $ hg fix --working-dir
387
387
388 $ hg status --all
388 $ hg status --all
389 M modified.whole
389 M modified.whole
390 A added.whole
390 A added.whole
391 R removed.whole
391 R removed.whole
392 ! deleted.whole
392 ! deleted.whole
393 ? unknown.whole
393 ? unknown.whole
394 I ignored.whole
394 I ignored.whole
395 C .hgignore
395 C .hgignore
396 C clean.whole
396 C clean.whole
397
397
398 $ cat *.whole
398 $ cat *.whole
399 ADDED
399 ADDED
400 clean
400 clean
401 ignored
401 ignored
402 MODIFIED!!!
402 MODIFIED!!!
403 unknown
403 unknown
404
404
405 $ printf "modified!!!\n" > modified.whole
405 $ printf "modified!!!\n" > modified.whole
406 $ printf "added\n" > added.whole
406 $ printf "added\n" > added.whole
407
407
408 Listing the files explicitly causes untracked files to also be fixed, but
408 Listing the files explicitly causes untracked files to also be fixed, but
409 ignored files are still unaffected.
409 ignored files are still unaffected.
410
410
411 $ hg fix --working-dir *.whole
411 $ hg fix --working-dir *.whole
412
412
413 $ hg status --all
413 $ hg status --all
414 M clean.whole
414 M clean.whole
415 M modified.whole
415 M modified.whole
416 A added.whole
416 A added.whole
417 R removed.whole
417 R removed.whole
418 ! deleted.whole
418 ! deleted.whole
419 ? unknown.whole
419 ? unknown.whole
420 I ignored.whole
420 I ignored.whole
421 C .hgignore
421 C .hgignore
422
422
423 $ cat *.whole
423 $ cat *.whole
424 ADDED
424 ADDED
425 CLEAN
425 CLEAN
426 ignored
426 ignored
427 MODIFIED!!!
427 MODIFIED!!!
428 UNKNOWN
428 UNKNOWN
429
429
430 $ cd ..
430 $ cd ..
431
431
432 Test that incremental fixing works on files with additions, deletions, and
432 Test that incremental fixing works on files with additions, deletions, and
433 changes in multiple line ranges. Note that deletions do not generally cause
433 changes in multiple line ranges. Note that deletions do not generally cause
434 neighboring lines to be fixed, so we don't return a line range for purely
434 neighboring lines to be fixed, so we don't return a line range for purely
435 deleted sections. In the future we should support a :deletion config that
435 deleted sections. In the future we should support a :deletion config that
436 allows fixers to know where deletions are located.
436 allows fixers to know where deletions are located.
437
437
438 $ hg init incrementalfixedlines
438 $ hg init incrementalfixedlines
439 $ cd incrementalfixedlines
439 $ cd incrementalfixedlines
440
440
441 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.txt
441 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.txt
442 $ hg commit -Aqm "foo"
442 $ hg commit -Aqm "foo"
443 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.txt
443 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.txt
444
444
445 $ hg --config "fix.fail:command=echo" \
445 $ hg --config "fix.fail:command=echo" \
446 > --config "fix.fail:linerange={first}:{last}" \
446 > --config "fix.fail:linerange={first}:{last}" \
447 > --config "fix.fail:pattern=foo.txt" \
447 > --config "fix.fail:pattern=foo.txt" \
448 > fix --working-dir
448 > fix --working-dir
449 $ cat foo.txt
449 $ cat foo.txt
450 1:1 4:6 8:8
450 1:1 4:6 8:8
451
451
452 $ cd ..
452 $ cd ..
453
453
454 Test that --whole fixes all lines regardless of the diffs present.
454 Test that --whole fixes all lines regardless of the diffs present.
455
455
456 $ hg init wholeignoresdiffs
456 $ hg init wholeignoresdiffs
457 $ cd wholeignoresdiffs
457 $ cd wholeignoresdiffs
458
458
459 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.changed
459 $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.changed
460 $ hg commit -Aqm "foo"
460 $ hg commit -Aqm "foo"
461 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.changed
461 $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.changed
462
462
463 $ hg fix --working-dir
463 $ hg fix --working-dir
464 $ cat foo.changed
464 $ cat foo.changed
465 ZZ
465 ZZ
466 a
466 a
467 c
467 c
468 DD
468 DD
469 EE
469 EE
470 FF
470 FF
471 f
471 f
472 GG
472 GG
473
473
474 $ hg fix --working-dir --whole
474 $ hg fix --working-dir --whole
475 $ cat foo.changed
475 $ cat foo.changed
476 ZZ
476 ZZ
477 A
477 A
478 C
478 C
479 DD
479 DD
480 EE
480 EE
481 FF
481 FF
482 F
482 F
483 GG
483 GG
484
484
485 $ cd ..
485 $ cd ..
486
486
487 We should do nothing with symlinks, and their targets should be unaffected. Any
487 We should do nothing with symlinks, and their targets should be unaffected. Any
488 other behavior would be more complicated to implement and harder to document.
488 other behavior would be more complicated to implement and harder to document.
489
489
490 #if symlink
490 #if symlink
491 $ hg init dontmesswithsymlinks
491 $ hg init dontmesswithsymlinks
492 $ cd dontmesswithsymlinks
492 $ cd dontmesswithsymlinks
493
493
494 $ printf "hello\n" > hello.whole
494 $ printf "hello\n" > hello.whole
495 $ ln -s hello.whole hellolink
495 $ ln -s hello.whole hellolink
496 $ hg add
496 $ hg add
497 adding hello.whole
497 adding hello.whole
498 adding hellolink
498 adding hellolink
499 $ hg fix --working-dir hellolink
499 $ hg fix --working-dir hellolink
500 $ hg status
500 $ hg status
501 A hello.whole
501 A hello.whole
502 A hellolink
502 A hellolink
503
503
504 $ cd ..
504 $ cd ..
505 #endif
505 #endif
506
506
507 We should allow fixers to run on binary files, even though this doesn't sound
507 We should allow fixers to run on binary files, even though this doesn't sound
508 like a common use case. There's not much benefit to disallowing it, and users
508 like a common use case. There's not much benefit to disallowing it, and users
509 can add "and not binary()" to their filesets if needed. The Mercurial
509 can add "and not binary()" to their filesets if needed. The Mercurial
510 philosophy is generally to not handle binary files specially anyway.
510 philosophy is generally to not handle binary files specially anyway.
511
511
512 $ hg init cantouchbinaryfiles
512 $ hg init cantouchbinaryfiles
513 $ cd cantouchbinaryfiles
513 $ cd cantouchbinaryfiles
514
514
515 $ printf "hello\0\n" > hello.whole
515 $ printf "hello\0\n" > hello.whole
516 $ hg add
516 $ hg add
517 adding hello.whole
517 adding hello.whole
518 $ hg fix --working-dir 'set:binary()'
518 $ hg fix --working-dir 'set:binary()'
519 $ cat hello.whole
519 $ cat hello.whole
520 HELLO\x00 (esc)
520 HELLO\x00 (esc)
521
521
522 $ cd ..
522 $ cd ..
523
523
524 We have a config for the maximum size of file we will attempt to fix. This can
524 We have a config for the maximum size of file we will attempt to fix. This can
525 be helpful to avoid running unsuspecting fixer tools on huge inputs, which
525 be helpful to avoid running unsuspecting fixer tools on huge inputs, which
526 could happen by accident without a well considered configuration. A more
526 could happen by accident without a well considered configuration. A more
527 precise configuration could use the size() fileset function if one global limit
527 precise configuration could use the size() fileset function if one global limit
528 is undesired.
528 is undesired.
529
529
530 $ hg init maxfilesize
530 $ hg init maxfilesize
531 $ cd maxfilesize
531 $ cd maxfilesize
532
532
533 $ printf "this file is huge\n" > hello.whole
533 $ printf "this file is huge\n" > hello.whole
534 $ hg add
534 $ hg add
535 adding hello.whole
535 adding hello.whole
536 $ hg --config fix.maxfilesize=10 fix --working-dir
536 $ hg --config fix.maxfilesize=10 fix --working-dir
537 ignoring file larger than 10 bytes: hello.whole
537 ignoring file larger than 10 bytes: hello.whole
538 $ cat hello.whole
538 $ cat hello.whole
539 this file is huge
539 this file is huge
540
540
541 $ cd ..
541 $ cd ..
542
542
543 If we specify a file to fix, other files should be left alone, even if they
543 If we specify a file to fix, other files should be left alone, even if they
544 have changes.
544 have changes.
545
545
546 $ hg init fixonlywhatitellyouto
546 $ hg init fixonlywhatitellyouto
547 $ cd fixonlywhatitellyouto
547 $ cd fixonlywhatitellyouto
548
548
549 $ printf "fix me!\n" > fixme.whole
549 $ printf "fix me!\n" > fixme.whole
550 $ printf "not me.\n" > notme.whole
550 $ printf "not me.\n" > notme.whole
551 $ hg add
551 $ hg add
552 adding fixme.whole
552 adding fixme.whole
553 adding notme.whole
553 adding notme.whole
554 $ hg fix --working-dir fixme.whole
554 $ hg fix --working-dir fixme.whole
555 $ cat *.whole
555 $ cat *.whole
556 FIX ME!
556 FIX ME!
557 not me.
557 not me.
558
558
559 $ cd ..
559 $ cd ..
560
560
561 If we try to fix a missing file, we still fix other files.
561 If we try to fix a missing file, we still fix other files.
562
562
563 $ hg init fixmissingfile
563 $ hg init fixmissingfile
564 $ cd fixmissingfile
564 $ cd fixmissingfile
565
565
566 $ printf "fix me!\n" > foo.whole
566 $ printf "fix me!\n" > foo.whole
567 $ hg add
567 $ hg add
568 adding foo.whole
568 adding foo.whole
569 $ hg fix --working-dir foo.whole bar.whole
569 $ hg fix --working-dir foo.whole bar.whole
570 bar.whole: $ENOENT$
570 bar.whole: $ENOENT$
571 $ cat *.whole
571 $ cat *.whole
572 FIX ME!
572 FIX ME!
573
573
574 $ cd ..
574 $ cd ..
575
575
576 Specifying a directory name should fix all its files and subdirectories.
576 Specifying a directory name should fix all its files and subdirectories.
577
577
578 $ hg init fixdirectory
578 $ hg init fixdirectory
579 $ cd fixdirectory
579 $ cd fixdirectory
580
580
581 $ mkdir -p dir1/dir2
581 $ mkdir -p dir1/dir2
582 $ printf "foo\n" > foo.whole
582 $ printf "foo\n" > foo.whole
583 $ printf "bar\n" > dir1/bar.whole
583 $ printf "bar\n" > dir1/bar.whole
584 $ printf "baz\n" > dir1/dir2/baz.whole
584 $ printf "baz\n" > dir1/dir2/baz.whole
585 $ hg add
585 $ hg add
586 adding dir1/bar.whole
586 adding dir1/bar.whole
587 adding dir1/dir2/baz.whole
587 adding dir1/dir2/baz.whole
588 adding foo.whole
588 adding foo.whole
589 $ hg fix --working-dir dir1
589 $ hg fix --working-dir dir1
590 $ cat foo.whole dir1/bar.whole dir1/dir2/baz.whole
590 $ cat foo.whole dir1/bar.whole dir1/dir2/baz.whole
591 foo
591 foo
592 BAR
592 BAR
593 BAZ
593 BAZ
594
594
595 $ cd ..
595 $ cd ..
596
596
597 Fixing a file in the working directory that needs no fixes should not actually
597 Fixing a file in the working directory that needs no fixes should not actually
598 write back to the file, so for example the mtime shouldn't change.
598 write back to the file, so for example the mtime shouldn't change.
599
599
600 $ hg init donttouchunfixedfiles
600 $ hg init donttouchunfixedfiles
601 $ cd donttouchunfixedfiles
601 $ cd donttouchunfixedfiles
602
602
603 $ printf "NO FIX NEEDED\n" > foo.whole
603 $ printf "NO FIX NEEDED\n" > foo.whole
604 $ hg add
604 $ hg add
605 adding foo.whole
605 adding foo.whole
606 $ cp -p foo.whole foo.whole.orig
606 $ cp -p foo.whole foo.whole.orig
607 $ cp -p foo.whole.orig foo.whole
607 $ cp -p foo.whole.orig foo.whole
608 $ sleep 2 # mtime has a resolution of one or two seconds.
608 $ sleep 2 # mtime has a resolution of one or two seconds.
609 $ hg fix --working-dir
609 $ hg fix --working-dir
610 $ f foo.whole.orig --newer foo.whole
610 $ f foo.whole.orig --newer foo.whole
611 foo.whole.orig: newer than foo.whole
611 foo.whole.orig: newer than foo.whole
612
612
613 $ cd ..
613 $ cd ..
614
614
615 When a fixer prints to stderr, we don't assume that it has failed. We show the
615 When a fixer prints to stderr, we don't assume that it has failed. We show the
616 error messages to the user, and we still let the fixer affect the file it was
616 error messages to the user, and we still let the fixer affect the file it was
617 fixing if its exit code is zero. Some code formatters might emit error messages
617 fixing if its exit code is zero. Some code formatters might emit error messages
618 on stderr and nothing on stdout, which would cause us the clear the file,
618 on stderr and nothing on stdout, which would cause us the clear the file,
619 except that they also exit with a non-zero code. We show the user which fixer
619 except that they also exit with a non-zero code. We show the user which fixer
620 emitted the stderr, and which revision, but we assume that the fixer will print
620 emitted the stderr, and which revision, but we assume that the fixer will print
621 the filename if it is relevant (since the issue may be non-specific). There is
621 the filename if it is relevant (since the issue may be non-specific). There is
622 also a config to abort (without affecting any files whatsoever) if we see any
622 also a config to abort (without affecting any files whatsoever) if we see any
623 tool with a non-zero exit status.
623 tool with a non-zero exit status.
624
624
625 $ hg init showstderr
625 $ hg init showstderr
626 $ cd showstderr
626 $ cd showstderr
627
627
628 $ printf "hello\n" > hello.txt
628 $ printf "hello\n" > hello.txt
629 $ hg add
629 $ hg add
630 adding hello.txt
630 adding hello.txt
631 $ cat > $TESTTMP/work.sh <<'EOF'
631 $ cat > $TESTTMP/work.sh <<'EOF'
632 > printf 'HELLO\n'
632 > printf 'HELLO\n'
633 > printf "$@: some\nerror that didn't stop the tool" >&2
633 > printf "$@: some\nerror that didn't stop the tool" >&2
634 > exit 0 # success despite the stderr output
634 > exit 0 # success despite the stderr output
635 > EOF
635 > EOF
636 $ hg --config "fix.work:command=sh $TESTTMP/work.sh {rootpath}" \
636 $ hg --config "fix.work:command=sh $TESTTMP/work.sh {rootpath}" \
637 > --config "fix.work:pattern=hello.txt" \
637 > --config "fix.work:pattern=hello.txt" \
638 > fix --working-dir
638 > fix --working-dir
639 [wdir] work: hello.txt: some
639 [wdir] work: hello.txt: some
640 [wdir] work: error that didn't stop the tool
640 [wdir] work: error that didn't stop the tool
641 $ cat hello.txt
641 $ cat hello.txt
642 HELLO
642 HELLO
643
643
644 $ printf "goodbye\n" > hello.txt
644 $ printf "goodbye\n" > hello.txt
645 $ printf "foo\n" > foo.whole
645 $ printf "foo\n" > foo.whole
646 $ hg add
646 $ hg add
647 adding foo.whole
647 adding foo.whole
648 $ cat > $TESTTMP/fail.sh <<'EOF'
648 $ cat > $TESTTMP/fail.sh <<'EOF'
649 > printf 'GOODBYE\n'
649 > printf 'GOODBYE\n'
650 > printf "$@: some\nerror that did stop the tool\n" >&2
650 > printf "$@: some\nerror that did stop the tool\n" >&2
651 > exit 42 # success despite the stdout output
651 > exit 42 # success despite the stdout output
652 > EOF
652 > EOF
653 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
653 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
654 > --config "fix.fail:pattern=hello.txt" \
654 > --config "fix.fail:pattern=hello.txt" \
655 > --config "fix.failure=abort" \
655 > --config "fix.failure=abort" \
656 > fix --working-dir
656 > fix --working-dir
657 [wdir] fail: hello.txt: some
657 [wdir] fail: hello.txt: some
658 [wdir] fail: error that did stop the tool
658 [wdir] fail: error that did stop the tool
659 abort: no fixes will be applied
659 abort: no fixes will be applied
660 (use --config fix.failure=continue to apply any successful fixes anyway)
660 (use --config fix.failure=continue to apply any successful fixes anyway)
661 [255]
661 [255]
662 $ cat hello.txt
662 $ cat hello.txt
663 goodbye
663 goodbye
664 $ cat foo.whole
664 $ cat foo.whole
665 foo
665 foo
666
666
667 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
667 $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \
668 > --config "fix.fail:pattern=hello.txt" \
668 > --config "fix.fail:pattern=hello.txt" \
669 > fix --working-dir
669 > fix --working-dir
670 [wdir] fail: hello.txt: some
670 [wdir] fail: hello.txt: some
671 [wdir] fail: error that did stop the tool
671 [wdir] fail: error that did stop the tool
672 $ cat hello.txt
672 $ cat hello.txt
673 goodbye
673 goodbye
674 $ cat foo.whole
674 $ cat foo.whole
675 FOO
675 FOO
676
676
677 $ hg --config "fix.fail:command=exit 42" \
677 $ hg --config "fix.fail:command=exit 42" \
678 > --config "fix.fail:pattern=hello.txt" \
678 > --config "fix.fail:pattern=hello.txt" \
679 > fix --working-dir
679 > fix --working-dir
680 [wdir] fail: exited with status 42
680 [wdir] fail: exited with status 42
681
681
682 $ cd ..
682 $ cd ..
683
683
684 Fixing the working directory and its parent revision at the same time should
684 Fixing the working directory and its parent revision at the same time should
685 check out the replacement revision for the parent. This prevents any new
685 check out the replacement revision for the parent. This prevents any new
686 uncommitted changes from appearing. We test this for a clean working directory
686 uncommitted changes from appearing. We test this for a clean working directory
687 and a dirty one. In both cases, all lines/files changed since the grandparent
687 and a dirty one. In both cases, all lines/files changed since the grandparent
688 will be fixed. The grandparent is the "baserev" for both the parent and the
688 will be fixed. The grandparent is the "baserev" for both the parent and the
689 working copy.
689 working copy.
690
690
691 $ hg init fixdotandcleanwdir
691 $ hg init fixdotandcleanwdir
692 $ cd fixdotandcleanwdir
692 $ cd fixdotandcleanwdir
693
693
694 $ printf "hello\n" > hello.whole
694 $ printf "hello\n" > hello.whole
695 $ printf "world\n" > world.whole
695 $ printf "world\n" > world.whole
696 $ hg commit -Aqm "the parent commit"
696 $ hg commit -Aqm "the parent commit"
697
697
698 $ hg parents --template '{rev} {desc}\n'
698 $ hg parents --template '{rev} {desc}\n'
699 0 the parent commit
699 0 the parent commit
700 $ hg fix --working-dir -r .
700 $ hg fix --working-dir -r .
701 $ hg parents --template '{rev} {desc}\n'
701 $ hg parents --template '{rev} {desc}\n'
702 1 the parent commit
702 1 the parent commit
703 $ hg cat -r . *.whole
703 $ hg cat -r . *.whole
704 HELLO
704 HELLO
705 WORLD
705 WORLD
706 $ cat *.whole
706 $ cat *.whole
707 HELLO
707 HELLO
708 WORLD
708 WORLD
709 $ hg status
709 $ hg status
710
710
711 $ cd ..
711 $ cd ..
712
712
713 Same test with a dirty working copy.
713 Same test with a dirty working copy.
714
714
715 $ hg init fixdotanddirtywdir
715 $ hg init fixdotanddirtywdir
716 $ cd fixdotanddirtywdir
716 $ cd fixdotanddirtywdir
717
717
718 $ printf "hello\n" > hello.whole
718 $ printf "hello\n" > hello.whole
719 $ printf "world\n" > world.whole
719 $ printf "world\n" > world.whole
720 $ hg commit -Aqm "the parent commit"
720 $ hg commit -Aqm "the parent commit"
721
721
722 $ printf "hello,\n" > hello.whole
722 $ printf "hello,\n" > hello.whole
723 $ printf "world!\n" > world.whole
723 $ printf "world!\n" > world.whole
724
724
725 $ hg parents --template '{rev} {desc}\n'
725 $ hg parents --template '{rev} {desc}\n'
726 0 the parent commit
726 0 the parent commit
727 $ hg fix --working-dir -r .
727 $ hg fix --working-dir -r .
728 $ hg parents --template '{rev} {desc}\n'
728 $ hg parents --template '{rev} {desc}\n'
729 1 the parent commit
729 1 the parent commit
730 $ hg cat -r . *.whole
730 $ hg cat -r . *.whole
731 HELLO
731 HELLO
732 WORLD
732 WORLD
733 $ cat *.whole
733 $ cat *.whole
734 HELLO,
734 HELLO,
735 WORLD!
735 WORLD!
736 $ hg status
736 $ hg status
737 M hello.whole
737 M hello.whole
738 M world.whole
738 M world.whole
739
739
740 $ cd ..
740 $ cd ..
741
741
742 When we have a chain of commits that change mutually exclusive lines of code,
742 When we have a chain of commits that change mutually exclusive lines of code,
743 we should be able to do incremental fixing that causes each commit in the chain
743 we should be able to do incremental fixing that causes each commit in the chain
744 to include fixes made to the previous commits. This prevents children from
744 to include fixes made to the previous commits. This prevents children from
745 backing out the fixes made in their parents. A dirty working directory is
745 backing out the fixes made in their parents. A dirty working directory is
746 conceptually similar to another commit in the chain.
746 conceptually similar to another commit in the chain.
747
747
748 $ hg init incrementallyfixchain
748 $ hg init incrementallyfixchain
749 $ cd incrementallyfixchain
749 $ cd incrementallyfixchain
750
750
751 $ cat > file.changed <<EOF
751 $ cat > file.changed <<EOF
752 > first
752 > first
753 > second
753 > second
754 > third
754 > third
755 > fourth
755 > fourth
756 > fifth
756 > fifth
757 > EOF
757 > EOF
758 $ hg commit -Aqm "the common ancestor (the baserev)"
758 $ hg commit -Aqm "the common ancestor (the baserev)"
759 $ cat > file.changed <<EOF
759 $ cat > file.changed <<EOF
760 > first (changed)
760 > first (changed)
761 > second
761 > second
762 > third
762 > third
763 > fourth
763 > fourth
764 > fifth
764 > fifth
765 > EOF
765 > EOF
766 $ hg commit -Aqm "the first commit to fix"
766 $ hg commit -Aqm "the first commit to fix"
767 $ cat > file.changed <<EOF
767 $ cat > file.changed <<EOF
768 > first (changed)
768 > first (changed)
769 > second
769 > second
770 > third (changed)
770 > third (changed)
771 > fourth
771 > fourth
772 > fifth
772 > fifth
773 > EOF
773 > EOF
774 $ hg commit -Aqm "the second commit to fix"
774 $ hg commit -Aqm "the second commit to fix"
775 $ cat > file.changed <<EOF
775 $ cat > file.changed <<EOF
776 > first (changed)
776 > first (changed)
777 > second
777 > second
778 > third (changed)
778 > third (changed)
779 > fourth
779 > fourth
780 > fifth (changed)
780 > fifth (changed)
781 > EOF
781 > EOF
782
782
783 $ hg fix -r . -r '.^' --working-dir
783 $ hg fix -r . -r '.^' --working-dir
784
784
785 $ hg parents --template '{rev}\n'
785 $ hg parents --template '{rev}\n'
786 4
786 4
787 $ hg cat -r '.^^' file.changed
787 $ hg cat -r '.^^' file.changed
788 first
788 first
789 second
789 second
790 third
790 third
791 fourth
791 fourth
792 fifth
792 fifth
793 $ hg cat -r '.^' file.changed
793 $ hg cat -r '.^' file.changed
794 FIRST (CHANGED)
794 FIRST (CHANGED)
795 second
795 second
796 third
796 third
797 fourth
797 fourth
798 fifth
798 fifth
799 $ hg cat -r . file.changed
799 $ hg cat -r . file.changed
800 FIRST (CHANGED)
800 FIRST (CHANGED)
801 second
801 second
802 THIRD (CHANGED)
802 THIRD (CHANGED)
803 fourth
803 fourth
804 fifth
804 fifth
805 $ cat file.changed
805 $ cat file.changed
806 FIRST (CHANGED)
806 FIRST (CHANGED)
807 second
807 second
808 THIRD (CHANGED)
808 THIRD (CHANGED)
809 fourth
809 fourth
810 FIFTH (CHANGED)
810 FIFTH (CHANGED)
811
811
812 $ cd ..
812 $ cd ..
813
813
814 If we incrementally fix a merge commit, we should fix any lines that changed
814 If we incrementally fix a merge commit, we should fix any lines that changed
815 versus either parent. You could imagine only fixing the intersection or some
815 versus either parent. You could imagine only fixing the intersection or some
816 other subset, but this is necessary if either parent is being fixed. It
816 other subset, but this is necessary if either parent is being fixed. It
817 prevents us from forgetting fixes made in either parent.
817 prevents us from forgetting fixes made in either parent.
818
818
819 $ hg init incrementallyfixmergecommit
819 $ hg init incrementallyfixmergecommit
820 $ cd incrementallyfixmergecommit
820 $ cd incrementallyfixmergecommit
821
821
822 $ printf "a\nb\nc\n" > file.changed
822 $ printf "a\nb\nc\n" > file.changed
823 $ hg commit -Aqm "ancestor"
823 $ hg commit -Aqm "ancestor"
824
824
825 $ printf "aa\nb\nc\n" > file.changed
825 $ printf "aa\nb\nc\n" > file.changed
826 $ hg commit -m "change a"
826 $ hg commit -m "change a"
827
827
828 $ hg checkout '.^'
828 $ hg checkout '.^'
829 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
829 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
830 $ printf "a\nb\ncc\n" > file.changed
830 $ printf "a\nb\ncc\n" > file.changed
831 $ hg commit -m "change c"
831 $ hg commit -m "change c"
832 created new head
832 created new head
833
833
834 $ hg merge
834 $ hg merge
835 merging file.changed
835 merging file.changed
836 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
836 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
837 (branch merge, don't forget to commit)
837 (branch merge, don't forget to commit)
838 $ hg commit -m "merge"
838 $ hg commit -m "merge"
839 $ hg cat -r . file.changed
839 $ hg cat -r . file.changed
840 aa
840 aa
841 b
841 b
842 cc
842 cc
843
843
844 $ hg fix -r . --working-dir
844 $ hg fix -r . --working-dir
845 $ hg cat -r . file.changed
845 $ hg cat -r . file.changed
846 AA
846 AA
847 b
847 b
848 CC
848 CC
849
849
850 $ cd ..
850 $ cd ..
851
851
852 Abort fixing revisions if there is an unfinished operation. We don't want to
852 Abort fixing revisions if there is an unfinished operation. We don't want to
853 make things worse by editing files or stripping/obsoleting things. Also abort
853 make things worse by editing files or stripping/obsoleting things. Also abort
854 fixing the working directory if there are unresolved merge conflicts.
854 fixing the working directory if there are unresolved merge conflicts.
855
855
856 $ hg init abortunresolved
856 $ hg init abortunresolved
857 $ cd abortunresolved
857 $ cd abortunresolved
858
858
859 $ echo "foo1" > foo.whole
859 $ echo "foo1" > foo.whole
860 $ hg commit -Aqm "foo 1"
860 $ hg commit -Aqm "foo 1"
861
861
862 $ hg update null
862 $ hg update null
863 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
863 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
864 $ echo "foo2" > foo.whole
864 $ echo "foo2" > foo.whole
865 $ hg commit -Aqm "foo 2"
865 $ hg commit -Aqm "foo 2"
866
866
867 $ hg --config extensions.rebase= rebase -r 1 -d 0
867 $ hg --config extensions.rebase= rebase -r 1 -d 0
868 rebasing 1:c3b6dc0e177a "foo 2" (tip)
868 rebasing 1:c3b6dc0e177a "foo 2" (tip)
869 merging foo.whole
869 merging foo.whole
870 warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
870 warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark')
871 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
871 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
872 [1]
872 [1]
873
873
874 $ hg --config extensions.rebase= fix --working-dir
874 $ hg --config extensions.rebase= fix --working-dir
875 abort: unresolved conflicts
875 abort: unresolved conflicts
876 (use 'hg resolve')
876 (use 'hg resolve')
877 [255]
877 [255]
878
878
879 $ hg --config extensions.rebase= fix -r .
879 $ hg --config extensions.rebase= fix -r .
880 abort: rebase in progress
880 abort: rebase in progress
881 (use 'hg rebase --continue' or 'hg rebase --abort')
881 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
882 [255]
882 [255]
883
883
884 $ cd ..
884 $ cd ..
885
885
886 When fixing a file that was renamed, we should diff against the source of the
886 When fixing a file that was renamed, we should diff against the source of the
887 rename for incremental fixing and we should correctly reproduce the rename in
887 rename for incremental fixing and we should correctly reproduce the rename in
888 the replacement revision.
888 the replacement revision.
889
889
890 $ hg init fixrenamecommit
890 $ hg init fixrenamecommit
891 $ cd fixrenamecommit
891 $ cd fixrenamecommit
892
892
893 $ printf "a\nb\nc\n" > source.changed
893 $ printf "a\nb\nc\n" > source.changed
894 $ hg commit -Aqm "source revision"
894 $ hg commit -Aqm "source revision"
895 $ hg move source.changed dest.changed
895 $ hg move source.changed dest.changed
896 $ printf "a\nb\ncc\n" > dest.changed
896 $ printf "a\nb\ncc\n" > dest.changed
897 $ hg commit -m "dest revision"
897 $ hg commit -m "dest revision"
898
898
899 $ hg fix -r .
899 $ hg fix -r .
900 $ hg log -r tip --copies --template "{file_copies}\n"
900 $ hg log -r tip --copies --template "{file_copies}\n"
901 dest.changed (source.changed)
901 dest.changed (source.changed)
902 $ hg cat -r tip dest.changed
902 $ hg cat -r tip dest.changed
903 a
903 a
904 b
904 b
905 CC
905 CC
906
906
907 $ cd ..
907 $ cd ..
908
908
909 When fixing revisions that remove files we must ensure that the replacement
909 When fixing revisions that remove files we must ensure that the replacement
910 actually removes the file, whereas it could accidentally leave it unchanged or
910 actually removes the file, whereas it could accidentally leave it unchanged or
911 write an empty string to it.
911 write an empty string to it.
912
912
913 $ hg init fixremovedfile
913 $ hg init fixremovedfile
914 $ cd fixremovedfile
914 $ cd fixremovedfile
915
915
916 $ printf "foo\n" > foo.whole
916 $ printf "foo\n" > foo.whole
917 $ printf "bar\n" > bar.whole
917 $ printf "bar\n" > bar.whole
918 $ hg commit -Aqm "add files"
918 $ hg commit -Aqm "add files"
919 $ hg remove bar.whole
919 $ hg remove bar.whole
920 $ hg commit -m "remove file"
920 $ hg commit -m "remove file"
921 $ hg status --change .
921 $ hg status --change .
922 R bar.whole
922 R bar.whole
923 $ hg fix -r . foo.whole
923 $ hg fix -r . foo.whole
924 $ hg status --change tip
924 $ hg status --change tip
925 M foo.whole
925 M foo.whole
926 R bar.whole
926 R bar.whole
927
927
928 $ cd ..
928 $ cd ..
929
929
930 If fixing a revision finds no fixes to make, no replacement revision should be
930 If fixing a revision finds no fixes to make, no replacement revision should be
931 created.
931 created.
932
932
933 $ hg init nofixesneeded
933 $ hg init nofixesneeded
934 $ cd nofixesneeded
934 $ cd nofixesneeded
935
935
936 $ printf "FOO\n" > foo.whole
936 $ printf "FOO\n" > foo.whole
937 $ hg commit -Aqm "add file"
937 $ hg commit -Aqm "add file"
938 $ hg log --template '{rev}\n'
938 $ hg log --template '{rev}\n'
939 0
939 0
940 $ hg fix -r .
940 $ hg fix -r .
941 $ hg log --template '{rev}\n'
941 $ hg log --template '{rev}\n'
942 0
942 0
943
943
944 $ cd ..
944 $ cd ..
945
945
946 If fixing a commit reverts all the changes in the commit, we replace it with a
946 If fixing a commit reverts all the changes in the commit, we replace it with a
947 commit that changes no files.
947 commit that changes no files.
948
948
949 $ hg init nochangesleft
949 $ hg init nochangesleft
950 $ cd nochangesleft
950 $ cd nochangesleft
951
951
952 $ printf "FOO\n" > foo.whole
952 $ printf "FOO\n" > foo.whole
953 $ hg commit -Aqm "add file"
953 $ hg commit -Aqm "add file"
954 $ printf "foo\n" > foo.whole
954 $ printf "foo\n" > foo.whole
955 $ hg commit -m "edit file"
955 $ hg commit -m "edit file"
956 $ hg status --change .
956 $ hg status --change .
957 M foo.whole
957 M foo.whole
958 $ hg fix -r .
958 $ hg fix -r .
959 $ hg status --change tip
959 $ hg status --change tip
960
960
961 $ cd ..
961 $ cd ..
962
962
963 If we fix a parent and child revision together, the child revision must be
963 If we fix a parent and child revision together, the child revision must be
964 replaced if the parent is replaced, even if the diffs of the child needed no
964 replaced if the parent is replaced, even if the diffs of the child needed no
965 fixes. However, we're free to not replace revisions that need no fixes and have
965 fixes. However, we're free to not replace revisions that need no fixes and have
966 no ancestors that are replaced.
966 no ancestors that are replaced.
967
967
968 $ hg init mustreplacechild
968 $ hg init mustreplacechild
969 $ cd mustreplacechild
969 $ cd mustreplacechild
970
970
971 $ printf "FOO\n" > foo.whole
971 $ printf "FOO\n" > foo.whole
972 $ hg commit -Aqm "add foo"
972 $ hg commit -Aqm "add foo"
973 $ printf "foo\n" > foo.whole
973 $ printf "foo\n" > foo.whole
974 $ hg commit -m "edit foo"
974 $ hg commit -m "edit foo"
975 $ printf "BAR\n" > bar.whole
975 $ printf "BAR\n" > bar.whole
976 $ hg commit -Aqm "add bar"
976 $ hg commit -Aqm "add bar"
977
977
978 $ hg log --graph --template '{rev} {files}'
978 $ hg log --graph --template '{rev} {files}'
979 @ 2 bar.whole
979 @ 2 bar.whole
980 |
980 |
981 o 1 foo.whole
981 o 1 foo.whole
982 |
982 |
983 o 0 foo.whole
983 o 0 foo.whole
984
984
985 $ hg fix -r 0:2
985 $ hg fix -r 0:2
986 $ hg log --graph --template '{rev} {files}'
986 $ hg log --graph --template '{rev} {files}'
987 o 4 bar.whole
987 o 4 bar.whole
988 |
988 |
989 o 3
989 o 3
990 |
990 |
991 | @ 2 bar.whole
991 | @ 2 bar.whole
992 | |
992 | |
993 | x 1 foo.whole
993 | x 1 foo.whole
994 |/
994 |/
995 o 0 foo.whole
995 o 0 foo.whole
996
996
997
997
998 $ cd ..
998 $ cd ..
999
999
1000 It's also possible that the child needs absolutely no changes, but we still
1000 It's also possible that the child needs absolutely no changes, but we still
1001 need to replace it to update its parent. If we skipped replacing the child
1001 need to replace it to update its parent. If we skipped replacing the child
1002 because it had no file content changes, it would become an orphan for no good
1002 because it had no file content changes, it would become an orphan for no good
1003 reason.
1003 reason.
1004
1004
1005 $ hg init mustreplacechildevenifnop
1005 $ hg init mustreplacechildevenifnop
1006 $ cd mustreplacechildevenifnop
1006 $ cd mustreplacechildevenifnop
1007
1007
1008 $ printf "Foo\n" > foo.whole
1008 $ printf "Foo\n" > foo.whole
1009 $ hg commit -Aqm "add a bad foo"
1009 $ hg commit -Aqm "add a bad foo"
1010 $ printf "FOO\n" > foo.whole
1010 $ printf "FOO\n" > foo.whole
1011 $ hg commit -m "add a good foo"
1011 $ hg commit -m "add a good foo"
1012 $ hg fix -r . -r '.^'
1012 $ hg fix -r . -r '.^'
1013 $ hg log --graph --template '{rev} {desc}'
1013 $ hg log --graph --template '{rev} {desc}'
1014 o 3 add a good foo
1014 o 3 add a good foo
1015 |
1015 |
1016 o 2 add a bad foo
1016 o 2 add a bad foo
1017
1017
1018 @ 1 add a good foo
1018 @ 1 add a good foo
1019 |
1019 |
1020 x 0 add a bad foo
1020 x 0 add a bad foo
1021
1021
1022
1022
1023 $ cd ..
1023 $ cd ..
1024
1024
1025 Similar to the case above, the child revision may become empty as a result of
1025 Similar to the case above, the child revision may become empty as a result of
1026 fixing its parent. We should still create an empty replacement child.
1026 fixing its parent. We should still create an empty replacement child.
1027 TODO: determine how this should interact with ui.allowemptycommit given that
1027 TODO: determine how this should interact with ui.allowemptycommit given that
1028 the empty replacement could have children.
1028 the empty replacement could have children.
1029
1029
1030 $ hg init mustreplacechildevenifempty
1030 $ hg init mustreplacechildevenifempty
1031 $ cd mustreplacechildevenifempty
1031 $ cd mustreplacechildevenifempty
1032
1032
1033 $ printf "foo\n" > foo.whole
1033 $ printf "foo\n" > foo.whole
1034 $ hg commit -Aqm "add foo"
1034 $ hg commit -Aqm "add foo"
1035 $ printf "Foo\n" > foo.whole
1035 $ printf "Foo\n" > foo.whole
1036 $ hg commit -m "edit foo"
1036 $ hg commit -m "edit foo"
1037 $ hg fix -r . -r '.^'
1037 $ hg fix -r . -r '.^'
1038 $ hg log --graph --template '{rev} {desc}\n' --stat
1038 $ hg log --graph --template '{rev} {desc}\n' --stat
1039 o 3 edit foo
1039 o 3 edit foo
1040 |
1040 |
1041 o 2 add foo
1041 o 2 add foo
1042 foo.whole | 1 +
1042 foo.whole | 1 +
1043 1 files changed, 1 insertions(+), 0 deletions(-)
1043 1 files changed, 1 insertions(+), 0 deletions(-)
1044
1044
1045 @ 1 edit foo
1045 @ 1 edit foo
1046 | foo.whole | 2 +-
1046 | foo.whole | 2 +-
1047 | 1 files changed, 1 insertions(+), 1 deletions(-)
1047 | 1 files changed, 1 insertions(+), 1 deletions(-)
1048 |
1048 |
1049 x 0 add foo
1049 x 0 add foo
1050 foo.whole | 1 +
1050 foo.whole | 1 +
1051 1 files changed, 1 insertions(+), 0 deletions(-)
1051 1 files changed, 1 insertions(+), 0 deletions(-)
1052
1052
1053
1053
1054 $ cd ..
1054 $ cd ..
1055
1055
1056 Fixing a secret commit should replace it with another secret commit.
1056 Fixing a secret commit should replace it with another secret commit.
1057
1057
1058 $ hg init fixsecretcommit
1058 $ hg init fixsecretcommit
1059 $ cd fixsecretcommit
1059 $ cd fixsecretcommit
1060
1060
1061 $ printf "foo\n" > foo.whole
1061 $ printf "foo\n" > foo.whole
1062 $ hg commit -Aqm "add foo" --secret
1062 $ hg commit -Aqm "add foo" --secret
1063 $ hg fix -r .
1063 $ hg fix -r .
1064 $ hg log --template '{rev} {phase}\n'
1064 $ hg log --template '{rev} {phase}\n'
1065 1 secret
1065 1 secret
1066 0 secret
1066 0 secret
1067
1067
1068 $ cd ..
1068 $ cd ..
1069
1069
1070 We should also preserve phase when fixing a draft commit while the user has
1070 We should also preserve phase when fixing a draft commit while the user has
1071 their default set to secret.
1071 their default set to secret.
1072
1072
1073 $ hg init respectphasesnewcommit
1073 $ hg init respectphasesnewcommit
1074 $ cd respectphasesnewcommit
1074 $ cd respectphasesnewcommit
1075
1075
1076 $ printf "foo\n" > foo.whole
1076 $ printf "foo\n" > foo.whole
1077 $ hg commit -Aqm "add foo"
1077 $ hg commit -Aqm "add foo"
1078 $ hg --config phases.newcommit=secret fix -r .
1078 $ hg --config phases.newcommit=secret fix -r .
1079 $ hg log --template '{rev} {phase}\n'
1079 $ hg log --template '{rev} {phase}\n'
1080 1 draft
1080 1 draft
1081 0 draft
1081 0 draft
1082
1082
1083 $ cd ..
1083 $ cd ..
1084
1084
1085 Debug output should show what fixer commands are being subprocessed, which is
1085 Debug output should show what fixer commands are being subprocessed, which is
1086 useful for anyone trying to set up a new config.
1086 useful for anyone trying to set up a new config.
1087
1087
1088 $ hg init debugoutput
1088 $ hg init debugoutput
1089 $ cd debugoutput
1089 $ cd debugoutput
1090
1090
1091 $ printf "foo\nbar\nbaz\n" > foo.changed
1091 $ printf "foo\nbar\nbaz\n" > foo.changed
1092 $ hg commit -Aqm "foo"
1092 $ hg commit -Aqm "foo"
1093 $ printf "Foo\nbar\nBaz\n" > foo.changed
1093 $ printf "Foo\nbar\nBaz\n" > foo.changed
1094 $ hg --debug fix --working-dir
1094 $ hg --debug fix --working-dir
1095 subprocess: * $TESTTMP/uppercase.py 1-1 3-3 (glob)
1095 subprocess: * $TESTTMP/uppercase.py 1-1 3-3 (glob)
1096
1096
1097 $ cd ..
1097 $ cd ..
1098
1098
1099 Fixing an obsolete revision can cause divergence, so we abort unless the user
1099 Fixing an obsolete revision can cause divergence, so we abort unless the user
1100 configures to allow it. This is not yet smart enough to know whether there is a
1100 configures to allow it. This is not yet smart enough to know whether there is a
1101 successor, but even then it is not likely intentional or idiomatic to fix an
1101 successor, but even then it is not likely intentional or idiomatic to fix an
1102 obsolete revision.
1102 obsolete revision.
1103
1103
1104 $ hg init abortobsoleterev
1104 $ hg init abortobsoleterev
1105 $ cd abortobsoleterev
1105 $ cd abortobsoleterev
1106
1106
1107 $ printf "foo\n" > foo.changed
1107 $ printf "foo\n" > foo.changed
1108 $ hg commit -Aqm "foo"
1108 $ hg commit -Aqm "foo"
1109 $ hg debugobsolete `hg parents --template '{node}'`
1109 $ hg debugobsolete `hg parents --template '{node}'`
1110 1 new obsolescence markers
1110 1 new obsolescence markers
1111 obsoleted 1 changesets
1111 obsoleted 1 changesets
1112 $ hg --hidden fix -r 0
1112 $ hg --hidden fix -r 0
1113 abort: fixing obsolete revision could cause divergence
1113 abort: fixing obsolete revision could cause divergence
1114 [255]
1114 [255]
1115
1115
1116 $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
1116 $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
1117 $ hg cat -r tip foo.changed
1117 $ hg cat -r tip foo.changed
1118 FOO
1118 FOO
1119
1119
1120 $ cd ..
1120 $ cd ..
1121
1121
1122 Test all of the available substitution values for fixer commands.
1122 Test all of the available substitution values for fixer commands.
1123
1123
1124 $ hg init substitution
1124 $ hg init substitution
1125 $ cd substitution
1125 $ cd substitution
1126
1126
1127 $ mkdir foo
1127 $ mkdir foo
1128 $ printf "hello\ngoodbye\n" > foo/bar
1128 $ printf "hello\ngoodbye\n" > foo/bar
1129 $ hg add
1129 $ hg add
1130 adding foo/bar
1130 adding foo/bar
1131 $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \
1131 $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \
1132 > --config "fix.fail:linerange='{first}' '{last}'" \
1132 > --config "fix.fail:linerange='{first}' '{last}'" \
1133 > --config "fix.fail:pattern=foo/bar" \
1133 > --config "fix.fail:pattern=foo/bar" \
1134 > fix --working-dir
1134 > fix --working-dir
1135 $ cat foo/bar
1135 $ cat foo/bar
1136 foo/bar
1136 foo/bar
1137 bar
1137 bar
1138 1
1138 1
1139 2
1139 2
1140
1140
1141 $ cd ..
1141 $ cd ..
1142
1142
1143 The --base flag should allow picking the revisions to diff against for changed
1143 The --base flag should allow picking the revisions to diff against for changed
1144 files and incremental line formatting.
1144 files and incremental line formatting.
1145
1145
1146 $ hg init baseflag
1146 $ hg init baseflag
1147 $ cd baseflag
1147 $ cd baseflag
1148
1148
1149 $ printf "one\ntwo\n" > foo.changed
1149 $ printf "one\ntwo\n" > foo.changed
1150 $ printf "bar\n" > bar.changed
1150 $ printf "bar\n" > bar.changed
1151 $ hg commit -Aqm "first"
1151 $ hg commit -Aqm "first"
1152 $ printf "one\nTwo\n" > foo.changed
1152 $ printf "one\nTwo\n" > foo.changed
1153 $ hg commit -m "second"
1153 $ hg commit -m "second"
1154 $ hg fix -w --base .
1154 $ hg fix -w --base .
1155 $ hg status
1155 $ hg status
1156 $ hg fix -w --base null
1156 $ hg fix -w --base null
1157 $ cat foo.changed
1157 $ cat foo.changed
1158 ONE
1158 ONE
1159 TWO
1159 TWO
1160 $ cat bar.changed
1160 $ cat bar.changed
1161 BAR
1161 BAR
1162
1162
1163 $ cd ..
1163 $ cd ..
1164
1164
1165 If the user asks to fix the parent of another commit, they are asking to create
1165 If the user asks to fix the parent of another commit, they are asking to create
1166 an orphan. We must respect experimental.evolution.allowunstable.
1166 an orphan. We must respect experimental.evolution.allowunstable.
1167
1167
1168 $ hg init allowunstable
1168 $ hg init allowunstable
1169 $ cd allowunstable
1169 $ cd allowunstable
1170
1170
1171 $ printf "one\n" > foo.whole
1171 $ printf "one\n" > foo.whole
1172 $ hg commit -Aqm "first"
1172 $ hg commit -Aqm "first"
1173 $ printf "two\n" > foo.whole
1173 $ printf "two\n" > foo.whole
1174 $ hg commit -m "second"
1174 $ hg commit -m "second"
1175 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1175 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1176 abort: cannot fix changeset with children
1176 abort: cannot fix changeset with children
1177 [255]
1177 [255]
1178 $ hg fix -r '.^'
1178 $ hg fix -r '.^'
1179 1 new orphan changesets
1179 1 new orphan changesets
1180 $ hg cat -r 2 foo.whole
1180 $ hg cat -r 2 foo.whole
1181 ONE
1181 ONE
1182
1182
1183 $ cd ..
1183 $ cd ..
1184
1184
1185 The --base flag affects the set of files being fixed. So while the --whole flag
1185 The --base flag affects the set of files being fixed. So while the --whole flag
1186 makes the base irrelevant for changed line ranges, it still changes the
1186 makes the base irrelevant for changed line ranges, it still changes the
1187 meaning and effect of the command. In this example, no files or lines are fixed
1187 meaning and effect of the command. In this example, no files or lines are fixed
1188 until we specify the base, but then we do fix unchanged lines.
1188 until we specify the base, but then we do fix unchanged lines.
1189
1189
1190 $ hg init basewhole
1190 $ hg init basewhole
1191 $ cd basewhole
1191 $ cd basewhole
1192 $ printf "foo1\n" > foo.changed
1192 $ printf "foo1\n" > foo.changed
1193 $ hg commit -Aqm "first"
1193 $ hg commit -Aqm "first"
1194 $ printf "foo2\n" >> foo.changed
1194 $ printf "foo2\n" >> foo.changed
1195 $ printf "bar\n" > bar.changed
1195 $ printf "bar\n" > bar.changed
1196 $ hg commit -Aqm "second"
1196 $ hg commit -Aqm "second"
1197
1197
1198 $ hg fix --working-dir --whole
1198 $ hg fix --working-dir --whole
1199 $ cat *.changed
1199 $ cat *.changed
1200 bar
1200 bar
1201 foo1
1201 foo1
1202 foo2
1202 foo2
1203
1203
1204 $ hg fix --working-dir --base 0 --whole
1204 $ hg fix --working-dir --base 0 --whole
1205 $ cat *.changed
1205 $ cat *.changed
1206 BAR
1206 BAR
1207 FOO1
1207 FOO1
1208 FOO2
1208 FOO2
1209
1209
1210 $ cd ..
1210 $ cd ..
1211
1211
1212 The execution order of tools can be controlled. This example doesn't work if
1212 The execution order of tools can be controlled. This example doesn't work if
1213 you sort after truncating, but the config defines the correct order while the
1213 you sort after truncating, but the config defines the correct order while the
1214 definitions are out of order (which might imply the incorrect order given the
1214 definitions are out of order (which might imply the incorrect order given the
1215 implementation of fix). The goal is to use multiple tools to select the lowest
1215 implementation of fix). The goal is to use multiple tools to select the lowest
1216 5 numbers in the file.
1216 5 numbers in the file.
1217
1217
1218 $ hg init priorityexample
1218 $ hg init priorityexample
1219 $ cd priorityexample
1219 $ cd priorityexample
1220
1220
1221 $ cat >> .hg/hgrc <<EOF
1221 $ cat >> .hg/hgrc <<EOF
1222 > [fix]
1222 > [fix]
1223 > head:command = head -n 5
1223 > head:command = head -n 5
1224 > head:pattern = numbers.txt
1224 > head:pattern = numbers.txt
1225 > head:priority = 1
1225 > head:priority = 1
1226 > sort:command = sort -n
1226 > sort:command = sort -n
1227 > sort:pattern = numbers.txt
1227 > sort:pattern = numbers.txt
1228 > sort:priority = 2
1228 > sort:priority = 2
1229 > EOF
1229 > EOF
1230
1230
1231 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1231 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1232 $ hg add -q
1232 $ hg add -q
1233 $ hg fix -w
1233 $ hg fix -w
1234 $ cat numbers.txt
1234 $ cat numbers.txt
1235 0
1235 0
1236 1
1236 1
1237 2
1237 2
1238 3
1238 3
1239 4
1239 4
1240
1240
1241 And of course we should be able to break this by reversing the execution order.
1241 And of course we should be able to break this by reversing the execution order.
1242 Test negative priorities while we're at it.
1242 Test negative priorities while we're at it.
1243
1243
1244 $ cat >> .hg/hgrc <<EOF
1244 $ cat >> .hg/hgrc <<EOF
1245 > [fix]
1245 > [fix]
1246 > head:priority = -1
1246 > head:priority = -1
1247 > sort:priority = -2
1247 > sort:priority = -2
1248 > EOF
1248 > EOF
1249 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1249 $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt
1250 $ hg fix -w
1250 $ hg fix -w
1251 $ cat numbers.txt
1251 $ cat numbers.txt
1252 2
1252 2
1253 3
1253 3
1254 6
1254 6
1255 7
1255 7
1256 8
1256 8
1257
1257
1258 $ cd ..
1258 $ cd ..
1259
1259
1260 It's possible for repeated applications of a fixer tool to create cycles in the
1260 It's possible for repeated applications of a fixer tool to create cycles in the
1261 generated content of a file. For example, two users with different versions of
1261 generated content of a file. For example, two users with different versions of
1262 a code formatter might fight over the formatting when they run hg fix. In the
1262 a code formatter might fight over the formatting when they run hg fix. In the
1263 absence of other changes, this means we could produce commits with the same
1263 absence of other changes, this means we could produce commits with the same
1264 hash in subsequent runs of hg fix. This is a problem unless we support
1264 hash in subsequent runs of hg fix. This is a problem unless we support
1265 obsolescence cycles well. We avoid this by adding an extra field to the
1265 obsolescence cycles well. We avoid this by adding an extra field to the
1266 successor which forces it to have a new hash. That's why this test creates
1266 successor which forces it to have a new hash. That's why this test creates
1267 three revisions instead of two.
1267 three revisions instead of two.
1268
1268
1269 $ hg init cyclictool
1269 $ hg init cyclictool
1270 $ cd cyclictool
1270 $ cd cyclictool
1271
1271
1272 $ cat >> .hg/hgrc <<EOF
1272 $ cat >> .hg/hgrc <<EOF
1273 > [fix]
1273 > [fix]
1274 > swapletters:command = tr ab ba
1274 > swapletters:command = tr ab ba
1275 > swapletters:pattern = foo
1275 > swapletters:pattern = foo
1276 > EOF
1276 > EOF
1277
1277
1278 $ echo ab > foo
1278 $ echo ab > foo
1279 $ hg commit -Aqm foo
1279 $ hg commit -Aqm foo
1280
1280
1281 $ hg fix -r 0
1281 $ hg fix -r 0
1282 $ hg fix -r 1
1282 $ hg fix -r 1
1283
1283
1284 $ hg cat -r 0 foo --hidden
1284 $ hg cat -r 0 foo --hidden
1285 ab
1285 ab
1286 $ hg cat -r 1 foo --hidden
1286 $ hg cat -r 1 foo --hidden
1287 ba
1287 ba
1288 $ hg cat -r 2 foo
1288 $ hg cat -r 2 foo
1289 ab
1289 ab
1290
1290
1291 $ cd ..
1291 $ cd ..
1292
1292
1293 We run fixer tools in the repo root so they can look for config files or other
1293 We run fixer tools in the repo root so they can look for config files or other
1294 important things in the working directory. This does NOT mean we are
1294 important things in the working directory. This does NOT mean we are
1295 reconstructing a working copy of every revision being fixed; we're just giving
1295 reconstructing a working copy of every revision being fixed; we're just giving
1296 the tool knowledge of the repo's location in case it can do something
1296 the tool knowledge of the repo's location in case it can do something
1297 reasonable with that.
1297 reasonable with that.
1298
1298
1299 $ hg init subprocesscwd
1299 $ hg init subprocesscwd
1300 $ cd subprocesscwd
1300 $ cd subprocesscwd
1301
1301
1302 $ cat >> .hg/hgrc <<EOF
1302 $ cat >> .hg/hgrc <<EOF
1303 > [fix]
1303 > [fix]
1304 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())"
1304 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())"
1305 > printcwd:pattern = relpath:foo/bar
1305 > printcwd:pattern = relpath:foo/bar
1306 > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())"
1306 > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())"
1307 > filesetpwd:pattern = set:**quux
1307 > filesetpwd:pattern = set:**quux
1308 > EOF
1308 > EOF
1309
1309
1310 $ mkdir foo
1310 $ mkdir foo
1311 $ printf "bar\n" > foo/bar
1311 $ printf "bar\n" > foo/bar
1312 $ printf "quux\n" > quux
1312 $ printf "quux\n" > quux
1313 $ hg commit -Aqm blah
1313 $ hg commit -Aqm blah
1314
1314
1315 $ hg fix -w -r . foo/bar
1315 $ hg fix -w -r . foo/bar
1316 $ hg cat -r tip foo/bar
1316 $ hg cat -r tip foo/bar
1317 $TESTTMP/subprocesscwd
1317 $TESTTMP/subprocesscwd
1318 $ cat foo/bar
1318 $ cat foo/bar
1319 $TESTTMP/subprocesscwd
1319 $TESTTMP/subprocesscwd
1320
1320
1321 $ cd foo
1321 $ cd foo
1322
1322
1323 $ hg fix -w -r . bar
1323 $ hg fix -w -r . bar
1324 $ hg cat -r tip bar ../quux
1324 $ hg cat -r tip bar ../quux
1325 $TESTTMP/subprocesscwd
1325 $TESTTMP/subprocesscwd
1326 quux
1326 quux
1327 $ cat bar ../quux
1327 $ cat bar ../quux
1328 $TESTTMP/subprocesscwd
1328 $TESTTMP/subprocesscwd
1329 quux
1329 quux
1330 $ echo modified > bar
1330 $ echo modified > bar
1331 $ hg fix -w bar
1331 $ hg fix -w bar
1332 $ cat bar
1332 $ cat bar
1333 $TESTTMP/subprocesscwd
1333 $TESTTMP/subprocesscwd
1334
1334
1335 Apparently fixing p1() and its descendants doesn't include wdir() unless
1335 Apparently fixing p1() and its descendants doesn't include wdir() unless
1336 explicitly stated.
1336 explicitly stated.
1337
1337
1338 $ hg fix -r '.::'
1338 $ hg fix -r '.::'
1339 $ hg cat -r . ../quux
1339 $ hg cat -r . ../quux
1340 quux
1340 quux
1341 $ hg cat -r tip ../quux
1341 $ hg cat -r tip ../quux
1342 fs: $TESTTMP/subprocesscwd
1342 fs: $TESTTMP/subprocesscwd
1343 $ cat ../quux
1343 $ cat ../quux
1344 quux
1344 quux
1345
1345
1346 Clean files are not fixed unless explicitly named
1346 Clean files are not fixed unless explicitly named
1347 $ echo 'dirty' > ../quux
1347 $ echo 'dirty' > ../quux
1348
1348
1349 $ hg fix --working-dir
1349 $ hg fix --working-dir
1350 $ cat ../quux
1350 $ cat ../quux
1351 fs: $TESTTMP/subprocesscwd
1351 fs: $TESTTMP/subprocesscwd
1352
1352
1353 $ cd ../..
1353 $ cd ../..
1354
1354
1355 Tools configured without a pattern are ignored. It would be too dangerous to
1355 Tools configured without a pattern are ignored. It would be too dangerous to
1356 run them on all files, because this might happen while testing a configuration
1356 run them on all files, because this might happen while testing a configuration
1357 that also deletes all of the file content. There is no reasonable subset of the
1357 that also deletes all of the file content. There is no reasonable subset of the
1358 files to use as a default. Users should be explicit about what files are
1358 files to use as a default. Users should be explicit about what files are
1359 affected by a tool. This test also confirms that we don't crash when the
1359 affected by a tool. This test also confirms that we don't crash when the
1360 pattern config is missing, and that we only warn about it once.
1360 pattern config is missing, and that we only warn about it once.
1361
1361
1362 $ hg init nopatternconfigured
1362 $ hg init nopatternconfigured
1363 $ cd nopatternconfigured
1363 $ cd nopatternconfigured
1364
1364
1365 $ printf "foo" > foo
1365 $ printf "foo" > foo
1366 $ printf "bar" > bar
1366 $ printf "bar" > bar
1367 $ hg add -q
1367 $ hg add -q
1368 $ hg fix --debug --working-dir --config "fix.nopattern:command=echo fixed"
1368 $ hg fix --debug --working-dir --config "fix.nopattern:command=echo fixed"
1369 fixer tool has no pattern configuration: nopattern
1369 fixer tool has no pattern configuration: nopattern
1370 $ cat foo bar
1370 $ cat foo bar
1371 foobar (no-eol)
1371 foobar (no-eol)
1372 $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar"
1372 $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar"
1373 fixer tool has no command configuration: nocommand
1373 fixer tool has no command configuration: nocommand
1374
1374
1375 $ cd ..
1375 $ cd ..
1376
1376
1377 Tools can be disabled. Disabled tools do nothing but print a debug message.
1377 Tools can be disabled. Disabled tools do nothing but print a debug message.
1378
1378
1379 $ hg init disabled
1379 $ hg init disabled
1380 $ cd disabled
1380 $ cd disabled
1381
1381
1382 $ printf "foo\n" > foo
1382 $ printf "foo\n" > foo
1383 $ hg add -q
1383 $ hg add -q
1384 $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \
1384 $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \
1385 > --config "fix.disabled:pattern=foo" \
1385 > --config "fix.disabled:pattern=foo" \
1386 > --config "fix.disabled:enabled=false"
1386 > --config "fix.disabled:enabled=false"
1387 ignoring disabled fixer tool: disabled
1387 ignoring disabled fixer tool: disabled
1388 $ cat foo
1388 $ cat foo
1389 foo
1389 foo
1390
1390
1391 $ cd ..
1391 $ cd ..
1392
1392
1393 Test that we can configure a fixer to affect all files regardless of the cwd.
1393 Test that we can configure a fixer to affect all files regardless of the cwd.
1394 The way we invoke matching must not prohibit this.
1394 The way we invoke matching must not prohibit this.
1395
1395
1396 $ hg init affectallfiles
1396 $ hg init affectallfiles
1397 $ cd affectallfiles
1397 $ cd affectallfiles
1398
1398
1399 $ mkdir foo bar
1399 $ mkdir foo bar
1400 $ printf "foo" > foo/file
1400 $ printf "foo" > foo/file
1401 $ printf "bar" > bar/file
1401 $ printf "bar" > bar/file
1402 $ printf "baz" > baz_file
1402 $ printf "baz" > baz_file
1403 $ hg add -q
1403 $ hg add -q
1404
1404
1405 $ cd bar
1405 $ cd bar
1406 $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \
1406 $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \
1407 > --config "fix.cooltool:pattern=glob:**"
1407 > --config "fix.cooltool:pattern=glob:**"
1408 $ cd ..
1408 $ cd ..
1409
1409
1410 $ cat foo/file
1410 $ cat foo/file
1411 fixed
1411 fixed
1412 $ cat bar/file
1412 $ cat bar/file
1413 fixed
1413 fixed
1414 $ cat baz_file
1414 $ cat baz_file
1415 fixed
1415 fixed
1416
1416
1417 $ cd ..
1417 $ cd ..
1418
1418
1419 Tools should be able to run on unchanged files, even if they set :linerange.
1419 Tools should be able to run on unchanged files, even if they set :linerange.
1420 This includes a corner case where deleted chunks of a file are not considered
1420 This includes a corner case where deleted chunks of a file are not considered
1421 changes.
1421 changes.
1422
1422
1423 $ hg init skipclean
1423 $ hg init skipclean
1424 $ cd skipclean
1424 $ cd skipclean
1425
1425
1426 $ printf "a\nb\nc\n" > foo
1426 $ printf "a\nb\nc\n" > foo
1427 $ printf "a\nb\nc\n" > bar
1427 $ printf "a\nb\nc\n" > bar
1428 $ printf "a\nb\nc\n" > baz
1428 $ printf "a\nb\nc\n" > baz
1429 $ hg commit -Aqm "base"
1429 $ hg commit -Aqm "base"
1430
1430
1431 $ printf "a\nc\n" > foo
1431 $ printf "a\nc\n" > foo
1432 $ printf "a\nx\nc\n" > baz
1432 $ printf "a\nx\nc\n" > baz
1433
1433
1434 $ cat >> print.py <<EOF
1434 $ cat >> print.py <<EOF
1435 > import sys
1435 > import sys
1436 > for a in sys.argv[1:]:
1436 > for a in sys.argv[1:]:
1437 > print(a)
1437 > print(a)
1438 > EOF
1438 > EOF
1439
1439
1440 $ hg fix --working-dir foo bar baz \
1440 $ hg fix --working-dir foo bar baz \
1441 > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \
1441 > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \
1442 > --config 'fix.changedlines:linerange="{first} through {last}"' \
1442 > --config 'fix.changedlines:linerange="{first} through {last}"' \
1443 > --config 'fix.changedlines:pattern=glob:**' \
1443 > --config 'fix.changedlines:pattern=glob:**' \
1444 > --config 'fix.changedlines:skipclean=false'
1444 > --config 'fix.changedlines:skipclean=false'
1445
1445
1446 $ cat foo
1446 $ cat foo
1447 Line ranges:
1447 Line ranges:
1448 $ cat bar
1448 $ cat bar
1449 Line ranges:
1449 Line ranges:
1450 $ cat baz
1450 $ cat baz
1451 Line ranges:
1451 Line ranges:
1452 2 through 2
1452 2 through 2
1453
1453
1454 $ cd ..
1454 $ cd ..
1455
1455
1456 Test various cases around merges. We were previously dropping files if they were
1456 Test various cases around merges. We were previously dropping files if they were
1457 created on only the p2 side of the merge, so let's test permutations of:
1457 created on only the p2 side of the merge, so let's test permutations of:
1458 * added, was fixed
1458 * added, was fixed
1459 * added, considered for fixing but was already good
1459 * added, considered for fixing but was already good
1460 * added, not considered for fixing
1460 * added, not considered for fixing
1461 * modified, was fixed
1461 * modified, was fixed
1462 * modified, considered for fixing but was already good
1462 * modified, considered for fixing but was already good
1463 * modified, not considered for fixing
1463 * modified, not considered for fixing
1464
1464
1465 Before the bug was fixed where we would drop files, this test demonstrated the
1465 Before the bug was fixed where we would drop files, this test demonstrated the
1466 following issues:
1466 following issues:
1467 * new_in_r1.ignored, new_in_r1_already_good.changed, and
1467 * new_in_r1.ignored, new_in_r1_already_good.changed, and
1468 > mod_in_r1_already_good.changed were NOT in the manifest for the merge commit
1468 > mod_in_r1_already_good.changed were NOT in the manifest for the merge commit
1469 * mod_in_r1.ignored had its contents from r0, NOT r1.
1469 * mod_in_r1.ignored had its contents from r0, NOT r1.
1470
1470
1471 We're also setting a named branch for every commit to demonstrate that the
1471 We're also setting a named branch for every commit to demonstrate that the
1472 branch is kept intact and there aren't issues updating to another branch in the
1472 branch is kept intact and there aren't issues updating to another branch in the
1473 middle of fix.
1473 middle of fix.
1474
1474
1475 $ hg init merge_keeps_files
1475 $ hg init merge_keeps_files
1476 $ cd merge_keeps_files
1476 $ cd merge_keeps_files
1477 $ for f in r0 mod_in_r1 mod_in_r2 mod_in_merge mod_in_child; do
1477 $ for f in r0 mod_in_r1 mod_in_r2 mod_in_merge mod_in_child; do
1478 > for c in changed whole ignored; do
1478 > for c in changed whole ignored; do
1479 > printf "hello\n" > $f.$c
1479 > printf "hello\n" > $f.$c
1480 > done
1480 > done
1481 > printf "HELLO\n" > "mod_in_${f}_already_good.changed"
1481 > printf "HELLO\n" > "mod_in_${f}_already_good.changed"
1482 > done
1482 > done
1483 $ hg branch -q r0
1483 $ hg branch -q r0
1484 $ hg ci -Aqm 'r0'
1484 $ hg ci -Aqm 'r0'
1485 $ hg phase -p
1485 $ hg phase -p
1486 $ make_test_files() {
1486 $ make_test_files() {
1487 > printf "world\n" >> "mod_in_$1.changed"
1487 > printf "world\n" >> "mod_in_$1.changed"
1488 > printf "world\n" >> "mod_in_$1.whole"
1488 > printf "world\n" >> "mod_in_$1.whole"
1489 > printf "world\n" >> "mod_in_$1.ignored"
1489 > printf "world\n" >> "mod_in_$1.ignored"
1490 > printf "WORLD\n" >> "mod_in_$1_already_good.changed"
1490 > printf "WORLD\n" >> "mod_in_$1_already_good.changed"
1491 > printf "new in $1\n" > "new_in_$1.changed"
1491 > printf "new in $1\n" > "new_in_$1.changed"
1492 > printf "new in $1\n" > "new_in_$1.whole"
1492 > printf "new in $1\n" > "new_in_$1.whole"
1493 > printf "new in $1\n" > "new_in_$1.ignored"
1493 > printf "new in $1\n" > "new_in_$1.ignored"
1494 > printf "ALREADY GOOD, NEW IN THIS REV\n" > "new_in_$1_already_good.changed"
1494 > printf "ALREADY GOOD, NEW IN THIS REV\n" > "new_in_$1_already_good.changed"
1495 > }
1495 > }
1496 $ make_test_commit() {
1496 $ make_test_commit() {
1497 > make_test_files "$1"
1497 > make_test_files "$1"
1498 > hg branch -q "$1"
1498 > hg branch -q "$1"
1499 > hg ci -Aqm "$2"
1499 > hg ci -Aqm "$2"
1500 > }
1500 > }
1501 $ make_test_commit r1 "merge me, pt1"
1501 $ make_test_commit r1 "merge me, pt1"
1502 $ hg co -q ".^"
1502 $ hg co -q ".^"
1503 $ make_test_commit r2 "merge me, pt2"
1503 $ make_test_commit r2 "merge me, pt2"
1504 $ hg merge -qr 1
1504 $ hg merge -qr 1
1505 $ make_test_commit merge "evil merge"
1505 $ make_test_commit merge "evil merge"
1506 $ make_test_commit child "child of merge"
1506 $ make_test_commit child "child of merge"
1507 $ make_test_files wdir
1507 $ make_test_files wdir
1508 $ hg fix -r 'not public()' -w
1508 $ hg fix -r 'not public()' -w
1509 $ hg log -G -T'{rev}:{shortest(node,8)}: branch:{branch} desc:{desc}'
1509 $ hg log -G -T'{rev}:{shortest(node,8)}: branch:{branch} desc:{desc}'
1510 @ 8:c22ce900: branch:child desc:child of merge
1510 @ 8:c22ce900: branch:child desc:child of merge
1511 |
1511 |
1512 o 7:5a30615a: branch:merge desc:evil merge
1512 o 7:5a30615a: branch:merge desc:evil merge
1513 |\
1513 |\
1514 | o 6:4e5acdc4: branch:r2 desc:merge me, pt2
1514 | o 6:4e5acdc4: branch:r2 desc:merge me, pt2
1515 | |
1515 | |
1516 o | 5:eea01878: branch:r1 desc:merge me, pt1
1516 o | 5:eea01878: branch:r1 desc:merge me, pt1
1517 |/
1517 |/
1518 o 0:0c548d87: branch:r0 desc:r0
1518 o 0:0c548d87: branch:r0 desc:r0
1519
1519
1520 $ hg files -r tip
1520 $ hg files -r tip
1521 mod_in_child.changed
1521 mod_in_child.changed
1522 mod_in_child.ignored
1522 mod_in_child.ignored
1523 mod_in_child.whole
1523 mod_in_child.whole
1524 mod_in_child_already_good.changed
1524 mod_in_child_already_good.changed
1525 mod_in_merge.changed
1525 mod_in_merge.changed
1526 mod_in_merge.ignored
1526 mod_in_merge.ignored
1527 mod_in_merge.whole
1527 mod_in_merge.whole
1528 mod_in_merge_already_good.changed
1528 mod_in_merge_already_good.changed
1529 mod_in_mod_in_child_already_good.changed
1529 mod_in_mod_in_child_already_good.changed
1530 mod_in_mod_in_merge_already_good.changed
1530 mod_in_mod_in_merge_already_good.changed
1531 mod_in_mod_in_r1_already_good.changed
1531 mod_in_mod_in_r1_already_good.changed
1532 mod_in_mod_in_r2_already_good.changed
1532 mod_in_mod_in_r2_already_good.changed
1533 mod_in_r0_already_good.changed
1533 mod_in_r0_already_good.changed
1534 mod_in_r1.changed
1534 mod_in_r1.changed
1535 mod_in_r1.ignored
1535 mod_in_r1.ignored
1536 mod_in_r1.whole
1536 mod_in_r1.whole
1537 mod_in_r1_already_good.changed
1537 mod_in_r1_already_good.changed
1538 mod_in_r2.changed
1538 mod_in_r2.changed
1539 mod_in_r2.ignored
1539 mod_in_r2.ignored
1540 mod_in_r2.whole
1540 mod_in_r2.whole
1541 mod_in_r2_already_good.changed
1541 mod_in_r2_already_good.changed
1542 new_in_child.changed
1542 new_in_child.changed
1543 new_in_child.ignored
1543 new_in_child.ignored
1544 new_in_child.whole
1544 new_in_child.whole
1545 new_in_child_already_good.changed
1545 new_in_child_already_good.changed
1546 new_in_merge.changed
1546 new_in_merge.changed
1547 new_in_merge.ignored
1547 new_in_merge.ignored
1548 new_in_merge.whole
1548 new_in_merge.whole
1549 new_in_merge_already_good.changed
1549 new_in_merge_already_good.changed
1550 new_in_r1.changed
1550 new_in_r1.changed
1551 new_in_r1.ignored
1551 new_in_r1.ignored
1552 new_in_r1.whole
1552 new_in_r1.whole
1553 new_in_r1_already_good.changed
1553 new_in_r1_already_good.changed
1554 new_in_r2.changed
1554 new_in_r2.changed
1555 new_in_r2.ignored
1555 new_in_r2.ignored
1556 new_in_r2.whole
1556 new_in_r2.whole
1557 new_in_r2_already_good.changed
1557 new_in_r2_already_good.changed
1558 r0.changed
1558 r0.changed
1559 r0.ignored
1559 r0.ignored
1560 r0.whole
1560 r0.whole
1561 $ for f in "$(hg files -r tip)"; do hg cat -r tip $f -T'{path}:\n{data}\n'; done
1561 $ for f in "$(hg files -r tip)"; do hg cat -r tip $f -T'{path}:\n{data}\n'; done
1562 mod_in_child.changed:
1562 mod_in_child.changed:
1563 hello
1563 hello
1564 WORLD
1564 WORLD
1565
1565
1566 mod_in_child.ignored:
1566 mod_in_child.ignored:
1567 hello
1567 hello
1568 world
1568 world
1569
1569
1570 mod_in_child.whole:
1570 mod_in_child.whole:
1571 HELLO
1571 HELLO
1572 WORLD
1572 WORLD
1573
1573
1574 mod_in_child_already_good.changed:
1574 mod_in_child_already_good.changed:
1575 WORLD
1575 WORLD
1576
1576
1577 mod_in_merge.changed:
1577 mod_in_merge.changed:
1578 hello
1578 hello
1579 WORLD
1579 WORLD
1580
1580
1581 mod_in_merge.ignored:
1581 mod_in_merge.ignored:
1582 hello
1582 hello
1583 world
1583 world
1584
1584
1585 mod_in_merge.whole:
1585 mod_in_merge.whole:
1586 HELLO
1586 HELLO
1587 WORLD
1587 WORLD
1588
1588
1589 mod_in_merge_already_good.changed:
1589 mod_in_merge_already_good.changed:
1590 WORLD
1590 WORLD
1591
1591
1592 mod_in_mod_in_child_already_good.changed:
1592 mod_in_mod_in_child_already_good.changed:
1593 HELLO
1593 HELLO
1594
1594
1595 mod_in_mod_in_merge_already_good.changed:
1595 mod_in_mod_in_merge_already_good.changed:
1596 HELLO
1596 HELLO
1597
1597
1598 mod_in_mod_in_r1_already_good.changed:
1598 mod_in_mod_in_r1_already_good.changed:
1599 HELLO
1599 HELLO
1600
1600
1601 mod_in_mod_in_r2_already_good.changed:
1601 mod_in_mod_in_r2_already_good.changed:
1602 HELLO
1602 HELLO
1603
1603
1604 mod_in_r0_already_good.changed:
1604 mod_in_r0_already_good.changed:
1605 HELLO
1605 HELLO
1606
1606
1607 mod_in_r1.changed:
1607 mod_in_r1.changed:
1608 hello
1608 hello
1609 WORLD
1609 WORLD
1610
1610
1611 mod_in_r1.ignored:
1611 mod_in_r1.ignored:
1612 hello
1612 hello
1613 world
1613 world
1614
1614
1615 mod_in_r1.whole:
1615 mod_in_r1.whole:
1616 HELLO
1616 HELLO
1617 WORLD
1617 WORLD
1618
1618
1619 mod_in_r1_already_good.changed:
1619 mod_in_r1_already_good.changed:
1620 WORLD
1620 WORLD
1621
1621
1622 mod_in_r2.changed:
1622 mod_in_r2.changed:
1623 hello
1623 hello
1624 WORLD
1624 WORLD
1625
1625
1626 mod_in_r2.ignored:
1626 mod_in_r2.ignored:
1627 hello
1627 hello
1628 world
1628 world
1629
1629
1630 mod_in_r2.whole:
1630 mod_in_r2.whole:
1631 HELLO
1631 HELLO
1632 WORLD
1632 WORLD
1633
1633
1634 mod_in_r2_already_good.changed:
1634 mod_in_r2_already_good.changed:
1635 WORLD
1635 WORLD
1636
1636
1637 new_in_child.changed:
1637 new_in_child.changed:
1638 NEW IN CHILD
1638 NEW IN CHILD
1639
1639
1640 new_in_child.ignored:
1640 new_in_child.ignored:
1641 new in child
1641 new in child
1642
1642
1643 new_in_child.whole:
1643 new_in_child.whole:
1644 NEW IN CHILD
1644 NEW IN CHILD
1645
1645
1646 new_in_child_already_good.changed:
1646 new_in_child_already_good.changed:
1647 ALREADY GOOD, NEW IN THIS REV
1647 ALREADY GOOD, NEW IN THIS REV
1648
1648
1649 new_in_merge.changed:
1649 new_in_merge.changed:
1650 NEW IN MERGE
1650 NEW IN MERGE
1651
1651
1652 new_in_merge.ignored:
1652 new_in_merge.ignored:
1653 new in merge
1653 new in merge
1654
1654
1655 new_in_merge.whole:
1655 new_in_merge.whole:
1656 NEW IN MERGE
1656 NEW IN MERGE
1657
1657
1658 new_in_merge_already_good.changed:
1658 new_in_merge_already_good.changed:
1659 ALREADY GOOD, NEW IN THIS REV
1659 ALREADY GOOD, NEW IN THIS REV
1660
1660
1661 new_in_r1.changed:
1661 new_in_r1.changed:
1662 NEW IN R1
1662 NEW IN R1
1663
1663
1664 new_in_r1.ignored:
1664 new_in_r1.ignored:
1665 new in r1
1665 new in r1
1666
1666
1667 new_in_r1.whole:
1667 new_in_r1.whole:
1668 NEW IN R1
1668 NEW IN R1
1669
1669
1670 new_in_r1_already_good.changed:
1670 new_in_r1_already_good.changed:
1671 ALREADY GOOD, NEW IN THIS REV
1671 ALREADY GOOD, NEW IN THIS REV
1672
1672
1673 new_in_r2.changed:
1673 new_in_r2.changed:
1674 NEW IN R2
1674 NEW IN R2
1675
1675
1676 new_in_r2.ignored:
1676 new_in_r2.ignored:
1677 new in r2
1677 new in r2
1678
1678
1679 new_in_r2.whole:
1679 new_in_r2.whole:
1680 NEW IN R2
1680 NEW IN R2
1681
1681
1682 new_in_r2_already_good.changed:
1682 new_in_r2_already_good.changed:
1683 ALREADY GOOD, NEW IN THIS REV
1683 ALREADY GOOD, NEW IN THIS REV
1684
1684
1685 r0.changed:
1685 r0.changed:
1686 hello
1686 hello
1687
1687
1688 r0.ignored:
1688 r0.ignored:
1689 hello
1689 hello
1690
1690
1691 r0.whole:
1691 r0.whole:
1692 hello
1692 hello
1693
1693
@@ -1,511 +1,511 b''
1 #testcases abortcommand abortflag
1 #testcases abortcommand abortflag
2 #testcases continuecommand continueflag
2 #testcases continuecommand continueflag
3
3
4 $ cat >> $HGRCPATH <<EOF
4 $ cat >> $HGRCPATH <<EOF
5 > [extensions]
5 > [extensions]
6 > rebase=
6 > rebase=
7 >
7 >
8 > [phases]
8 > [phases]
9 > publish=False
9 > publish=False
10 >
10 >
11 > [alias]
11 > [alias]
12 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
12 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
13 > EOF
13 > EOF
14
14
15 #if abortflag
15 #if abortflag
16 $ cat >> $HGRCPATH <<EOF
16 $ cat >> $HGRCPATH <<EOF
17 > [alias]
17 > [alias]
18 > abort = rebase --abort
18 > abort = rebase --abort
19 > EOF
19 > EOF
20 #endif
20 #endif
21
21
22 #if continueflag
22 #if continueflag
23 $ cat >> $HGRCPATH <<EOF
23 $ cat >> $HGRCPATH <<EOF
24 > [alias]
24 > [alias]
25 > continue = rebase --continue
25 > continue = rebase --continue
26 > EOF
26 > EOF
27 #endif
27 #endif
28
28
29 $ hg init a
29 $ hg init a
30 $ cd a
30 $ cd a
31
31
32 $ touch .hg/rebasestate
32 $ touch .hg/rebasestate
33 $ hg sum
33 $ hg sum
34 parent: -1:000000000000 tip (empty repository)
34 parent: -1:000000000000 tip (empty repository)
35 branch: default
35 branch: default
36 commit: (clean)
36 commit: (clean)
37 update: (current)
37 update: (current)
38 abort: .hg/rebasestate is incomplete
38 abort: .hg/rebasestate is incomplete
39 [255]
39 [255]
40 $ rm .hg/rebasestate
40 $ rm .hg/rebasestate
41
41
42 $ echo c1 > common
42 $ echo c1 > common
43 $ hg add common
43 $ hg add common
44 $ hg ci -m C1
44 $ hg ci -m C1
45
45
46 $ echo c2 >> common
46 $ echo c2 >> common
47 $ hg ci -m C2
47 $ hg ci -m C2
48
48
49 $ echo c3 >> common
49 $ echo c3 >> common
50 $ hg ci -m C3
50 $ hg ci -m C3
51
51
52 $ hg up -q -C 1
52 $ hg up -q -C 1
53
53
54 $ echo l1 >> extra
54 $ echo l1 >> extra
55 $ hg add extra
55 $ hg add extra
56 $ hg ci -m L1
56 $ hg ci -m L1
57 created new head
57 created new head
58
58
59 $ sed -e 's/c2/l2/' common > common.new
59 $ sed -e 's/c2/l2/' common > common.new
60 $ mv common.new common
60 $ mv common.new common
61 $ hg ci -m L2
61 $ hg ci -m L2
62
62
63 $ hg phase --force --secret 2
63 $ hg phase --force --secret 2
64
64
65 $ hg tglog
65 $ hg tglog
66 @ 4:draft 'L2'
66 @ 4:draft 'L2'
67 |
67 |
68 o 3:draft 'L1'
68 o 3:draft 'L1'
69 |
69 |
70 | o 2:secret 'C3'
70 | o 2:secret 'C3'
71 |/
71 |/
72 o 1:draft 'C2'
72 o 1:draft 'C2'
73 |
73 |
74 o 0:draft 'C1'
74 o 0:draft 'C1'
75
75
76
76
77 Conflicting rebase:
77 Conflicting rebase:
78
78
79 $ hg rebase -s 3 -d 2
79 $ hg rebase -s 3 -d 2
80 rebasing 3:3163e20567cc "L1"
80 rebasing 3:3163e20567cc "L1"
81 rebasing 4:46f0b057b5c0 "L2" (tip)
81 rebasing 4:46f0b057b5c0 "L2" (tip)
82 merging common
82 merging common
83 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
83 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
84 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
84 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
85 [1]
85 [1]
86
86
87 Insert unsupported advisory merge record:
87 Insert unsupported advisory merge record:
88
88
89 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
89 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x
90 $ hg debugmergestate
90 $ hg debugmergestate
91 local (dest): 3e046f2ecedb793b97ed32108086edd1a162f8bc
91 local (dest): 3e046f2ecedb793b97ed32108086edd1a162f8bc
92 other (source): 46f0b057b5c061d276b91491c22151f78698abd2
92 other (source): 46f0b057b5c061d276b91491c22151f78698abd2
93 file: common (state "u")
93 file: common (state "u")
94 local path: common (hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1, flags "")
94 local path: common (hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1, flags "")
95 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
95 ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
96 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
96 other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
97 extra: ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c
97 extra: ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c
98 $ hg resolve -l
98 $ hg resolve -l
99 U common
99 U common
100
100
101 Insert unsupported mandatory merge record:
101 Insert unsupported mandatory merge record:
102
102
103 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
103 $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X
104 $ hg debugmergestate
104 $ hg debugmergestate
105 abort: unsupported merge state records: X
105 abort: unsupported merge state records: X
106 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
106 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
107 [255]
107 [255]
108 $ hg resolve -l
108 $ hg resolve -l
109 abort: unsupported merge state records: X
109 abort: unsupported merge state records: X
110 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
110 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
111 [255]
111 [255]
112 $ hg resolve -ma
112 $ hg resolve -ma
113 abort: unsupported merge state records: X
113 abort: unsupported merge state records: X
114 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
114 (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
115 [255]
115 [255]
116
116
117 Abort (should clear out unsupported merge state):
117 Abort (should clear out unsupported merge state):
118
118
119 #if abortcommand
119 #if abortcommand
120 when in dry-run mode
120 when in dry-run mode
121 $ hg abort --dry-run
121 $ hg abort --dry-run
122 rebase in progress, will be aborted
122 rebase in progress, will be aborted
123 #endif
123 #endif
124
124
125 $ hg abort
125 $ hg abort
126 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
126 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
127 rebase aborted
127 rebase aborted
128 $ hg debugmergestate
128 $ hg debugmergestate
129 no merge state found
129 no merge state found
130
130
131 $ hg tglog
131 $ hg tglog
132 @ 4:draft 'L2'
132 @ 4:draft 'L2'
133 |
133 |
134 o 3:draft 'L1'
134 o 3:draft 'L1'
135 |
135 |
136 | o 2:secret 'C3'
136 | o 2:secret 'C3'
137 |/
137 |/
138 o 1:draft 'C2'
138 o 1:draft 'C2'
139 |
139 |
140 o 0:draft 'C1'
140 o 0:draft 'C1'
141
141
142 Test safety for inconsistent rebase state, which may be created (and
142 Test safety for inconsistent rebase state, which may be created (and
143 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
143 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
144 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
144 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
145
145
146 $ hg rebase -s 3 -d 2
146 $ hg rebase -s 3 -d 2
147 rebasing 3:3163e20567cc "L1"
147 rebasing 3:3163e20567cc "L1"
148 rebasing 4:46f0b057b5c0 "L2" (tip)
148 rebasing 4:46f0b057b5c0 "L2" (tip)
149 merging common
149 merging common
150 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
150 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
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 $ mv .hg/rebasestate .hg/rebasestate.back
154 $ mv .hg/rebasestate .hg/rebasestate.back
155 $ hg update --quiet --clean 2
155 $ hg update --quiet --clean 2
156 $ hg --config extensions.mq= strip --quiet "destination()"
156 $ hg --config extensions.mq= strip --quiet "destination()"
157 $ mv .hg/rebasestate.back .hg/rebasestate
157 $ mv .hg/rebasestate.back .hg/rebasestate
158
158
159 $ hg continue
159 $ hg continue
160 abort: cannot continue inconsistent rebase
160 abort: cannot continue inconsistent rebase
161 (use "hg rebase --abort" to clear broken state)
161 (use "hg rebase --abort" to clear broken state)
162 [255]
162 [255]
163 $ hg summary | grep '^rebase: '
163 $ hg summary | grep '^rebase: '
164 rebase: (use "hg rebase --abort" to clear broken state)
164 rebase: (use "hg rebase --abort" to clear broken state)
165 $ hg abort
165 $ hg abort
166 rebase aborted (no revision is removed, only broken state is cleared)
166 rebase aborted (no revision is removed, only broken state is cleared)
167
167
168 $ cd ..
168 $ cd ..
169
169
170
170
171 Construct new repo:
171 Construct new repo:
172
172
173 $ hg init b
173 $ hg init b
174 $ cd b
174 $ cd b
175
175
176 $ echo a > a
176 $ echo a > a
177 $ hg ci -Am A
177 $ hg ci -Am A
178 adding a
178 adding a
179
179
180 $ echo b > b
180 $ echo b > b
181 $ hg ci -Am B
181 $ hg ci -Am B
182 adding b
182 adding b
183
183
184 $ echo c > c
184 $ echo c > c
185 $ hg ci -Am C
185 $ hg ci -Am C
186 adding c
186 adding c
187
187
188 $ hg up -q 0
188 $ hg up -q 0
189
189
190 $ echo b > b
190 $ echo b > b
191 $ hg ci -Am 'B bis'
191 $ hg ci -Am 'B bis'
192 adding b
192 adding b
193 created new head
193 created new head
194
194
195 $ echo c1 > c
195 $ echo c1 > c
196 $ hg ci -Am C1
196 $ hg ci -Am C1
197 adding c
197 adding c
198
198
199 $ hg phase --force --secret 1
199 $ hg phase --force --secret 1
200 $ hg phase --public 1
200 $ hg phase --public 1
201
201
202 Rebase and abort without generating new changesets:
202 Rebase and abort without generating new changesets:
203
203
204 $ hg tglog
204 $ hg tglog
205 @ 4:draft 'C1'
205 @ 4:draft 'C1'
206 |
206 |
207 o 3:draft 'B bis'
207 o 3:draft 'B bis'
208 |
208 |
209 | o 2:secret 'C'
209 | o 2:secret 'C'
210 | |
210 | |
211 | o 1:public 'B'
211 | o 1:public 'B'
212 |/
212 |/
213 o 0:public 'A'
213 o 0:public 'A'
214
214
215 $ hg rebase -b 4 -d 2
215 $ hg rebase -b 4 -d 2
216 rebasing 3:a6484957d6b9 "B bis"
216 rebasing 3:a6484957d6b9 "B bis"
217 note: not rebasing 3:a6484957d6b9 "B bis", its destination already has all its changes
217 note: not rebasing 3:a6484957d6b9 "B bis", its destination already has all its changes
218 rebasing 4:145842775fec "C1" (tip)
218 rebasing 4:145842775fec "C1" (tip)
219 merging c
219 merging c
220 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
220 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
221 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
221 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
222 [1]
222 [1]
223
223
224 $ hg tglog
224 $ hg tglog
225 % 4:draft 'C1'
225 % 4:draft 'C1'
226 |
226 |
227 o 3:draft 'B bis'
227 o 3:draft 'B bis'
228 |
228 |
229 | @ 2:secret 'C'
229 | @ 2:secret 'C'
230 | |
230 | |
231 | o 1:public 'B'
231 | o 1:public 'B'
232 |/
232 |/
233 o 0:public 'A'
233 o 0:public 'A'
234
234
235 $ hg rebase -a
235 $ hg rebase -a
236 rebase aborted
236 rebase aborted
237
237
238 $ hg tglog
238 $ hg tglog
239 @ 4:draft 'C1'
239 @ 4:draft 'C1'
240 |
240 |
241 o 3:draft 'B bis'
241 o 3:draft 'B bis'
242 |
242 |
243 | o 2:secret 'C'
243 | o 2:secret 'C'
244 | |
244 | |
245 | o 1:public 'B'
245 | o 1:public 'B'
246 |/
246 |/
247 o 0:public 'A'
247 o 0:public 'A'
248
248
249
249
250 $ cd ..
250 $ cd ..
251
251
252 rebase abort should not leave working copy in a merge state if tip-1 is public
252 rebase abort should not leave working copy in a merge state if tip-1 is public
253 (issue4082)
253 (issue4082)
254
254
255 $ hg init abortpublic
255 $ hg init abortpublic
256 $ cd abortpublic
256 $ cd abortpublic
257 $ echo a > a && hg ci -Aqm a
257 $ echo a > a && hg ci -Aqm a
258 $ hg book master
258 $ hg book master
259 $ hg book foo
259 $ hg book foo
260 $ echo b > b && hg ci -Aqm b
260 $ echo b > b && hg ci -Aqm b
261 $ hg up -q master
261 $ hg up -q master
262 $ echo c > c && hg ci -Aqm c
262 $ echo c > c && hg ci -Aqm c
263 $ hg phase -p -r .
263 $ hg phase -p -r .
264 $ hg up -q foo
264 $ hg up -q foo
265 $ echo C > c && hg ci -Aqm C
265 $ echo C > c && hg ci -Aqm C
266 $ hg log -G --template "{rev} {desc} {bookmarks}"
266 $ hg log -G --template "{rev} {desc} {bookmarks}"
267 @ 3 C foo
267 @ 3 C foo
268 |
268 |
269 | o 2 c master
269 | o 2 c master
270 | |
270 | |
271 o | 1 b
271 o | 1 b
272 |/
272 |/
273 o 0 a
273 o 0 a
274
274
275
275
276 $ hg rebase -d master -r foo
276 $ hg rebase -d master -r foo
277 rebasing 3:6c0f977a22d8 "C" (foo tip)
277 rebasing 3:6c0f977a22d8 "C" (foo tip)
278 merging c
278 merging c
279 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
279 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
280 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
280 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
281 [1]
281 [1]
282 $ hg abort
282 $ hg abort
283 rebase aborted
283 rebase aborted
284 $ hg log -G --template "{rev} {desc} {bookmarks}"
284 $ hg log -G --template "{rev} {desc} {bookmarks}"
285 @ 3 C foo
285 @ 3 C foo
286 |
286 |
287 | o 2 c master
287 | o 2 c master
288 | |
288 | |
289 o | 1 b
289 o | 1 b
290 |/
290 |/
291 o 0 a
291 o 0 a
292
292
293 $ cd ..
293 $ cd ..
294
294
295 Make sure we don't clobber changes in the working directory when the
295 Make sure we don't clobber changes in the working directory when the
296 user has somehow managed to update to a different revision (issue4009)
296 user has somehow managed to update to a different revision (issue4009)
297
297
298 $ hg init noupdate
298 $ hg init noupdate
299 $ cd noupdate
299 $ cd noupdate
300 $ hg book @
300 $ hg book @
301 $ echo original > a
301 $ echo original > a
302 $ hg add a
302 $ hg add a
303 $ hg commit -m a
303 $ hg commit -m a
304 $ echo x > b
304 $ echo x > b
305 $ hg add b
305 $ hg add b
306 $ hg commit -m b1
306 $ hg commit -m b1
307 $ hg up 0
307 $ hg up 0
308 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
308 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
309 (leaving bookmark @)
309 (leaving bookmark @)
310 $ hg book foo
310 $ hg book foo
311 $ echo y > b
311 $ echo y > b
312 $ hg add b
312 $ hg add b
313 $ hg commit -m b2
313 $ hg commit -m b2
314 created new head
314 created new head
315
315
316 $ hg rebase -d @ -b foo --tool=internal:fail
316 $ hg rebase -d @ -b foo --tool=internal:fail
317 rebasing 2:070cf4580bb5 "b2" (foo tip)
317 rebasing 2:070cf4580bb5 "b2" (foo tip)
318 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
318 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
319 [1]
319 [1]
320
320
321 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
321 $ mv .hg/rebasestate ./ # so we're allowed to hg up like in mercurial <2.6.3
322 $ hg up -C 0 # user does other stuff in the repo
322 $ hg up -C 0 # user does other stuff in the repo
323 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
323 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
324
324
325 $ mv rebasestate .hg/ # user upgrades to 2.7
325 $ mv rebasestate .hg/ # user upgrades to 2.7
326
326
327 $ echo new > a
327 $ echo new > a
328 $ hg up 1 # user gets an error saying to run hg rebase --abort
328 $ hg up 1 # user gets an error saying to run hg rebase --abort
329 abort: rebase in progress
329 abort: rebase in progress
330 (use 'hg rebase --continue' or 'hg rebase --abort')
330 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
331 [255]
331 [255]
332
332
333 $ cat a
333 $ cat a
334 new
334 new
335 $ hg abort
335 $ hg abort
336 rebase aborted
336 rebase aborted
337 $ cat a
337 $ cat a
338 new
338 new
339
339
340 $ cd ..
340 $ cd ..
341
341
342 test aborting an interrupted series (issue5084)
342 test aborting an interrupted series (issue5084)
343 $ hg init interrupted
343 $ hg init interrupted
344 $ cd interrupted
344 $ cd interrupted
345 $ touch base
345 $ touch base
346 $ hg add base
346 $ hg add base
347 $ hg commit -m base
347 $ hg commit -m base
348 $ touch a
348 $ touch a
349 $ hg add a
349 $ hg add a
350 $ hg commit -m a
350 $ hg commit -m a
351 $ echo 1 > a
351 $ echo 1 > a
352 $ hg commit -m 1
352 $ hg commit -m 1
353 $ touch b
353 $ touch b
354 $ hg add b
354 $ hg add b
355 $ hg commit -m b
355 $ hg commit -m b
356 $ echo 2 >> a
356 $ echo 2 >> a
357 $ hg commit -m c
357 $ hg commit -m c
358 $ touch d
358 $ touch d
359 $ hg add d
359 $ hg add d
360 $ hg commit -m d
360 $ hg commit -m d
361 $ hg co -q 1
361 $ hg co -q 1
362 $ hg rm a
362 $ hg rm a
363 $ hg commit -m no-a
363 $ hg commit -m no-a
364 created new head
364 created new head
365 $ hg co 0
365 $ hg co 0
366 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
366 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 $ hg log -G --template "{rev} {desc} {bookmarks}"
367 $ hg log -G --template "{rev} {desc} {bookmarks}"
368 o 6 no-a
368 o 6 no-a
369 |
369 |
370 | o 5 d
370 | o 5 d
371 | |
371 | |
372 | o 4 c
372 | o 4 c
373 | |
373 | |
374 | o 3 b
374 | o 3 b
375 | |
375 | |
376 | o 2 1
376 | o 2 1
377 |/
377 |/
378 o 1 a
378 o 1 a
379 |
379 |
380 @ 0 base
380 @ 0 base
381
381
382 $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
382 $ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
383 rebasing 3:3a71550954f1 "b"
383 rebasing 3:3a71550954f1 "b"
384 rebasing 4:e80b69427d80 "c"
384 rebasing 4:e80b69427d80 "c"
385 abort: ^C
385 abort: ^C
386 [255]
386 [255]
387
387
388 New operations are blocked with the correct state message
388 New operations are blocked with the correct state message
389
389
390 $ find .hg -name '*state' -prune | sort
390 $ find .hg -name '*state' -prune | sort
391 .hg/dirstate
391 .hg/dirstate
392 .hg/merge/state
392 .hg/merge/state
393 .hg/rebasestate
393 .hg/rebasestate
394 .hg/undo.backup.dirstate
394 .hg/undo.backup.dirstate
395 .hg/undo.dirstate
395 .hg/undo.dirstate
396 .hg/updatestate
396 .hg/updatestate
397
397
398 $ hg rebase -s 3 -d tip
398 $ hg rebase -s 3 -d tip
399 abort: rebase in progress
399 abort: rebase in progress
400 (use 'hg rebase --continue' or 'hg rebase --abort')
400 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
401 [255]
401 [255]
402 $ hg up .
402 $ hg up .
403 abort: rebase in progress
403 abort: rebase in progress
404 (use 'hg rebase --continue' or 'hg rebase --abort')
404 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
405 [255]
405 [255]
406 $ hg up -C .
406 $ hg up -C .
407 abort: rebase in progress
407 abort: rebase in progress
408 (use 'hg rebase --continue' or 'hg rebase --abort')
408 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
409 [255]
409 [255]
410
410
411 $ hg graft 3
411 $ hg graft 3
412 abort: rebase in progress
412 abort: rebase in progress
413 (use 'hg rebase --continue' or 'hg rebase --abort')
413 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
414 [255]
414 [255]
415
415
416 $ hg abort
416 $ hg abort
417 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
417 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
418 rebase aborted
418 rebase aborted
419 $ hg log -G --template "{rev} {desc} {bookmarks}"
419 $ hg log -G --template "{rev} {desc} {bookmarks}"
420 o 6 no-a
420 o 6 no-a
421 |
421 |
422 | o 5 d
422 | o 5 d
423 | |
423 | |
424 | o 4 c
424 | o 4 c
425 | |
425 | |
426 | o 3 b
426 | o 3 b
427 | |
427 | |
428 | o 2 1
428 | o 2 1
429 |/
429 |/
430 o 1 a
430 o 1 a
431 |
431 |
432 @ 0 base
432 @ 0 base
433
433
434 $ hg summary
434 $ hg summary
435 parent: 0:df4f53cec30a
435 parent: 0:df4f53cec30a
436 base
436 base
437 branch: default
437 branch: default
438 commit: (clean)
438 commit: (clean)
439 update: 6 new changesets (update)
439 update: 6 new changesets (update)
440 phases: 7 draft
440 phases: 7 draft
441
441
442 $ cd ..
442 $ cd ..
443 On the other hand, make sure we *do* clobber changes whenever we
443 On the other hand, make sure we *do* clobber changes whenever we
444 haven't somehow managed to update the repo to a different revision
444 haven't somehow managed to update the repo to a different revision
445 during a rebase (issue4661)
445 during a rebase (issue4661)
446
446
447 $ hg ini yesupdate
447 $ hg ini yesupdate
448 $ cd yesupdate
448 $ cd yesupdate
449 $ echo "initial data" > foo.txt
449 $ echo "initial data" > foo.txt
450 $ hg add
450 $ hg add
451 adding foo.txt
451 adding foo.txt
452 $ hg ci -m "initial checkin"
452 $ hg ci -m "initial checkin"
453 $ echo "change 1" > foo.txt
453 $ echo "change 1" > foo.txt
454 $ hg ci -m "change 1"
454 $ hg ci -m "change 1"
455 $ hg up 0
455 $ hg up 0
456 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
456 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
457 $ echo "conflicting change 1" > foo.txt
457 $ echo "conflicting change 1" > foo.txt
458 $ hg ci -m "conflicting 1"
458 $ hg ci -m "conflicting 1"
459 created new head
459 created new head
460 $ echo "conflicting change 2" > foo.txt
460 $ echo "conflicting change 2" > foo.txt
461 $ hg ci -m "conflicting 2"
461 $ hg ci -m "conflicting 2"
462
462
463 $ hg rebase -d 1 --tool 'internal:fail'
463 $ hg rebase -d 1 --tool 'internal:fail'
464 rebasing 2:e4ea5cdc9789 "conflicting 1"
464 rebasing 2:e4ea5cdc9789 "conflicting 1"
465 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
465 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
466 [1]
466 [1]
467 $ hg abort
467 $ hg abort
468 rebase aborted
468 rebase aborted
469 $ hg summary
469 $ hg summary
470 parent: 3:b16646383533 tip
470 parent: 3:b16646383533 tip
471 conflicting 2
471 conflicting 2
472 branch: default
472 branch: default
473 commit: (clean)
473 commit: (clean)
474 update: 1 new changesets, 2 branch heads (merge)
474 update: 1 new changesets, 2 branch heads (merge)
475 phases: 4 draft
475 phases: 4 draft
476 $ cd ..
476 $ cd ..
477
477
478 test aborting a rebase succeeds after rebasing with skipped commits onto a
478 test aborting a rebase succeeds after rebasing with skipped commits onto a
479 public changeset (issue4896)
479 public changeset (issue4896)
480
480
481 $ hg init succeedonpublic
481 $ hg init succeedonpublic
482 $ cd succeedonpublic
482 $ cd succeedonpublic
483 $ echo 'content' > root
483 $ echo 'content' > root
484 $ hg commit -A -m 'root' -q
484 $ hg commit -A -m 'root' -q
485
485
486 set up public branch
486 set up public branch
487 $ echo 'content' > disappear
487 $ echo 'content' > disappear
488 $ hg commit -A -m 'disappear public' -q
488 $ hg commit -A -m 'disappear public' -q
489 commit will cause merge conflict on rebase
489 commit will cause merge conflict on rebase
490 $ echo '' > root
490 $ echo '' > root
491 $ hg commit -m 'remove content public' -q
491 $ hg commit -m 'remove content public' -q
492 $ hg phase --public
492 $ hg phase --public
493
493
494 setup the draft branch that will be rebased onto public commit
494 setup the draft branch that will be rebased onto public commit
495 $ hg up -r 0 -q
495 $ hg up -r 0 -q
496 $ echo 'content' > disappear
496 $ echo 'content' > disappear
497 commit will disappear
497 commit will disappear
498 $ hg commit -A -m 'disappear draft' -q
498 $ hg commit -A -m 'disappear draft' -q
499 $ echo 'addedcontADDEDentadded' > root
499 $ echo 'addedcontADDEDentadded' > root
500 commit will cause merge conflict on rebase
500 commit will cause merge conflict on rebase
501 $ hg commit -m 'add content draft' -q
501 $ hg commit -m 'add content draft' -q
502
502
503 $ hg rebase -d 'public()' --tool :merge -q
503 $ hg rebase -d 'public()' --tool :merge -q
504 note: not rebasing 3:0682fd3dabf5 "disappear draft", its destination already has all its changes
504 note: not rebasing 3:0682fd3dabf5 "disappear draft", its destination already has all its changes
505 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
505 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
506 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
506 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
507 [1]
507 [1]
508 $ hg abort
508 $ hg abort
509 rebase aborted
509 rebase aborted
510 $ cd ..
510 $ cd ..
511
511
@@ -1,965 +1,965 b''
1 #require symlink execbit
1 #require symlink execbit
2 $ cat << EOF >> $HGRCPATH
2 $ cat << EOF >> $HGRCPATH
3 > [phases]
3 > [phases]
4 > publish=False
4 > publish=False
5 > [extensions]
5 > [extensions]
6 > amend=
6 > amend=
7 > rebase=
7 > rebase=
8 > debugdrawdag=$TESTDIR/drawdag.py
8 > debugdrawdag=$TESTDIR/drawdag.py
9 > strip=
9 > strip=
10 > [rebase]
10 > [rebase]
11 > experimental.inmemory=1
11 > experimental.inmemory=1
12 > [diff]
12 > [diff]
13 > git=1
13 > git=1
14 > [alias]
14 > [alias]
15 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
15 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
16 > EOF
16 > EOF
17
17
18 Rebase a simple DAG:
18 Rebase a simple DAG:
19 $ hg init repo1
19 $ hg init repo1
20 $ cd repo1
20 $ cd repo1
21 $ hg debugdrawdag <<'EOS'
21 $ hg debugdrawdag <<'EOS'
22 > c b
22 > c b
23 > |/
23 > |/
24 > d
24 > d
25 > |
25 > |
26 > a
26 > a
27 > EOS
27 > EOS
28 $ hg up -C a
28 $ hg up -C a
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 $ hg tglog
30 $ hg tglog
31 o 3: 814f6bd05178 'c'
31 o 3: 814f6bd05178 'c'
32 |
32 |
33 | o 2: db0e82a16a62 'b'
33 | o 2: db0e82a16a62 'b'
34 |/
34 |/
35 o 1: 02952614a83d 'd'
35 o 1: 02952614a83d 'd'
36 |
36 |
37 @ 0: b173517d0057 'a'
37 @ 0: b173517d0057 'a'
38
38
39 $ hg cat -r 3 c
39 $ hg cat -r 3 c
40 c (no-eol)
40 c (no-eol)
41 $ hg cat -r 2 b
41 $ hg cat -r 2 b
42 b (no-eol)
42 b (no-eol)
43 $ hg rebase --debug -r b -d c | grep rebasing
43 $ hg rebase --debug -r b -d c | grep rebasing
44 rebasing in-memory
44 rebasing in-memory
45 rebasing 2:db0e82a16a62 "b" (b)
45 rebasing 2:db0e82a16a62 "b" (b)
46 $ hg tglog
46 $ hg tglog
47 o 3: ca58782ad1e4 'b'
47 o 3: ca58782ad1e4 'b'
48 |
48 |
49 o 2: 814f6bd05178 'c'
49 o 2: 814f6bd05178 'c'
50 |
50 |
51 o 1: 02952614a83d 'd'
51 o 1: 02952614a83d 'd'
52 |
52 |
53 @ 0: b173517d0057 'a'
53 @ 0: b173517d0057 'a'
54
54
55 $ hg cat -r 3 b
55 $ hg cat -r 3 b
56 b (no-eol)
56 b (no-eol)
57 $ hg cat -r 2 c
57 $ hg cat -r 2 c
58 c (no-eol)
58 c (no-eol)
59 $ cd ..
59 $ cd ..
60
60
61 Case 2:
61 Case 2:
62 $ hg init repo2
62 $ hg init repo2
63 $ cd repo2
63 $ cd repo2
64 $ hg debugdrawdag <<'EOS'
64 $ hg debugdrawdag <<'EOS'
65 > c b
65 > c b
66 > |/
66 > |/
67 > d
67 > d
68 > |
68 > |
69 > a
69 > a
70 > EOS
70 > EOS
71
71
72 Add a symlink and executable file:
72 Add a symlink and executable file:
73 $ hg up -C c
73 $ hg up -C c
74 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 $ ln -s somefile e
75 $ ln -s somefile e
76 $ echo f > f
76 $ echo f > f
77 $ chmod +x f
77 $ chmod +x f
78 $ hg add e f
78 $ hg add e f
79 $ hg amend -q
79 $ hg amend -q
80 $ hg up -Cq a
80 $ hg up -Cq a
81
81
82 Write files to the working copy, and ensure they're still there after the rebase
82 Write files to the working copy, and ensure they're still there after the rebase
83 $ echo "abc" > a
83 $ echo "abc" > a
84 $ ln -s def b
84 $ ln -s def b
85 $ echo "ghi" > c
85 $ echo "ghi" > c
86 $ echo "jkl" > d
86 $ echo "jkl" > d
87 $ echo "mno" > e
87 $ echo "mno" > e
88 $ hg tglog
88 $ hg tglog
89 o 3: f56b71190a8f 'c'
89 o 3: f56b71190a8f 'c'
90 |
90 |
91 | o 2: db0e82a16a62 'b'
91 | o 2: db0e82a16a62 'b'
92 |/
92 |/
93 o 1: 02952614a83d 'd'
93 o 1: 02952614a83d 'd'
94 |
94 |
95 @ 0: b173517d0057 'a'
95 @ 0: b173517d0057 'a'
96
96
97 $ hg cat -r 3 c
97 $ hg cat -r 3 c
98 c (no-eol)
98 c (no-eol)
99 $ hg cat -r 2 b
99 $ hg cat -r 2 b
100 b (no-eol)
100 b (no-eol)
101 $ hg cat -r 3 e
101 $ hg cat -r 3 e
102 somefile (no-eol)
102 somefile (no-eol)
103 $ hg rebase --debug -s b -d a | grep rebasing
103 $ hg rebase --debug -s b -d a | grep rebasing
104 rebasing in-memory
104 rebasing in-memory
105 rebasing 2:db0e82a16a62 "b" (b)
105 rebasing 2:db0e82a16a62 "b" (b)
106 $ hg tglog
106 $ hg tglog
107 o 3: fc055c3b4d33 'b'
107 o 3: fc055c3b4d33 'b'
108 |
108 |
109 | o 2: f56b71190a8f 'c'
109 | o 2: f56b71190a8f 'c'
110 | |
110 | |
111 | o 1: 02952614a83d 'd'
111 | o 1: 02952614a83d 'd'
112 |/
112 |/
113 @ 0: b173517d0057 'a'
113 @ 0: b173517d0057 'a'
114
114
115 $ hg cat -r 2 c
115 $ hg cat -r 2 c
116 c (no-eol)
116 c (no-eol)
117 $ hg cat -r 3 b
117 $ hg cat -r 3 b
118 b (no-eol)
118 b (no-eol)
119 $ hg rebase --debug -s 1 -d 3 | grep rebasing
119 $ hg rebase --debug -s 1 -d 3 | grep rebasing
120 rebasing in-memory
120 rebasing in-memory
121 rebasing 1:02952614a83d "d" (d)
121 rebasing 1:02952614a83d "d" (d)
122 rebasing 2:f56b71190a8f "c"
122 rebasing 2:f56b71190a8f "c"
123 $ hg tglog
123 $ hg tglog
124 o 3: 753feb6fd12a 'c'
124 o 3: 753feb6fd12a 'c'
125 |
125 |
126 o 2: 09c044d2cb43 'd'
126 o 2: 09c044d2cb43 'd'
127 |
127 |
128 o 1: fc055c3b4d33 'b'
128 o 1: fc055c3b4d33 'b'
129 |
129 |
130 @ 0: b173517d0057 'a'
130 @ 0: b173517d0057 'a'
131
131
132 Ensure working copy files are still there:
132 Ensure working copy files are still there:
133 $ cat a
133 $ cat a
134 abc
134 abc
135 $ readlink.py b
135 $ readlink.py b
136 b -> def
136 b -> def
137 $ cat e
137 $ cat e
138 mno
138 mno
139
139
140 Ensure symlink and executable files were rebased properly:
140 Ensure symlink and executable files were rebased properly:
141 $ hg up -Cq 3
141 $ hg up -Cq 3
142 $ readlink.py e
142 $ readlink.py e
143 e -> somefile
143 e -> somefile
144 $ ls -l f | cut -c -10
144 $ ls -l f | cut -c -10
145 -rwxr-xr-x
145 -rwxr-xr-x
146
146
147 Rebase the working copy parent
147 Rebase the working copy parent
148 $ hg up -C 3
148 $ hg up -C 3
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 $ hg rebase -r 3 -d 0 --debug | grep rebasing
150 $ hg rebase -r 3 -d 0 --debug | grep rebasing
151 rebasing in-memory
151 rebasing in-memory
152 rebasing 3:753feb6fd12a "c" (tip)
152 rebasing 3:753feb6fd12a "c" (tip)
153 $ hg tglog
153 $ hg tglog
154 @ 3: 844a7de3e617 'c'
154 @ 3: 844a7de3e617 'c'
155 |
155 |
156 | o 2: 09c044d2cb43 'd'
156 | o 2: 09c044d2cb43 'd'
157 | |
157 | |
158 | o 1: fc055c3b4d33 'b'
158 | o 1: fc055c3b4d33 'b'
159 |/
159 |/
160 o 0: b173517d0057 'a'
160 o 0: b173517d0057 'a'
161
161
162
162
163 Test reporting of path conflicts
163 Test reporting of path conflicts
164
164
165 $ hg rm a
165 $ hg rm a
166 $ mkdir a
166 $ mkdir a
167 $ touch a/a
167 $ touch a/a
168 $ hg ci -Am "a/a"
168 $ hg ci -Am "a/a"
169 adding a/a
169 adding a/a
170 $ hg tglog
170 $ hg tglog
171 @ 4: daf7dfc139cb 'a/a'
171 @ 4: daf7dfc139cb 'a/a'
172 |
172 |
173 o 3: 844a7de3e617 'c'
173 o 3: 844a7de3e617 'c'
174 |
174 |
175 | o 2: 09c044d2cb43 'd'
175 | o 2: 09c044d2cb43 'd'
176 | |
176 | |
177 | o 1: fc055c3b4d33 'b'
177 | o 1: fc055c3b4d33 'b'
178 |/
178 |/
179 o 0: b173517d0057 'a'
179 o 0: b173517d0057 'a'
180
180
181 $ hg rebase -r . -d 2
181 $ hg rebase -r . -d 2
182 rebasing 4:daf7dfc139cb "a/a" (tip)
182 rebasing 4:daf7dfc139cb "a/a" (tip)
183 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/daf7dfc139cb-fdbfcf4f-rebase.hg
183 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/daf7dfc139cb-fdbfcf4f-rebase.hg
184
184
185 $ hg tglog
185 $ hg tglog
186 @ 4: c6ad37a4f250 'a/a'
186 @ 4: c6ad37a4f250 'a/a'
187 |
187 |
188 | o 3: 844a7de3e617 'c'
188 | o 3: 844a7de3e617 'c'
189 | |
189 | |
190 o | 2: 09c044d2cb43 'd'
190 o | 2: 09c044d2cb43 'd'
191 | |
191 | |
192 o | 1: fc055c3b4d33 'b'
192 o | 1: fc055c3b4d33 'b'
193 |/
193 |/
194 o 0: b173517d0057 'a'
194 o 0: b173517d0057 'a'
195
195
196 $ echo foo > foo
196 $ echo foo > foo
197 $ hg ci -Aqm "added foo"
197 $ hg ci -Aqm "added foo"
198 $ hg up '.^'
198 $ hg up '.^'
199 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
199 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
200 $ echo bar > bar
200 $ echo bar > bar
201 $ hg ci -Aqm "added bar"
201 $ hg ci -Aqm "added bar"
202 $ hg rm a/a
202 $ hg rm a/a
203 $ echo a > a
203 $ echo a > a
204 $ hg ci -Aqm "added a back!"
204 $ hg ci -Aqm "added a back!"
205 $ hg tglog
205 $ hg tglog
206 @ 7: 855e9797387e 'added a back!'
206 @ 7: 855e9797387e 'added a back!'
207 |
207 |
208 o 6: d14530e5e3e6 'added bar'
208 o 6: d14530e5e3e6 'added bar'
209 |
209 |
210 | o 5: 9b94b9373deb 'added foo'
210 | o 5: 9b94b9373deb 'added foo'
211 |/
211 |/
212 o 4: c6ad37a4f250 'a/a'
212 o 4: c6ad37a4f250 'a/a'
213 |
213 |
214 | o 3: 844a7de3e617 'c'
214 | o 3: 844a7de3e617 'c'
215 | |
215 | |
216 o | 2: 09c044d2cb43 'd'
216 o | 2: 09c044d2cb43 'd'
217 | |
217 | |
218 o | 1: fc055c3b4d33 'b'
218 o | 1: fc055c3b4d33 'b'
219 |/
219 |/
220 o 0: b173517d0057 'a'
220 o 0: b173517d0057 'a'
221
221
222 $ hg rebase -r . -d 5
222 $ hg rebase -r . -d 5
223 rebasing 7:855e9797387e "added a back!" (tip)
223 rebasing 7:855e9797387e "added a back!" (tip)
224 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/855e9797387e-81ee4c5d-rebase.hg
224 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/855e9797387e-81ee4c5d-rebase.hg
225
225
226 $ hg tglog
226 $ hg tglog
227 @ 7: bb3f02be2688 'added a back!'
227 @ 7: bb3f02be2688 'added a back!'
228 |
228 |
229 | o 6: d14530e5e3e6 'added bar'
229 | o 6: d14530e5e3e6 'added bar'
230 | |
230 | |
231 o | 5: 9b94b9373deb 'added foo'
231 o | 5: 9b94b9373deb 'added foo'
232 |/
232 |/
233 o 4: c6ad37a4f250 'a/a'
233 o 4: c6ad37a4f250 'a/a'
234 |
234 |
235 | o 3: 844a7de3e617 'c'
235 | o 3: 844a7de3e617 'c'
236 | |
236 | |
237 o | 2: 09c044d2cb43 'd'
237 o | 2: 09c044d2cb43 'd'
238 | |
238 | |
239 o | 1: fc055c3b4d33 'b'
239 o | 1: fc055c3b4d33 'b'
240 |/
240 |/
241 o 0: b173517d0057 'a'
241 o 0: b173517d0057 'a'
242
242
243 $ mkdir -p c/subdir
243 $ mkdir -p c/subdir
244 $ echo c > c/subdir/file.txt
244 $ echo c > c/subdir/file.txt
245 $ hg add c/subdir/file.txt
245 $ hg add c/subdir/file.txt
246 $ hg ci -m 'c/subdir/file.txt'
246 $ hg ci -m 'c/subdir/file.txt'
247 $ hg rebase -r . -d 3 -n
247 $ hg rebase -r . -d 3 -n
248 starting dry-run rebase; repository will not be changed
248 starting dry-run rebase; repository will not be changed
249 rebasing 8:e147e6e3c490 "c/subdir/file.txt" (tip)
249 rebasing 8:e147e6e3c490 "c/subdir/file.txt" (tip)
250 abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3.
250 abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3.
251 [255]
251 [255]
252 FIXME: shouldn't need this, but when we hit path conflicts in dryrun mode, we
252 FIXME: shouldn't need this, but when we hit path conflicts in dryrun mode, we
253 don't clean up rebasestate.
253 don't clean up rebasestate.
254 $ hg rebase --abort
254 $ hg rebase --abort
255 rebase aborted
255 rebase aborted
256 $ hg rebase -r 3 -d . -n
256 $ hg rebase -r 3 -d . -n
257 starting dry-run rebase; repository will not be changed
257 starting dry-run rebase; repository will not be changed
258 rebasing 3:844a7de3e617 "c"
258 rebasing 3:844a7de3e617 "c"
259 abort: error: file 'c' cannot be written because 'c/' is a directory in e147e6e3c490 (containing 1 entries: c/subdir/file.txt)
259 abort: error: file 'c' cannot be written because 'c/' is a directory in e147e6e3c490 (containing 1 entries: c/subdir/file.txt)
260 [255]
260 [255]
261
261
262 $ cd ..
262 $ cd ..
263
263
264 Test path auditing (issue5818)
264 Test path auditing (issue5818)
265
265
266 $ mkdir lib_
266 $ mkdir lib_
267 $ ln -s lib_ lib
267 $ ln -s lib_ lib
268 $ hg init repo
268 $ hg init repo
269 $ cd repo
269 $ cd repo
270 $ mkdir -p ".$TESTTMP/lib"
270 $ mkdir -p ".$TESTTMP/lib"
271 $ touch ".$TESTTMP/lib/a"
271 $ touch ".$TESTTMP/lib/a"
272 $ hg add ".$TESTTMP/lib/a"
272 $ hg add ".$TESTTMP/lib/a"
273 $ hg ci -m 'a'
273 $ hg ci -m 'a'
274
274
275 $ touch ".$TESTTMP/lib/b"
275 $ touch ".$TESTTMP/lib/b"
276 $ hg add ".$TESTTMP/lib/b"
276 $ hg add ".$TESTTMP/lib/b"
277 $ hg ci -m 'b'
277 $ hg ci -m 'b'
278
278
279 $ hg up -q '.^'
279 $ hg up -q '.^'
280 $ touch ".$TESTTMP/lib/c"
280 $ touch ".$TESTTMP/lib/c"
281 $ hg add ".$TESTTMP/lib/c"
281 $ hg add ".$TESTTMP/lib/c"
282 $ hg ci -m 'c'
282 $ hg ci -m 'c'
283 created new head
283 created new head
284 $ hg rebase -s 1 -d .
284 $ hg rebase -s 1 -d .
285 rebasing 1:* "b" (glob)
285 rebasing 1:* "b" (glob)
286 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-rebase.hg (glob)
286 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-rebase.hg (glob)
287 $ cd ..
287 $ cd ..
288
288
289 Test dry-run rebasing
289 Test dry-run rebasing
290
290
291 $ hg init repo3
291 $ hg init repo3
292 $ cd repo3
292 $ cd repo3
293 $ echo a>a
293 $ echo a>a
294 $ hg ci -Aqma
294 $ hg ci -Aqma
295 $ echo b>b
295 $ echo b>b
296 $ hg ci -Aqmb
296 $ hg ci -Aqmb
297 $ echo c>c
297 $ echo c>c
298 $ hg ci -Aqmc
298 $ hg ci -Aqmc
299 $ echo d>d
299 $ echo d>d
300 $ hg ci -Aqmd
300 $ hg ci -Aqmd
301 $ echo e>e
301 $ echo e>e
302 $ hg ci -Aqme
302 $ hg ci -Aqme
303
303
304 $ hg up 1 -q
304 $ hg up 1 -q
305 $ echo f>f
305 $ echo f>f
306 $ hg ci -Amf
306 $ hg ci -Amf
307 adding f
307 adding f
308 created new head
308 created new head
309 $ echo g>g
309 $ echo g>g
310 $ hg ci -Aqmg
310 $ hg ci -Aqmg
311 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
311 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
312 @ 6:baf10c5166d4 test
312 @ 6:baf10c5166d4 test
313 | g
313 | g
314 |
314 |
315 o 5:6343ca3eff20 test
315 o 5:6343ca3eff20 test
316 | f
316 | f
317 |
317 |
318 | o 4:e860deea161a test
318 | o 4:e860deea161a test
319 | | e
319 | | e
320 | |
320 | |
321 | o 3:055a42cdd887 test
321 | o 3:055a42cdd887 test
322 | | d
322 | | d
323 | |
323 | |
324 | o 2:177f92b77385 test
324 | o 2:177f92b77385 test
325 |/ c
325 |/ c
326 |
326 |
327 o 1:d2ae7f538514 test
327 o 1:d2ae7f538514 test
328 | b
328 | b
329 |
329 |
330 o 0:cb9a9f314b8b test
330 o 0:cb9a9f314b8b test
331 a
331 a
332
332
333 Make sure it throws error while passing --continue or --abort with --dry-run
333 Make sure it throws error while passing --continue or --abort with --dry-run
334 $ hg rebase -s 2 -d 6 -n --continue
334 $ hg rebase -s 2 -d 6 -n --continue
335 abort: cannot specify both --continue and --dry-run
335 abort: cannot specify both --continue and --dry-run
336 [255]
336 [255]
337 $ hg rebase -s 2 -d 6 -n --abort
337 $ hg rebase -s 2 -d 6 -n --abort
338 abort: cannot specify both --abort and --dry-run
338 abort: cannot specify both --abort and --dry-run
339 [255]
339 [255]
340
340
341 Check dryrun gives correct results when there is no conflict in rebasing
341 Check dryrun gives correct results when there is no conflict in rebasing
342 $ hg rebase -s 2 -d 6 -n
342 $ hg rebase -s 2 -d 6 -n
343 starting dry-run rebase; repository will not be changed
343 starting dry-run rebase; repository will not be changed
344 rebasing 2:177f92b77385 "c"
344 rebasing 2:177f92b77385 "c"
345 rebasing 3:055a42cdd887 "d"
345 rebasing 3:055a42cdd887 "d"
346 rebasing 4:e860deea161a "e"
346 rebasing 4:e860deea161a "e"
347 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
347 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
348
348
349 $ hg diff
349 $ hg diff
350 $ hg status
350 $ hg status
351
351
352 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
352 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
353 @ 6:baf10c5166d4 test
353 @ 6:baf10c5166d4 test
354 | g
354 | g
355 |
355 |
356 o 5:6343ca3eff20 test
356 o 5:6343ca3eff20 test
357 | f
357 | f
358 |
358 |
359 | o 4:e860deea161a test
359 | o 4:e860deea161a test
360 | | e
360 | | e
361 | |
361 | |
362 | o 3:055a42cdd887 test
362 | o 3:055a42cdd887 test
363 | | d
363 | | d
364 | |
364 | |
365 | o 2:177f92b77385 test
365 | o 2:177f92b77385 test
366 |/ c
366 |/ c
367 |
367 |
368 o 1:d2ae7f538514 test
368 o 1:d2ae7f538514 test
369 | b
369 | b
370 |
370 |
371 o 0:cb9a9f314b8b test
371 o 0:cb9a9f314b8b test
372 a
372 a
373
373
374 Check dryrun working with --collapse when there is no conflict
374 Check dryrun working with --collapse when there is no conflict
375 $ hg rebase -s 2 -d 6 -n --collapse
375 $ hg rebase -s 2 -d 6 -n --collapse
376 starting dry-run rebase; repository will not be changed
376 starting dry-run rebase; repository will not be changed
377 rebasing 2:177f92b77385 "c"
377 rebasing 2:177f92b77385 "c"
378 rebasing 3:055a42cdd887 "d"
378 rebasing 3:055a42cdd887 "d"
379 rebasing 4:e860deea161a "e"
379 rebasing 4:e860deea161a "e"
380 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
380 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
381
381
382 Check dryrun gives correct results when there is conflict in rebasing
382 Check dryrun gives correct results when there is conflict in rebasing
383 Make a conflict:
383 Make a conflict:
384 $ hg up 6 -q
384 $ hg up 6 -q
385 $ echo conflict>e
385 $ echo conflict>e
386 $ hg ci -Aqm "conflict with e"
386 $ hg ci -Aqm "conflict with e"
387 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
387 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
388 @ 7:d2c195b28050 test
388 @ 7:d2c195b28050 test
389 | conflict with e
389 | conflict with e
390 |
390 |
391 o 6:baf10c5166d4 test
391 o 6:baf10c5166d4 test
392 | g
392 | g
393 |
393 |
394 o 5:6343ca3eff20 test
394 o 5:6343ca3eff20 test
395 | f
395 | f
396 |
396 |
397 | o 4:e860deea161a test
397 | o 4:e860deea161a test
398 | | e
398 | | e
399 | |
399 | |
400 | o 3:055a42cdd887 test
400 | o 3:055a42cdd887 test
401 | | d
401 | | d
402 | |
402 | |
403 | o 2:177f92b77385 test
403 | o 2:177f92b77385 test
404 |/ c
404 |/ c
405 |
405 |
406 o 1:d2ae7f538514 test
406 o 1:d2ae7f538514 test
407 | b
407 | b
408 |
408 |
409 o 0:cb9a9f314b8b test
409 o 0:cb9a9f314b8b test
410 a
410 a
411
411
412 $ hg rebase -s 2 -d 7 -n
412 $ hg rebase -s 2 -d 7 -n
413 starting dry-run rebase; repository will not be changed
413 starting dry-run rebase; repository will not be changed
414 rebasing 2:177f92b77385 "c"
414 rebasing 2:177f92b77385 "c"
415 rebasing 3:055a42cdd887 "d"
415 rebasing 3:055a42cdd887 "d"
416 rebasing 4:e860deea161a "e"
416 rebasing 4:e860deea161a "e"
417 merging e
417 merging e
418 transaction abort!
418 transaction abort!
419 rollback completed
419 rollback completed
420 hit a merge conflict
420 hit a merge conflict
421 [1]
421 [1]
422 $ hg diff
422 $ hg diff
423 $ hg status
423 $ hg status
424 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
424 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
425 @ 7:d2c195b28050 test
425 @ 7:d2c195b28050 test
426 | conflict with e
426 | conflict with e
427 |
427 |
428 o 6:baf10c5166d4 test
428 o 6:baf10c5166d4 test
429 | g
429 | g
430 |
430 |
431 o 5:6343ca3eff20 test
431 o 5:6343ca3eff20 test
432 | f
432 | f
433 |
433 |
434 | o 4:e860deea161a test
434 | o 4:e860deea161a test
435 | | e
435 | | e
436 | |
436 | |
437 | o 3:055a42cdd887 test
437 | o 3:055a42cdd887 test
438 | | d
438 | | d
439 | |
439 | |
440 | o 2:177f92b77385 test
440 | o 2:177f92b77385 test
441 |/ c
441 |/ c
442 |
442 |
443 o 1:d2ae7f538514 test
443 o 1:d2ae7f538514 test
444 | b
444 | b
445 |
445 |
446 o 0:cb9a9f314b8b test
446 o 0:cb9a9f314b8b test
447 a
447 a
448
448
449 Check dryrun working with --collapse when there is conflicts
449 Check dryrun working with --collapse when there is conflicts
450 $ hg rebase -s 2 -d 7 -n --collapse
450 $ hg rebase -s 2 -d 7 -n --collapse
451 starting dry-run rebase; repository will not be changed
451 starting dry-run rebase; repository will not be changed
452 rebasing 2:177f92b77385 "c"
452 rebasing 2:177f92b77385 "c"
453 rebasing 3:055a42cdd887 "d"
453 rebasing 3:055a42cdd887 "d"
454 rebasing 4:e860deea161a "e"
454 rebasing 4:e860deea161a "e"
455 merging e
455 merging e
456 hit a merge conflict
456 hit a merge conflict
457 [1]
457 [1]
458
458
459 In-memory rebase that fails due to merge conflicts
459 In-memory rebase that fails due to merge conflicts
460
460
461 $ hg rebase -s 2 -d 7
461 $ hg rebase -s 2 -d 7
462 rebasing 2:177f92b77385 "c"
462 rebasing 2:177f92b77385 "c"
463 rebasing 3:055a42cdd887 "d"
463 rebasing 3:055a42cdd887 "d"
464 rebasing 4:e860deea161a "e"
464 rebasing 4:e860deea161a "e"
465 merging e
465 merging e
466 transaction abort!
466 transaction abort!
467 rollback completed
467 rollback completed
468 hit merge conflicts; re-running rebase without in-memory merge
468 hit merge conflicts; re-running rebase without in-memory merge
469 rebasing 2:177f92b77385 "c"
469 rebasing 2:177f92b77385 "c"
470 rebasing 3:055a42cdd887 "d"
470 rebasing 3:055a42cdd887 "d"
471 rebasing 4:e860deea161a "e"
471 rebasing 4:e860deea161a "e"
472 merging e
472 merging e
473 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
473 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
474 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
474 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
475 [1]
475 [1]
476 $ hg rebase --abort
476 $ hg rebase --abort
477 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
477 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
478 rebase aborted
478 rebase aborted
479
479
480 Retrying without in-memory merge won't lose working copy changes
480 Retrying without in-memory merge won't lose working copy changes
481 $ cd ..
481 $ cd ..
482 $ hg clone repo3 repo3-dirty -q
482 $ hg clone repo3 repo3-dirty -q
483 $ cd repo3-dirty
483 $ cd repo3-dirty
484 $ echo dirty > a
484 $ echo dirty > a
485 $ hg rebase -s 2 -d 7
485 $ hg rebase -s 2 -d 7
486 rebasing 2:177f92b77385 "c"
486 rebasing 2:177f92b77385 "c"
487 rebasing 3:055a42cdd887 "d"
487 rebasing 3:055a42cdd887 "d"
488 rebasing 4:e860deea161a "e"
488 rebasing 4:e860deea161a "e"
489 merging e
489 merging e
490 transaction abort!
490 transaction abort!
491 rollback completed
491 rollback completed
492 hit merge conflicts; re-running rebase without in-memory merge
492 hit merge conflicts; re-running rebase without in-memory merge
493 abort: uncommitted changes
493 abort: uncommitted changes
494 [255]
494 [255]
495 $ cat a
495 $ cat a
496 dirty
496 dirty
497
497
498 Retrying without in-memory merge won't lose merge state
498 Retrying without in-memory merge won't lose merge state
499 $ cd ..
499 $ cd ..
500 $ hg clone repo3 repo3-merge-state -q
500 $ hg clone repo3 repo3-merge-state -q
501 $ cd repo3-merge-state
501 $ cd repo3-merge-state
502 $ hg merge 4
502 $ hg merge 4
503 merging e
503 merging e
504 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
504 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
505 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
505 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
506 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
506 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
507 [1]
507 [1]
508 $ hg resolve -l
508 $ hg resolve -l
509 U e
509 U e
510 $ hg rebase -s 2 -d 7
510 $ hg rebase -s 2 -d 7
511 abort: outstanding uncommitted merge
511 abort: outstanding uncommitted merge
512 (use 'hg commit' or 'hg merge --abort')
512 (use 'hg commit' or 'hg merge --abort')
513 [255]
513 [255]
514 $ hg resolve -l
514 $ hg resolve -l
515 U e
515 U e
516
516
517 ==========================
517 ==========================
518 Test for --confirm option|
518 Test for --confirm option|
519 ==========================
519 ==========================
520 $ cd ..
520 $ cd ..
521 $ hg clone repo3 repo4 -q
521 $ hg clone repo3 repo4 -q
522 $ cd repo4
522 $ cd repo4
523 $ hg strip 7 -q
523 $ hg strip 7 -q
524 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
524 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
525 @ 6:baf10c5166d4 test
525 @ 6:baf10c5166d4 test
526 | g
526 | g
527 |
527 |
528 o 5:6343ca3eff20 test
528 o 5:6343ca3eff20 test
529 | f
529 | f
530 |
530 |
531 | o 4:e860deea161a test
531 | o 4:e860deea161a test
532 | | e
532 | | e
533 | |
533 | |
534 | o 3:055a42cdd887 test
534 | o 3:055a42cdd887 test
535 | | d
535 | | d
536 | |
536 | |
537 | o 2:177f92b77385 test
537 | o 2:177f92b77385 test
538 |/ c
538 |/ c
539 |
539 |
540 o 1:d2ae7f538514 test
540 o 1:d2ae7f538514 test
541 | b
541 | b
542 |
542 |
543 o 0:cb9a9f314b8b test
543 o 0:cb9a9f314b8b test
544 a
544 a
545
545
546 Check it gives error when both --dryrun and --confirm is used:
546 Check it gives error when both --dryrun and --confirm is used:
547 $ hg rebase -s 2 -d . --confirm --dry-run
547 $ hg rebase -s 2 -d . --confirm --dry-run
548 abort: cannot specify both --confirm and --dry-run
548 abort: cannot specify both --confirm and --dry-run
549 [255]
549 [255]
550 $ hg rebase -s 2 -d . --confirm --abort
550 $ hg rebase -s 2 -d . --confirm --abort
551 abort: cannot specify both --abort and --confirm
551 abort: cannot specify both --abort and --confirm
552 [255]
552 [255]
553 $ hg rebase -s 2 -d . --confirm --continue
553 $ hg rebase -s 2 -d . --confirm --continue
554 abort: cannot specify both --continue and --confirm
554 abort: cannot specify both --continue and --confirm
555 [255]
555 [255]
556
556
557 Test --confirm option when there are no conflicts:
557 Test --confirm option when there are no conflicts:
558 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
558 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
559 > n
559 > n
560 > EOF
560 > EOF
561 starting in-memory rebase
561 starting in-memory rebase
562 rebasing 2:177f92b77385 "c"
562 rebasing 2:177f92b77385 "c"
563 rebasing 3:055a42cdd887 "d"
563 rebasing 3:055a42cdd887 "d"
564 rebasing 4:e860deea161a "e"
564 rebasing 4:e860deea161a "e"
565 rebase completed successfully
565 rebase completed successfully
566 apply changes (yn)? n
566 apply changes (yn)? n
567 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
567 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
568 @ 6:baf10c5166d4 test
568 @ 6:baf10c5166d4 test
569 | g
569 | g
570 |
570 |
571 o 5:6343ca3eff20 test
571 o 5:6343ca3eff20 test
572 | f
572 | f
573 |
573 |
574 | o 4:e860deea161a test
574 | o 4:e860deea161a test
575 | | e
575 | | e
576 | |
576 | |
577 | o 3:055a42cdd887 test
577 | o 3:055a42cdd887 test
578 | | d
578 | | d
579 | |
579 | |
580 | o 2:177f92b77385 test
580 | o 2:177f92b77385 test
581 |/ c
581 |/ c
582 |
582 |
583 o 1:d2ae7f538514 test
583 o 1:d2ae7f538514 test
584 | b
584 | b
585 |
585 |
586 o 0:cb9a9f314b8b test
586 o 0:cb9a9f314b8b test
587 a
587 a
588
588
589 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
589 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
590 > y
590 > y
591 > EOF
591 > EOF
592 starting in-memory rebase
592 starting in-memory rebase
593 rebasing 2:177f92b77385 "c"
593 rebasing 2:177f92b77385 "c"
594 rebasing 3:055a42cdd887 "d"
594 rebasing 3:055a42cdd887 "d"
595 rebasing 4:e860deea161a "e"
595 rebasing 4:e860deea161a "e"
596 rebase completed successfully
596 rebase completed successfully
597 apply changes (yn)? y
597 apply changes (yn)? y
598 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
598 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
599 o 9:9fd28f55f6dc test
599 o 9:9fd28f55f6dc test
600 | e
600 | e
601 |
601 |
602 o 8:12cbf031f469 test
602 o 8:12cbf031f469 test
603 | d
603 | d
604 |
604 |
605 o 7:c83b1da5b1ae test
605 o 7:c83b1da5b1ae test
606 | c
606 | c
607 |
607 |
608 @ 6:baf10c5166d4 test
608 @ 6:baf10c5166d4 test
609 | g
609 | g
610 |
610 |
611 o 5:6343ca3eff20 test
611 o 5:6343ca3eff20 test
612 | f
612 | f
613 |
613 |
614 | o 4:e860deea161a test
614 | o 4:e860deea161a test
615 | | e
615 | | e
616 | |
616 | |
617 | o 3:055a42cdd887 test
617 | o 3:055a42cdd887 test
618 | | d
618 | | d
619 | |
619 | |
620 | o 2:177f92b77385 test
620 | o 2:177f92b77385 test
621 |/ c
621 |/ c
622 |
622 |
623 o 1:d2ae7f538514 test
623 o 1:d2ae7f538514 test
624 | b
624 | b
625 |
625 |
626 o 0:cb9a9f314b8b test
626 o 0:cb9a9f314b8b test
627 a
627 a
628
628
629 Test --confirm option when there is a conflict
629 Test --confirm option when there is a conflict
630 $ hg up tip -q
630 $ hg up tip -q
631 $ echo ee>e
631 $ echo ee>e
632 $ hg ci --amend -m "conflict with e" -q
632 $ hg ci --amend -m "conflict with e" -q
633 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
633 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
634 @ 9:906d72f66a59 test
634 @ 9:906d72f66a59 test
635 | conflict with e
635 | conflict with e
636 |
636 |
637 o 8:12cbf031f469 test
637 o 8:12cbf031f469 test
638 | d
638 | d
639 |
639 |
640 o 7:c83b1da5b1ae test
640 o 7:c83b1da5b1ae test
641 | c
641 | c
642 |
642 |
643 o 6:baf10c5166d4 test
643 o 6:baf10c5166d4 test
644 | g
644 | g
645 |
645 |
646 o 5:6343ca3eff20 test
646 o 5:6343ca3eff20 test
647 | f
647 | f
648 |
648 |
649 | o 4:e860deea161a test
649 | o 4:e860deea161a test
650 | | e
650 | | e
651 | |
651 | |
652 | o 3:055a42cdd887 test
652 | o 3:055a42cdd887 test
653 | | d
653 | | d
654 | |
654 | |
655 | o 2:177f92b77385 test
655 | o 2:177f92b77385 test
656 |/ c
656 |/ c
657 |
657 |
658 o 1:d2ae7f538514 test
658 o 1:d2ae7f538514 test
659 | b
659 | b
660 |
660 |
661 o 0:cb9a9f314b8b test
661 o 0:cb9a9f314b8b test
662 a
662 a
663
663
664 $ hg rebase -s 4 -d . --keep --confirm
664 $ hg rebase -s 4 -d . --keep --confirm
665 starting in-memory rebase
665 starting in-memory rebase
666 rebasing 4:e860deea161a "e"
666 rebasing 4:e860deea161a "e"
667 merging e
667 merging e
668 hit a merge conflict
668 hit a merge conflict
669 [1]
669 [1]
670 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
670 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
671 @ 9:906d72f66a59 test
671 @ 9:906d72f66a59 test
672 | conflict with e
672 | conflict with e
673 |
673 |
674 o 8:12cbf031f469 test
674 o 8:12cbf031f469 test
675 | d
675 | d
676 |
676 |
677 o 7:c83b1da5b1ae test
677 o 7:c83b1da5b1ae test
678 | c
678 | c
679 |
679 |
680 o 6:baf10c5166d4 test
680 o 6:baf10c5166d4 test
681 | g
681 | g
682 |
682 |
683 o 5:6343ca3eff20 test
683 o 5:6343ca3eff20 test
684 | f
684 | f
685 |
685 |
686 | o 4:e860deea161a test
686 | o 4:e860deea161a test
687 | | e
687 | | e
688 | |
688 | |
689 | o 3:055a42cdd887 test
689 | o 3:055a42cdd887 test
690 | | d
690 | | d
691 | |
691 | |
692 | o 2:177f92b77385 test
692 | o 2:177f92b77385 test
693 |/ c
693 |/ c
694 |
694 |
695 o 1:d2ae7f538514 test
695 o 1:d2ae7f538514 test
696 | b
696 | b
697 |
697 |
698 o 0:cb9a9f314b8b test
698 o 0:cb9a9f314b8b test
699 a
699 a
700
700
701 Test a metadata-only in-memory merge
701 Test a metadata-only in-memory merge
702 $ cd $TESTTMP
702 $ cd $TESTTMP
703 $ hg init no_exception
703 $ hg init no_exception
704 $ cd no_exception
704 $ cd no_exception
705 # Produce the following graph:
705 # Produce the following graph:
706 # o 'add +x to foo.txt'
706 # o 'add +x to foo.txt'
707 # | o r1 (adds bar.txt, just for something to rebase to)
707 # | o r1 (adds bar.txt, just for something to rebase to)
708 # |/
708 # |/
709 # o r0 (adds foo.txt, no +x)
709 # o r0 (adds foo.txt, no +x)
710 $ echo hi > foo.txt
710 $ echo hi > foo.txt
711 $ hg ci -qAm r0
711 $ hg ci -qAm r0
712 $ echo hi > bar.txt
712 $ echo hi > bar.txt
713 $ hg ci -qAm r1
713 $ hg ci -qAm r1
714 $ hg co -qr ".^"
714 $ hg co -qr ".^"
715 $ chmod +x foo.txt
715 $ chmod +x foo.txt
716 $ hg ci -qAm 'add +x to foo.txt'
716 $ hg ci -qAm 'add +x to foo.txt'
717 issue5960: this was raising an AttributeError exception
717 issue5960: this was raising an AttributeError exception
718 $ hg rebase -r . -d 1
718 $ hg rebase -r . -d 1
719 rebasing 2:539b93e77479 "add +x to foo.txt" (tip)
719 rebasing 2:539b93e77479 "add +x to foo.txt" (tip)
720 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
720 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
721 $ hg diff -c tip
721 $ hg diff -c tip
722 diff --git a/foo.txt b/foo.txt
722 diff --git a/foo.txt b/foo.txt
723 old mode 100644
723 old mode 100644
724 new mode 100755
724 new mode 100755
725
725
726 Test rebasing a commit with copy information, but no content changes
726 Test rebasing a commit with copy information, but no content changes
727
727
728 $ cd ..
728 $ cd ..
729 $ hg clone -q repo1 merge-and-rename
729 $ hg clone -q repo1 merge-and-rename
730 $ cd merge-and-rename
730 $ cd merge-and-rename
731 $ cat << EOF >> .hg/hgrc
731 $ cat << EOF >> .hg/hgrc
732 > [experimental]
732 > [experimental]
733 > evolution.createmarkers=True
733 > evolution.createmarkers=True
734 > evolution.allowunstable=True
734 > evolution.allowunstable=True
735 > EOF
735 > EOF
736 $ hg co -q 1
736 $ hg co -q 1
737 $ hg mv d e
737 $ hg mv d e
738 $ hg ci -qm 'rename d to e'
738 $ hg ci -qm 'rename d to e'
739 $ hg co -q 3
739 $ hg co -q 3
740 $ hg merge -q 4
740 $ hg merge -q 4
741 $ hg ci -m 'merge'
741 $ hg ci -m 'merge'
742 $ hg co -q 2
742 $ hg co -q 2
743 $ mv d e
743 $ mv d e
744 $ hg addremove -qs 0
744 $ hg addremove -qs 0
745 $ hg ci -qm 'untracked rename of d to e'
745 $ hg ci -qm 'untracked rename of d to e'
746 $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .`
746 $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .`
747 1 new orphan changesets
747 1 new orphan changesets
748 $ hg tglog
748 $ hg tglog
749 @ 6: 676538af172d 'untracked rename of d to e'
749 @ 6: 676538af172d 'untracked rename of d to e'
750 |
750 |
751 | * 5: 574d92ad16fc 'merge'
751 | * 5: 574d92ad16fc 'merge'
752 | |\
752 | |\
753 | | x 4: 2c8b5dad7956 'rename d to e'
753 | | x 4: 2c8b5dad7956 'rename d to e'
754 | | |
754 | | |
755 | o | 3: ca58782ad1e4 'b'
755 | o | 3: ca58782ad1e4 'b'
756 |/ /
756 |/ /
757 o / 2: 814f6bd05178 'c'
757 o / 2: 814f6bd05178 'c'
758 |/
758 |/
759 o 1: 02952614a83d 'd'
759 o 1: 02952614a83d 'd'
760 |
760 |
761 o 0: b173517d0057 'a'
761 o 0: b173517d0057 'a'
762
762
763 $ hg rebase -b 5 -d tip
763 $ hg rebase -b 5 -d tip
764 rebasing 3:ca58782ad1e4 "b"
764 rebasing 3:ca58782ad1e4 "b"
765 rebasing 5:574d92ad16fc "merge"
765 rebasing 5:574d92ad16fc "merge"
766 note: not rebasing 5:574d92ad16fc "merge", its destination already has all its changes
766 note: not rebasing 5:574d92ad16fc "merge", its destination already has all its changes
767
767
768 $ cd ..
768 $ cd ..
769
769
770 Test rebasing a commit with copy information
770 Test rebasing a commit with copy information
771
771
772 $ hg init rebase-rename
772 $ hg init rebase-rename
773 $ cd rebase-rename
773 $ cd rebase-rename
774 $ echo a > a
774 $ echo a > a
775 $ hg ci -Aqm 'add a'
775 $ hg ci -Aqm 'add a'
776 $ echo a2 > a
776 $ echo a2 > a
777 $ hg ci -m 'modify a'
777 $ hg ci -m 'modify a'
778 $ hg co -q 0
778 $ hg co -q 0
779 $ hg mv a b
779 $ hg mv a b
780 $ hg ci -qm 'rename a to b'
780 $ hg ci -qm 'rename a to b'
781 $ hg rebase -d 1
781 $ hg rebase -d 1
782 rebasing 2:b977edf6f839 "rename a to b" (tip)
782 rebasing 2:b977edf6f839 "rename a to b" (tip)
783 merging a and b to b
783 merging a and b to b
784 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
784 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
785 $ hg st --copies --change .
785 $ hg st --copies --change .
786 A b
786 A b
787 a
787 a
788 R a
788 R a
789 $ cd ..
789 $ cd ..
790
790
791 Test rebasing a commit with copy information, where the target is empty
791 Test rebasing a commit with copy information, where the target is empty
792
792
793 $ hg init rebase-rename-empty
793 $ hg init rebase-rename-empty
794 $ cd rebase-rename-empty
794 $ cd rebase-rename-empty
795 $ echo a > a
795 $ echo a > a
796 $ hg ci -Aqm 'add a'
796 $ hg ci -Aqm 'add a'
797 $ cat > a
797 $ cat > a
798 $ hg ci -m 'make a empty'
798 $ hg ci -m 'make a empty'
799 $ hg co -q 0
799 $ hg co -q 0
800 $ hg mv a b
800 $ hg mv a b
801 $ hg ci -qm 'rename a to b'
801 $ hg ci -qm 'rename a to b'
802 $ hg rebase -d 1
802 $ hg rebase -d 1
803 rebasing 2:b977edf6f839 "rename a to b" (tip)
803 rebasing 2:b977edf6f839 "rename a to b" (tip)
804 merging a and b to b
804 merging a and b to b
805 saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
805 saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
806 $ hg st --copies --change .
806 $ hg st --copies --change .
807 A b
807 A b
808 a
808 a
809 R a
809 R a
810 $ cd ..
810 $ cd ..
811 Rebase across a copy with --collapse
811 Rebase across a copy with --collapse
812
812
813 $ hg init rebase-rename-collapse
813 $ hg init rebase-rename-collapse
814 $ cd rebase-rename-collapse
814 $ cd rebase-rename-collapse
815 $ echo a > a
815 $ echo a > a
816 $ hg ci -Aqm 'add a'
816 $ hg ci -Aqm 'add a'
817 $ hg mv a b
817 $ hg mv a b
818 $ hg ci -m 'rename a to b'
818 $ hg ci -m 'rename a to b'
819 $ hg co -q 0
819 $ hg co -q 0
820 $ echo a2 > a
820 $ echo a2 > a
821 $ hg ci -qm 'modify a'
821 $ hg ci -qm 'modify a'
822 $ hg rebase -r . -d 1 --collapse
822 $ hg rebase -r . -d 1 --collapse
823 rebasing 2:41c4ea50d4cf "modify a" (tip)
823 rebasing 2:41c4ea50d4cf "modify a" (tip)
824 merging b and a to b
824 merging b and a to b
825 saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
825 saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
826 $ cd ..
826 $ cd ..
827
827
828 Test rebasing when the file we are merging in destination is empty
828 Test rebasing when the file we are merging in destination is empty
829
829
830 $ hg init test
830 $ hg init test
831 $ cd test
831 $ cd test
832 $ echo a > foo
832 $ echo a > foo
833 $ hg ci -Aqm 'added a to foo'
833 $ hg ci -Aqm 'added a to foo'
834
834
835 $ rm foo
835 $ rm foo
836 $ touch foo
836 $ touch foo
837 $ hg di
837 $ hg di
838 diff --git a/foo b/foo
838 diff --git a/foo b/foo
839 --- a/foo
839 --- a/foo
840 +++ b/foo
840 +++ b/foo
841 @@ -1,1 +0,0 @@
841 @@ -1,1 +0,0 @@
842 -a
842 -a
843
843
844 $ hg ci -m "make foo an empty file"
844 $ hg ci -m "make foo an empty file"
845
845
846 $ hg up '.^'
846 $ hg up '.^'
847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 $ echo b > foo
848 $ echo b > foo
849 $ hg di
849 $ hg di
850 diff --git a/foo b/foo
850 diff --git a/foo b/foo
851 --- a/foo
851 --- a/foo
852 +++ b/foo
852 +++ b/foo
853 @@ -1,1 +1,1 @@
853 @@ -1,1 +1,1 @@
854 -a
854 -a
855 +b
855 +b
856 $ hg ci -m "add b to foo"
856 $ hg ci -m "add b to foo"
857 created new head
857 created new head
858
858
859 $ hg rebase -r . -d 1 --config ui.merge=internal:merge3
859 $ hg rebase -r . -d 1 --config ui.merge=internal:merge3
860 rebasing 2:fb62b706688e "add b to foo" (tip)
860 rebasing 2:fb62b706688e "add b to foo" (tip)
861 merging foo
861 merging foo
862 hit merge conflicts; re-running rebase without in-memory merge
862 hit merge conflicts; re-running rebase without in-memory merge
863 rebasing 2:fb62b706688e "add b to foo" (tip)
863 rebasing 2:fb62b706688e "add b to foo" (tip)
864 merging foo
864 merging foo
865 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
865 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
866 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
866 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
867 [1]
867 [1]
868
868
869 $ cd $TESTTMP
869 $ cd $TESTTMP
870
870
871 Test rebasing when we're in the middle of a rebase already
871 Test rebasing when we're in the middle of a rebase already
872 $ hg init test_issue6214
872 $ hg init test_issue6214
873 $ cd test_issue6214
873 $ cd test_issue6214
874 $ echo r0 > r0
874 $ echo r0 > r0
875 $ hg ci -qAm 'r0'
875 $ hg ci -qAm 'r0'
876 $ echo hi > foo
876 $ echo hi > foo
877 $ hg ci -qAm 'hi from foo'
877 $ hg ci -qAm 'hi from foo'
878 $ hg co -q '.^'
878 $ hg co -q '.^'
879 $ echo bye > foo
879 $ echo bye > foo
880 $ hg ci -qAm 'bye from foo'
880 $ hg ci -qAm 'bye from foo'
881 $ hg co -q '.^'
881 $ hg co -q '.^'
882 $ echo unrelated > some_other_file
882 $ echo unrelated > some_other_file
883 $ hg ci -qAm 'some unrelated changes'
883 $ hg ci -qAm 'some unrelated changes'
884 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
884 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
885 @ 3: some unrelated changes
885 @ 3: some unrelated changes
886 | some_other_file
886 | some_other_file
887 | o 2: bye from foo
887 | o 2: bye from foo
888 |/ foo
888 |/ foo
889 | o 1: hi from foo
889 | o 1: hi from foo
890 |/ foo
890 |/ foo
891 o 0: r0
891 o 0: r0
892 r0
892 r0
893 $ hg rebase -r 2 -d 1 -t:merge3
893 $ hg rebase -r 2 -d 1 -t:merge3
894 rebasing 2:b4d249fbf8dd "bye from foo"
894 rebasing 2:b4d249fbf8dd "bye from foo"
895 merging foo
895 merging foo
896 hit merge conflicts; re-running rebase without in-memory merge
896 hit merge conflicts; re-running rebase without in-memory merge
897 rebasing 2:b4d249fbf8dd "bye from foo"
897 rebasing 2:b4d249fbf8dd "bye from foo"
898 merging foo
898 merging foo
899 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
899 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
900 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
900 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
901 [1]
901 [1]
902 $ hg rebase -r 3 -d 1 -t:merge3
902 $ hg rebase -r 3 -d 1 -t:merge3
903 abort: rebase in progress
903 abort: rebase in progress
904 (use 'hg rebase --continue' or 'hg rebase --abort')
904 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
905 [255]
905 [255]
906 $ hg resolve --list
906 $ hg resolve --list
907 U foo
907 U foo
908 $ hg resolve --all --re-merge -t:other
908 $ hg resolve --all --re-merge -t:other
909 (no more unresolved files)
909 (no more unresolved files)
910 continue: hg rebase --continue
910 continue: hg rebase --continue
911 $ hg rebase --continue
911 $ hg rebase --continue
912 rebasing 2:b4d249fbf8dd "bye from foo"
912 rebasing 2:b4d249fbf8dd "bye from foo"
913 saved backup bundle to $TESTTMP/test_issue6214/.hg/strip-backup/b4d249fbf8dd-299ec25c-rebase.hg
913 saved backup bundle to $TESTTMP/test_issue6214/.hg/strip-backup/b4d249fbf8dd-299ec25c-rebase.hg
914 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
914 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
915 o 3: bye from foo
915 o 3: bye from foo
916 | foo
916 | foo
917 | @ 2: some unrelated changes
917 | @ 2: some unrelated changes
918 | | some_other_file
918 | | some_other_file
919 o | 1: hi from foo
919 o | 1: hi from foo
920 |/ foo
920 |/ foo
921 o 0: r0
921 o 0: r0
922 r0
922 r0
923
923
924 $ cd ..
924 $ cd ..
925
925
926 Changesets that become empty should not be committed. Merges are not empty by
926 Changesets that become empty should not be committed. Merges are not empty by
927 definition.
927 definition.
928
928
929 $ hg init keep_merge
929 $ hg init keep_merge
930 $ cd keep_merge
930 $ cd keep_merge
931 $ echo base > base; hg add base; hg ci -m base
931 $ echo base > base; hg add base; hg ci -m base
932 $ echo test > test; hg add test; hg ci -m a
932 $ echo test > test; hg add test; hg ci -m a
933 $ hg up 0 -q
933 $ hg up 0 -q
934 $ echo test > test; hg add test; hg ci -m b -q
934 $ echo test > test; hg add test; hg ci -m b -q
935 $ hg up 0 -q
935 $ hg up 0 -q
936 $ echo test > test; hg add test; hg ci -m c -q
936 $ echo test > test; hg add test; hg ci -m c -q
937 $ hg up 1 -q
937 $ hg up 1 -q
938 $ hg merge 2 -q
938 $ hg merge 2 -q
939 $ hg ci -m merge
939 $ hg ci -m merge
940 $ hg up null -q
940 $ hg up null -q
941 $ hg tglog
941 $ hg tglog
942 o 4: 59c8292117b1 'merge'
942 o 4: 59c8292117b1 'merge'
943 |\
943 |\
944 | | o 3: 531f80391e4a 'c'
944 | | o 3: 531f80391e4a 'c'
945 | | |
945 | | |
946 | o | 2: 0194f1db184a 'b'
946 | o | 2: 0194f1db184a 'b'
947 | |/
947 | |/
948 o / 1: 6f252845ea45 'a'
948 o / 1: 6f252845ea45 'a'
949 |/
949 |/
950 o 0: d20a80d4def3 'base'
950 o 0: d20a80d4def3 'base'
951
951
952 $ hg rebase -s 2 -d 3
952 $ hg rebase -s 2 -d 3
953 rebasing 2:0194f1db184a "b"
953 rebasing 2:0194f1db184a "b"
954 note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
954 note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
955 rebasing 4:59c8292117b1 "merge" (tip)
955 rebasing 4:59c8292117b1 "merge" (tip)
956 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
956 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
957 $ hg tglog
957 $ hg tglog
958 o 3: 506e2454484b 'merge'
958 o 3: 506e2454484b 'merge'
959 |\
959 |\
960 | o 2: 531f80391e4a 'c'
960 | o 2: 531f80391e4a 'c'
961 | |
961 | |
962 o | 1: 6f252845ea45 'a'
962 o | 1: 6f252845ea45 'a'
963 |/
963 |/
964 o 0: d20a80d4def3 'base'
964 o 0: d20a80d4def3 'base'
965
965
@@ -1,2138 +1,2138 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: not rebasing 1:42ccdea3bb16 "B", its destination already has all its changes
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: not rebasing 3:32af7686d403 "D", its destination already has all its changes
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: cannot specify both --auto-orphans and --dest
490 abort: cannot specify both --auto-orphans and --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 1 new obsolescence markers
654 1 new obsolescence markers
655 obsoleted 1 changesets
655 obsoleted 1 changesets
656
656
657 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
657 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
658 rebasing 9:4bde274eefcf "I"
658 rebasing 9:4bde274eefcf "I"
659 rebasing 13:06edfc82198f "J" (tip)
659 rebasing 13:06edfc82198f "J" (tip)
660 2 new content-divergent changesets
660 2 new content-divergent changesets
661 $ hg log -G
661 $ hg log -G
662 @ 15:5ae8a643467b J
662 @ 15:5ae8a643467b J
663 |
663 |
664 * 14:9ad579b4a5de I
664 * 14:9ad579b4a5de I
665 |
665 |
666 | * 12:acd174b7ab39 I
666 | * 12:acd174b7ab39 I
667 | |
667 | |
668 | o 11:6c11a6218c97 H
668 | o 11:6c11a6218c97 H
669 | |
669 | |
670 o | 10:b5313c85b22e D
670 o | 10:b5313c85b22e D
671 |/
671 |/
672 | * 8:53a6a128b2b7 M
672 | * 8:53a6a128b2b7 M
673 | |\
673 | |\
674 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
674 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
675 | | |
675 | | |
676 o---+ 6:eea13746799a G
676 o---+ 6:eea13746799a G
677 | | |
677 | | |
678 | | o 5:24b6387c8c8c F
678 | | o 5:24b6387c8c8c F
679 | | |
679 | | |
680 o---+ 4:9520eea781bc E
680 o---+ 4:9520eea781bc E
681 / /
681 / /
682 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
682 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
683 | |
683 | |
684 o | 2:5fddd98957c8 C
684 o | 2:5fddd98957c8 C
685 | |
685 | |
686 o | 1:42ccdea3bb16 B
686 o | 1:42ccdea3bb16 B
687 |/
687 |/
688 o 0:cd010b8cd998 A
688 o 0:cd010b8cd998 A
689
689
690 $ hg up 14 -C
690 $ hg up 14 -C
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
692 $ echo "K" > K
692 $ echo "K" > K
693 $ hg add K
693 $ hg add K
694 $ hg commit --amend -m "K"
694 $ hg commit --amend -m "K"
695 1 new orphan changesets
695 1 new orphan changesets
696 $ echo "L" > L
696 $ echo "L" > L
697 $ hg add L
697 $ hg add L
698 $ hg commit -m "L"
698 $ hg commit -m "L"
699 $ hg up '.^'
699 $ hg up '.^'
700 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
700 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
701 $ echo "M" > M
701 $ echo "M" > M
702 $ hg add M
702 $ hg add M
703 $ hg commit --amend -m "M"
703 $ hg commit --amend -m "M"
704 1 new orphan changesets
704 1 new orphan changesets
705 $ hg log -G
705 $ hg log -G
706 @ 18:bfaedf8eb73b M
706 @ 18:bfaedf8eb73b M
707 |
707 |
708 | * 17:97219452e4bd L
708 | * 17:97219452e4bd L
709 | |
709 | |
710 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
710 | x 16:fc37a630c901 K (rewritten using amend as 18:bfaedf8eb73b)
711 |/
711 |/
712 | * 15:5ae8a643467b J
712 | * 15:5ae8a643467b J
713 | |
713 | |
714 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
714 | x 14:9ad579b4a5de I (rewritten using amend as 16:fc37a630c901)
715 |/
715 |/
716 | * 12:acd174b7ab39 I
716 | * 12:acd174b7ab39 I
717 | |
717 | |
718 | o 11:6c11a6218c97 H
718 | o 11:6c11a6218c97 H
719 | |
719 | |
720 o | 10:b5313c85b22e D
720 o | 10:b5313c85b22e D
721 |/
721 |/
722 | * 8:53a6a128b2b7 M
722 | * 8:53a6a128b2b7 M
723 | |\
723 | |\
724 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
724 | | x 7:02de42196ebe H (rewritten using rebase as 11:6c11a6218c97)
725 | | |
725 | | |
726 o---+ 6:eea13746799a G
726 o---+ 6:eea13746799a G
727 | | |
727 | | |
728 | | o 5:24b6387c8c8c F
728 | | o 5:24b6387c8c8c F
729 | | |
729 | | |
730 o---+ 4:9520eea781bc E
730 o---+ 4:9520eea781bc E
731 / /
731 / /
732 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
732 x | 3:32af7686d403 D (rewritten using rebase as 10:b5313c85b22e)
733 | |
733 | |
734 o | 2:5fddd98957c8 C
734 o | 2:5fddd98957c8 C
735 | |
735 | |
736 o | 1:42ccdea3bb16 B
736 o | 1:42ccdea3bb16 B
737 |/
737 |/
738 o 0:cd010b8cd998 A
738 o 0:cd010b8cd998 A
739
739
740 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
740 $ hg rebase -s 14 -d 17 --config experimental.rebaseskipobsolete=True
741 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
741 note: not rebasing 14:9ad579b4a5de "I", already in destination as 16:fc37a630c901 "K"
742 rebasing 15:5ae8a643467b "J"
742 rebasing 15:5ae8a643467b "J"
743 1 new orphan changesets
743 1 new orphan changesets
744
744
745 $ cd ..
745 $ cd ..
746
746
747 Skip obsolete changeset even with multiple hops
747 Skip obsolete changeset even with multiple hops
748 -----------------------------------------------
748 -----------------------------------------------
749
749
750 setup
750 setup
751
751
752 $ hg init obsskip
752 $ hg init obsskip
753 $ cd obsskip
753 $ cd obsskip
754 $ cat << EOF >> .hg/hgrc
754 $ cat << EOF >> .hg/hgrc
755 > [experimental]
755 > [experimental]
756 > rebaseskipobsolete = True
756 > rebaseskipobsolete = True
757 > [extensions]
757 > [extensions]
758 > strip =
758 > strip =
759 > EOF
759 > EOF
760 $ echo A > A
760 $ echo A > A
761 $ hg add A
761 $ hg add A
762 $ hg commit -m A
762 $ hg commit -m A
763 $ echo B > B
763 $ echo B > B
764 $ hg add B
764 $ hg add B
765 $ hg commit -m B0
765 $ hg commit -m B0
766 $ hg commit --amend -m B1
766 $ hg commit --amend -m B1
767 $ hg commit --amend -m B2
767 $ hg commit --amend -m B2
768 $ hg up --hidden 'desc(B0)'
768 $ hg up --hidden 'desc(B0)'
769 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
770 updated to hidden changeset a8b11f55fb19
770 updated to hidden changeset a8b11f55fb19
771 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
771 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
772 $ echo C > C
772 $ echo C > C
773 $ hg add C
773 $ hg add C
774 $ hg commit -m C
774 $ hg commit -m C
775 1 new orphan changesets
775 1 new orphan changesets
776 $ hg log -G
776 $ hg log -G
777 @ 4:212cb178bcbb C
777 @ 4:212cb178bcbb C
778 |
778 |
779 | o 3:261e70097290 B2
779 | o 3:261e70097290 B2
780 | |
780 | |
781 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
781 x | 1:a8b11f55fb19 B0 (rewritten using amend as 3:261e70097290)
782 |/
782 |/
783 o 0:4a2df7238c3b A
783 o 0:4a2df7238c3b A
784
784
785
785
786 Rebase finds its way in a chain of marker
786 Rebase finds its way in a chain of marker
787
787
788 $ hg rebase -d 'desc(B2)'
788 $ hg rebase -d 'desc(B2)'
789 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
789 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
790 rebasing 4:212cb178bcbb "C" (tip)
790 rebasing 4:212cb178bcbb "C" (tip)
791
791
792 Even when the chain include missing node
792 Even when the chain include missing node
793
793
794 $ hg up --hidden 'desc(B0)'
794 $ hg up --hidden 'desc(B0)'
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
795 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
796 updated to hidden changeset a8b11f55fb19
796 updated to hidden changeset a8b11f55fb19
797 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
797 (hidden revision 'a8b11f55fb19' was rewritten as: 261e70097290)
798 $ echo D > D
798 $ echo D > D
799 $ hg add D
799 $ hg add D
800 $ hg commit -m D
800 $ hg commit -m D
801 1 new orphan changesets
801 1 new orphan changesets
802 $ hg --hidden strip -r 'desc(B1)'
802 $ hg --hidden strip -r 'desc(B1)'
803 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
803 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg
804 1 new orphan changesets
804 1 new orphan changesets
805 $ hg log -G
805 $ hg log -G
806 @ 5:1a79b7535141 D
806 @ 5:1a79b7535141 D
807 |
807 |
808 | o 4:ff2c4d47b71d C
808 | o 4:ff2c4d47b71d C
809 | |
809 | |
810 | o 2:261e70097290 B2
810 | o 2:261e70097290 B2
811 | |
811 | |
812 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
812 x | 1:a8b11f55fb19 B0 (rewritten using amend as 2:261e70097290)
813 |/
813 |/
814 o 0:4a2df7238c3b A
814 o 0:4a2df7238c3b A
815
815
816
816
817 $ hg rebase -d 'desc(B2)'
817 $ hg rebase -d 'desc(B2)'
818 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
818 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
819 rebasing 5:1a79b7535141 "D" (tip)
819 rebasing 5:1a79b7535141 "D" (tip)
820 $ hg up 4
820 $ hg up 4
821 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 $ echo "O" > O
822 $ echo "O" > O
823 $ hg add O
823 $ hg add O
824 $ hg commit -m O
824 $ hg commit -m O
825 $ echo "P" > P
825 $ echo "P" > P
826 $ hg add P
826 $ hg add P
827 $ hg commit -m P
827 $ hg commit -m P
828 $ hg log -G
828 $ hg log -G
829 @ 8:8d47583e023f P
829 @ 8:8d47583e023f P
830 |
830 |
831 o 7:360bbaa7d3ce O
831 o 7:360bbaa7d3ce O
832 |
832 |
833 | o 6:9c48361117de D
833 | o 6:9c48361117de D
834 | |
834 | |
835 o | 4:ff2c4d47b71d C
835 o | 4:ff2c4d47b71d C
836 |/
836 |/
837 o 2:261e70097290 B2
837 o 2:261e70097290 B2
838 |
838 |
839 o 0:4a2df7238c3b A
839 o 0:4a2df7238c3b A
840
840
841 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
841 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=true
842 1 new obsolescence markers
842 1 new obsolescence markers
843 obsoleted 1 changesets
843 obsoleted 1 changesets
844 1 new orphan changesets
844 1 new orphan changesets
845 $ hg rebase -d 6 -r "4::"
845 $ hg rebase -d 6 -r "4::"
846 rebasing 4:ff2c4d47b71d "C"
846 rebasing 4:ff2c4d47b71d "C"
847 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
847 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
848 rebasing 8:8d47583e023f "P" (tip)
848 rebasing 8:8d47583e023f "P" (tip)
849
849
850 If all the changeset to be rebased are obsolete and present in the destination, we
850 If all the changeset to be rebased are obsolete and present in the destination, we
851 should display a friendly error message
851 should display a friendly error message
852
852
853 $ hg log -G
853 $ hg log -G
854 @ 10:121d9e3bc4c6 P
854 @ 10:121d9e3bc4c6 P
855 |
855 |
856 o 9:4be60e099a77 C
856 o 9:4be60e099a77 C
857 |
857 |
858 o 6:9c48361117de D
858 o 6:9c48361117de D
859 |
859 |
860 o 2:261e70097290 B2
860 o 2:261e70097290 B2
861 |
861 |
862 o 0:4a2df7238c3b A
862 o 0:4a2df7238c3b A
863
863
864
864
865 $ hg up 9
865 $ hg up 9
866 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
866 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
867 $ echo "non-relevant change" > nonrelevant
867 $ echo "non-relevant change" > nonrelevant
868 $ hg add nonrelevant
868 $ hg add nonrelevant
869 $ hg commit -m nonrelevant
869 $ hg commit -m nonrelevant
870 created new head
870 created new head
871 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
871 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=true
872 1 new obsolescence markers
872 1 new obsolescence markers
873 obsoleted 1 changesets
873 obsoleted 1 changesets
874 $ hg log -G
874 $ hg log -G
875 @ 11:f44da1f4954c nonrelevant (pruned)
875 @ 11:f44da1f4954c nonrelevant (pruned)
876 |
876 |
877 | o 10:121d9e3bc4c6 P
877 | o 10:121d9e3bc4c6 P
878 |/
878 |/
879 o 9:4be60e099a77 C
879 o 9:4be60e099a77 C
880 |
880 |
881 o 6:9c48361117de D
881 o 6:9c48361117de D
882 |
882 |
883 o 2:261e70097290 B2
883 o 2:261e70097290 B2
884 |
884 |
885 o 0:4a2df7238c3b A
885 o 0:4a2df7238c3b A
886
886
887 $ hg rebase -r . -d 10
887 $ hg rebase -r . -d 10
888 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
888 note: not rebasing 11:f44da1f4954c "nonrelevant" (tip), it has no successor
889
889
890 If a rebase is going to create divergence, it should abort
890 If a rebase is going to create divergence, it should abort
891
891
892 $ hg log -G
892 $ hg log -G
893 @ 10:121d9e3bc4c6 P
893 @ 10:121d9e3bc4c6 P
894 |
894 |
895 o 9:4be60e099a77 C
895 o 9:4be60e099a77 C
896 |
896 |
897 o 6:9c48361117de D
897 o 6:9c48361117de D
898 |
898 |
899 o 2:261e70097290 B2
899 o 2:261e70097290 B2
900 |
900 |
901 o 0:4a2df7238c3b A
901 o 0:4a2df7238c3b A
902
902
903
903
904 $ hg up 9
904 $ hg up 9
905 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
905 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
906 $ echo "john" > doe
906 $ echo "john" > doe
907 $ hg add doe
907 $ hg add doe
908 $ hg commit -m "john doe"
908 $ hg commit -m "john doe"
909 created new head
909 created new head
910 $ hg up 10
910 $ hg up 10
911 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
911 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
912 $ echo "foo" > bar
912 $ echo "foo" > bar
913 $ hg add bar
913 $ hg add bar
914 $ hg commit --amend -m "10'"
914 $ hg commit --amend -m "10'"
915 $ hg up 10 --hidden
915 $ hg up 10 --hidden
916 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
916 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
917 updated to hidden changeset 121d9e3bc4c6
917 updated to hidden changeset 121d9e3bc4c6
918 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
918 (hidden revision '121d9e3bc4c6' was rewritten as: 77d874d096a2)
919 $ echo "bar" > foo
919 $ echo "bar" > foo
920 $ hg add foo
920 $ hg add foo
921 $ hg commit -m "bar foo"
921 $ hg commit -m "bar foo"
922 1 new orphan changesets
922 1 new orphan changesets
923 $ hg log -G
923 $ hg log -G
924 @ 14:73568ab6879d bar foo
924 @ 14:73568ab6879d bar foo
925 |
925 |
926 | o 13:77d874d096a2 10'
926 | o 13:77d874d096a2 10'
927 | |
927 | |
928 | | o 12:3eb461388009 john doe
928 | | o 12:3eb461388009 john doe
929 | |/
929 | |/
930 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
930 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
931 |/
931 |/
932 o 9:4be60e099a77 C
932 o 9:4be60e099a77 C
933 |
933 |
934 o 6:9c48361117de D
934 o 6:9c48361117de D
935 |
935 |
936 o 2:261e70097290 B2
936 o 2:261e70097290 B2
937 |
937 |
938 o 0:4a2df7238c3b A
938 o 0:4a2df7238c3b A
939
939
940 $ hg summary
940 $ hg summary
941 parent: 14:73568ab6879d tip (orphan)
941 parent: 14:73568ab6879d tip (orphan)
942 bar foo
942 bar foo
943 branch: default
943 branch: default
944 commit: (clean)
944 commit: (clean)
945 update: 2 new changesets, 3 branch heads (merge)
945 update: 2 new changesets, 3 branch heads (merge)
946 phases: 8 draft
946 phases: 8 draft
947 orphan: 1 changesets
947 orphan: 1 changesets
948 $ hg rebase -s 10 -d 12
948 $ hg rebase -s 10 -d 12
949 abort: this rebase will cause divergences from: 121d9e3bc4c6
949 abort: this rebase will cause divergences from: 121d9e3bc4c6
950 (to force the rebase please set experimental.evolution.allowdivergence=True)
950 (to force the rebase please set experimental.evolution.allowdivergence=True)
951 [255]
951 [255]
952 $ hg log -G
952 $ hg log -G
953 @ 14:73568ab6879d bar foo
953 @ 14:73568ab6879d bar foo
954 |
954 |
955 | o 13:77d874d096a2 10'
955 | o 13:77d874d096a2 10'
956 | |
956 | |
957 | | o 12:3eb461388009 john doe
957 | | o 12:3eb461388009 john doe
958 | |/
958 | |/
959 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
959 x | 10:121d9e3bc4c6 P (rewritten using amend as 13:77d874d096a2)
960 |/
960 |/
961 o 9:4be60e099a77 C
961 o 9:4be60e099a77 C
962 |
962 |
963 o 6:9c48361117de D
963 o 6:9c48361117de D
964 |
964 |
965 o 2:261e70097290 B2
965 o 2:261e70097290 B2
966 |
966 |
967 o 0:4a2df7238c3b A
967 o 0:4a2df7238c3b A
968
968
969 With experimental.evolution.allowdivergence=True, rebase can create divergence
969 With experimental.evolution.allowdivergence=True, rebase can create divergence
970
970
971 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
971 $ hg rebase -s 10 -d 12 --config experimental.evolution.allowdivergence=True
972 rebasing 10:121d9e3bc4c6 "P"
972 rebasing 10:121d9e3bc4c6 "P"
973 rebasing 14:73568ab6879d "bar foo" (tip)
973 rebasing 14:73568ab6879d "bar foo" (tip)
974 2 new content-divergent changesets
974 2 new content-divergent changesets
975 $ hg summary
975 $ hg summary
976 parent: 16:61bd55f69bc4 tip
976 parent: 16:61bd55f69bc4 tip
977 bar foo
977 bar foo
978 branch: default
978 branch: default
979 commit: (clean)
979 commit: (clean)
980 update: 1 new changesets, 2 branch heads (merge)
980 update: 1 new changesets, 2 branch heads (merge)
981 phases: 8 draft
981 phases: 8 draft
982 content-divergent: 2 changesets
982 content-divergent: 2 changesets
983
983
984 rebase --continue + skipped rev because their successors are in destination
984 rebase --continue + skipped rev because their successors are in destination
985 we make a change in trunk and work on conflicting changes to make rebase abort.
985 we make a change in trunk and work on conflicting changes to make rebase abort.
986
986
987 $ hg log -G -r 16::
987 $ hg log -G -r 16::
988 @ 16:61bd55f69bc4 bar foo
988 @ 16:61bd55f69bc4 bar foo
989 |
989 |
990 ~
990 ~
991
991
992 Create the two changes in trunk
992 Create the two changes in trunk
993 $ printf "a" > willconflict
993 $ printf "a" > willconflict
994 $ hg add willconflict
994 $ hg add willconflict
995 $ hg commit -m "willconflict first version"
995 $ hg commit -m "willconflict first version"
996
996
997 $ printf "dummy" > C
997 $ printf "dummy" > C
998 $ hg commit -m "dummy change successor"
998 $ hg commit -m "dummy change successor"
999
999
1000 Create the changes that we will rebase
1000 Create the changes that we will rebase
1001 $ hg update -C 16 -q
1001 $ hg update -C 16 -q
1002 $ printf "b" > willconflict
1002 $ printf "b" > willconflict
1003 $ hg add willconflict
1003 $ hg add willconflict
1004 $ hg commit -m "willconflict second version"
1004 $ hg commit -m "willconflict second version"
1005 created new head
1005 created new head
1006 $ printf "dummy" > K
1006 $ printf "dummy" > K
1007 $ hg add K
1007 $ hg add K
1008 $ hg commit -m "dummy change"
1008 $ hg commit -m "dummy change"
1009 $ printf "dummy" > L
1009 $ printf "dummy" > L
1010 $ hg add L
1010 $ hg add L
1011 $ hg commit -m "dummy change"
1011 $ hg commit -m "dummy change"
1012 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1012 $ hg debugobsolete `hg log -r ".^" -T '{node}'` `hg log -r 18 -T '{node}'` --config experimental.evolution=true
1013 1 new obsolescence markers
1013 1 new obsolescence markers
1014 obsoleted 1 changesets
1014 obsoleted 1 changesets
1015 1 new orphan changesets
1015 1 new orphan changesets
1016
1016
1017 $ hg log -G -r 16::
1017 $ hg log -G -r 16::
1018 @ 21:7bdc8a87673d dummy change
1018 @ 21:7bdc8a87673d dummy change
1019 |
1019 |
1020 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1020 x 20:8b31da3c4919 dummy change (rewritten as 18:601db7a18f51)
1021 |
1021 |
1022 o 19:b82fb57ea638 willconflict second version
1022 o 19:b82fb57ea638 willconflict second version
1023 |
1023 |
1024 | o 18:601db7a18f51 dummy change successor
1024 | o 18:601db7a18f51 dummy change successor
1025 | |
1025 | |
1026 | o 17:357ddf1602d5 willconflict first version
1026 | o 17:357ddf1602d5 willconflict first version
1027 |/
1027 |/
1028 o 16:61bd55f69bc4 bar foo
1028 o 16:61bd55f69bc4 bar foo
1029 |
1029 |
1030 ~
1030 ~
1031 $ hg rebase -r ".^^ + .^ + ." -d 18
1031 $ hg rebase -r ".^^ + .^ + ." -d 18
1032 rebasing 19:b82fb57ea638 "willconflict second version"
1032 rebasing 19:b82fb57ea638 "willconflict second version"
1033 merging willconflict
1033 merging willconflict
1034 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1034 warning: conflicts while merging willconflict! (edit, then use 'hg resolve --mark')
1035 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1035 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1036 [1]
1036 [1]
1037
1037
1038 $ hg resolve --mark willconflict
1038 $ hg resolve --mark willconflict
1039 (no more unresolved files)
1039 (no more unresolved files)
1040 continue: hg rebase --continue
1040 continue: hg rebase --continue
1041 $ hg rebase --continue
1041 $ hg rebase --continue
1042 rebasing 19:b82fb57ea638 "willconflict second version"
1042 rebasing 19:b82fb57ea638 "willconflict second version"
1043 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1043 note: not rebasing 20:8b31da3c4919 "dummy change", already in destination as 18:601db7a18f51 "dummy change successor"
1044 rebasing 21:7bdc8a87673d "dummy change" (tip)
1044 rebasing 21:7bdc8a87673d "dummy change" (tip)
1045 $ cd ..
1045 $ cd ..
1046
1046
1047 Divergence cases due to obsolete changesets
1047 Divergence cases due to obsolete changesets
1048 -------------------------------------------
1048 -------------------------------------------
1049
1049
1050 We should ignore branches with unstable changesets when they are based on an
1050 We should ignore branches with unstable changesets when they are based on an
1051 obsolete changeset which successor is in rebase set.
1051 obsolete changeset which successor is in rebase set.
1052
1052
1053 $ hg init divergence
1053 $ hg init divergence
1054 $ cd divergence
1054 $ cd divergence
1055 $ cat >> .hg/hgrc << EOF
1055 $ cat >> .hg/hgrc << EOF
1056 > [extensions]
1056 > [extensions]
1057 > strip =
1057 > strip =
1058 > [alias]
1058 > [alias]
1059 > strip = strip --no-backup --quiet
1059 > strip = strip --no-backup --quiet
1060 > [templates]
1060 > [templates]
1061 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1061 > instabilities = '{rev}:{node|short} {desc|firstline}{if(instabilities," ({instabilities})")}\n'
1062 > EOF
1062 > EOF
1063
1063
1064 $ hg debugdrawdag <<EOF
1064 $ hg debugdrawdag <<EOF
1065 > e f
1065 > e f
1066 > | |
1066 > | |
1067 > d' d # replace: d -> d'
1067 > d' d # replace: d -> d'
1068 > \ /
1068 > \ /
1069 > c
1069 > c
1070 > |
1070 > |
1071 > x b
1071 > x b
1072 > \|
1072 > \|
1073 > a
1073 > a
1074 > EOF
1074 > EOF
1075 1 new orphan changesets
1075 1 new orphan changesets
1076 $ hg log -G -r 'a'::
1076 $ hg log -G -r 'a'::
1077 * 7:1143e9adc121 f
1077 * 7:1143e9adc121 f
1078 |
1078 |
1079 | o 6:d60ebfa0f1cb e
1079 | o 6:d60ebfa0f1cb e
1080 | |
1080 | |
1081 | o 5:027ad6c5830d d'
1081 | o 5:027ad6c5830d d'
1082 | |
1082 | |
1083 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1083 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1084 |/
1084 |/
1085 o 3:a82ac2b38757 c
1085 o 3:a82ac2b38757 c
1086 |
1086 |
1087 | o 2:630d7c95eff7 x
1087 | o 2:630d7c95eff7 x
1088 | |
1088 | |
1089 o | 1:488e1b7e7341 b
1089 o | 1:488e1b7e7341 b
1090 |/
1090 |/
1091 o 0:b173517d0057 a
1091 o 0:b173517d0057 a
1092
1092
1093
1093
1094 Changeset d and its descendants are excluded to avoid divergence of d, which
1094 Changeset d and its descendants are excluded to avoid divergence of d, which
1095 would occur because the successor of d (d') is also in rebaseset. As a
1095 would occur because the successor of d (d') is also in rebaseset. As a
1096 consequence f (descendant of d) is left behind.
1096 consequence f (descendant of d) is left behind.
1097
1097
1098 $ hg rebase -b 'e' -d 'x'
1098 $ hg rebase -b 'e' -d 'x'
1099 rebasing 1:488e1b7e7341 "b" (b)
1099 rebasing 1:488e1b7e7341 "b" (b)
1100 rebasing 3:a82ac2b38757 "c" (c)
1100 rebasing 3:a82ac2b38757 "c" (c)
1101 rebasing 5:027ad6c5830d "d'" (d')
1101 rebasing 5:027ad6c5830d "d'" (d')
1102 rebasing 6:d60ebfa0f1cb "e" (e)
1102 rebasing 6:d60ebfa0f1cb "e" (e)
1103 note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
1103 note: not rebasing 4:76be324c128b "d" (d) and its descendants as this would cause divergence
1104 $ hg log -G -r 'a'::
1104 $ hg log -G -r 'a'::
1105 o 11:eb6d63fc4ed5 e
1105 o 11:eb6d63fc4ed5 e
1106 |
1106 |
1107 o 10:44d8c724a70c d'
1107 o 10:44d8c724a70c d'
1108 |
1108 |
1109 o 9:d008e6b4d3fd c
1109 o 9:d008e6b4d3fd c
1110 |
1110 |
1111 o 8:67e8f4a16c49 b
1111 o 8:67e8f4a16c49 b
1112 |
1112 |
1113 | * 7:1143e9adc121 f
1113 | * 7:1143e9adc121 f
1114 | |
1114 | |
1115 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1115 | | x 6:d60ebfa0f1cb e (rewritten using rebase as 11:eb6d63fc4ed5)
1116 | | |
1116 | | |
1117 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1117 | | x 5:027ad6c5830d d' (rewritten using rebase as 10:44d8c724a70c)
1118 | | |
1118 | | |
1119 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1119 | x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1120 | |/
1120 | |/
1121 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1121 | x 3:a82ac2b38757 c (rewritten using rebase as 9:d008e6b4d3fd)
1122 | |
1122 | |
1123 o | 2:630d7c95eff7 x
1123 o | 2:630d7c95eff7 x
1124 | |
1124 | |
1125 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1125 | x 1:488e1b7e7341 b (rewritten using rebase as 8:67e8f4a16c49)
1126 |/
1126 |/
1127 o 0:b173517d0057 a
1127 o 0:b173517d0057 a
1128
1128
1129 $ hg strip -r 8:
1129 $ hg strip -r 8:
1130 $ hg log -G -r 'a'::
1130 $ hg log -G -r 'a'::
1131 * 7:1143e9adc121 f
1131 * 7:1143e9adc121 f
1132 |
1132 |
1133 | o 6:d60ebfa0f1cb e
1133 | o 6:d60ebfa0f1cb e
1134 | |
1134 | |
1135 | o 5:027ad6c5830d d'
1135 | o 5:027ad6c5830d d'
1136 | |
1136 | |
1137 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1137 x | 4:76be324c128b d (rewritten using replace as 5:027ad6c5830d)
1138 |/
1138 |/
1139 o 3:a82ac2b38757 c
1139 o 3:a82ac2b38757 c
1140 |
1140 |
1141 | o 2:630d7c95eff7 x
1141 | o 2:630d7c95eff7 x
1142 | |
1142 | |
1143 o | 1:488e1b7e7341 b
1143 o | 1:488e1b7e7341 b
1144 |/
1144 |/
1145 o 0:b173517d0057 a
1145 o 0:b173517d0057 a
1146
1146
1147
1147
1148 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1148 If the rebase set has an obsolete (d) with a successor (d') outside the rebase
1149 set and none in destination, we still get the divergence warning.
1149 set and none in destination, we still get the divergence warning.
1150 By allowing divergence, we can perform the rebase.
1150 By allowing divergence, we can perform the rebase.
1151
1151
1152 $ hg rebase -r 'c'::'f' -d 'x'
1152 $ hg rebase -r 'c'::'f' -d 'x'
1153 abort: this rebase will cause divergences from: 76be324c128b
1153 abort: this rebase will cause divergences from: 76be324c128b
1154 (to force the rebase please set experimental.evolution.allowdivergence=True)
1154 (to force the rebase please set experimental.evolution.allowdivergence=True)
1155 [255]
1155 [255]
1156 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1156 $ hg rebase --config experimental.evolution.allowdivergence=true -r 'c'::'f' -d 'x'
1157 rebasing 3:a82ac2b38757 "c" (c)
1157 rebasing 3:a82ac2b38757 "c" (c)
1158 rebasing 4:76be324c128b "d" (d)
1158 rebasing 4:76be324c128b "d" (d)
1159 rebasing 7:1143e9adc121 "f" (f tip)
1159 rebasing 7:1143e9adc121 "f" (f tip)
1160 1 new orphan changesets
1160 1 new orphan changesets
1161 2 new content-divergent changesets
1161 2 new content-divergent changesets
1162 $ hg log -G -r 'a':: -T instabilities
1162 $ hg log -G -r 'a':: -T instabilities
1163 o 10:e1744ea07510 f
1163 o 10:e1744ea07510 f
1164 |
1164 |
1165 * 9:e2b36ea9a0a0 d (content-divergent)
1165 * 9:e2b36ea9a0a0 d (content-divergent)
1166 |
1166 |
1167 o 8:6a0376de376e c
1167 o 8:6a0376de376e c
1168 |
1168 |
1169 | x 7:1143e9adc121 f
1169 | x 7:1143e9adc121 f
1170 | |
1170 | |
1171 | | * 6:d60ebfa0f1cb e (orphan)
1171 | | * 6:d60ebfa0f1cb e (orphan)
1172 | | |
1172 | | |
1173 | | * 5:027ad6c5830d d' (orphan content-divergent)
1173 | | * 5:027ad6c5830d d' (orphan content-divergent)
1174 | | |
1174 | | |
1175 | x | 4:76be324c128b d
1175 | x | 4:76be324c128b d
1176 | |/
1176 | |/
1177 | x 3:a82ac2b38757 c
1177 | x 3:a82ac2b38757 c
1178 | |
1178 | |
1179 o | 2:630d7c95eff7 x
1179 o | 2:630d7c95eff7 x
1180 | |
1180 | |
1181 | o 1:488e1b7e7341 b
1181 | o 1:488e1b7e7341 b
1182 |/
1182 |/
1183 o 0:b173517d0057 a
1183 o 0:b173517d0057 a
1184
1184
1185 $ hg strip -r 8:
1185 $ hg strip -r 8:
1186
1186
1187 (Not skipping obsoletes means that divergence is allowed.)
1187 (Not skipping obsoletes means that divergence is allowed.)
1188
1188
1189 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1189 $ hg rebase --config experimental.rebaseskipobsolete=false -r 'c'::'f' -d 'x'
1190 rebasing 3:a82ac2b38757 "c" (c)
1190 rebasing 3:a82ac2b38757 "c" (c)
1191 rebasing 4:76be324c128b "d" (d)
1191 rebasing 4:76be324c128b "d" (d)
1192 rebasing 7:1143e9adc121 "f" (f tip)
1192 rebasing 7:1143e9adc121 "f" (f tip)
1193 1 new orphan changesets
1193 1 new orphan changesets
1194 2 new content-divergent changesets
1194 2 new content-divergent changesets
1195
1195
1196 $ hg strip -r 0:
1196 $ hg strip -r 0:
1197
1197
1198 Similar test on a more complex graph
1198 Similar test on a more complex graph
1199
1199
1200 $ hg debugdrawdag <<EOF
1200 $ hg debugdrawdag <<EOF
1201 > g
1201 > g
1202 > |
1202 > |
1203 > f e
1203 > f e
1204 > | |
1204 > | |
1205 > e' d # replace: e -> e'
1205 > e' d # replace: e -> e'
1206 > \ /
1206 > \ /
1207 > c
1207 > c
1208 > |
1208 > |
1209 > x b
1209 > x b
1210 > \|
1210 > \|
1211 > a
1211 > a
1212 > EOF
1212 > EOF
1213 1 new orphan changesets
1213 1 new orphan changesets
1214 $ hg log -G -r 'a':
1214 $ hg log -G -r 'a':
1215 * 8:2876ce66c6eb g
1215 * 8:2876ce66c6eb g
1216 |
1216 |
1217 | o 7:3ffec603ab53 f
1217 | o 7:3ffec603ab53 f
1218 | |
1218 | |
1219 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1219 x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1220 | |
1220 | |
1221 | o 5:63324dc512ea e'
1221 | o 5:63324dc512ea e'
1222 | |
1222 | |
1223 o | 4:76be324c128b d
1223 o | 4:76be324c128b d
1224 |/
1224 |/
1225 o 3:a82ac2b38757 c
1225 o 3:a82ac2b38757 c
1226 |
1226 |
1227 | o 2:630d7c95eff7 x
1227 | o 2:630d7c95eff7 x
1228 | |
1228 | |
1229 o | 1:488e1b7e7341 b
1229 o | 1:488e1b7e7341 b
1230 |/
1230 |/
1231 o 0:b173517d0057 a
1231 o 0:b173517d0057 a
1232
1232
1233 $ hg rebase -b 'f' -d 'x'
1233 $ hg rebase -b 'f' -d 'x'
1234 rebasing 1:488e1b7e7341 "b" (b)
1234 rebasing 1:488e1b7e7341 "b" (b)
1235 rebasing 3:a82ac2b38757 "c" (c)
1235 rebasing 3:a82ac2b38757 "c" (c)
1236 rebasing 5:63324dc512ea "e'" (e')
1236 rebasing 5:63324dc512ea "e'" (e')
1237 rebasing 7:3ffec603ab53 "f" (f)
1237 rebasing 7:3ffec603ab53 "f" (f)
1238 rebasing 4:76be324c128b "d" (d)
1238 rebasing 4:76be324c128b "d" (d)
1239 note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
1239 note: not rebasing 6:e36fae928aec "e" (e) and its descendants as this would cause divergence
1240 $ hg log -G -r 'a':
1240 $ hg log -G -r 'a':
1241 o 13:a1707a5b7c2c d
1241 o 13:a1707a5b7c2c d
1242 |
1242 |
1243 | o 12:ef6251596616 f
1243 | o 12:ef6251596616 f
1244 | |
1244 | |
1245 | o 11:b6f172e64af9 e'
1245 | o 11:b6f172e64af9 e'
1246 |/
1246 |/
1247 o 10:d008e6b4d3fd c
1247 o 10:d008e6b4d3fd c
1248 |
1248 |
1249 o 9:67e8f4a16c49 b
1249 o 9:67e8f4a16c49 b
1250 |
1250 |
1251 | * 8:2876ce66c6eb g
1251 | * 8:2876ce66c6eb g
1252 | |
1252 | |
1253 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1253 | | x 7:3ffec603ab53 f (rewritten using rebase as 12:ef6251596616)
1254 | | |
1254 | | |
1255 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1255 | x | 6:e36fae928aec e (rewritten using replace as 5:63324dc512ea)
1256 | | |
1256 | | |
1257 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1257 | | x 5:63324dc512ea e' (rewritten using rebase as 11:b6f172e64af9)
1258 | | |
1258 | | |
1259 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1259 | x | 4:76be324c128b d (rewritten using rebase as 13:a1707a5b7c2c)
1260 | |/
1260 | |/
1261 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1261 | x 3:a82ac2b38757 c (rewritten using rebase as 10:d008e6b4d3fd)
1262 | |
1262 | |
1263 o | 2:630d7c95eff7 x
1263 o | 2:630d7c95eff7 x
1264 | |
1264 | |
1265 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1265 | x 1:488e1b7e7341 b (rewritten using rebase as 9:67e8f4a16c49)
1266 |/
1266 |/
1267 o 0:b173517d0057 a
1267 o 0:b173517d0057 a
1268
1268
1269
1269
1270 issue5782
1270 issue5782
1271 $ hg strip -r 0:
1271 $ hg strip -r 0:
1272 $ hg debugdrawdag <<EOF
1272 $ hg debugdrawdag <<EOF
1273 > d
1273 > d
1274 > |
1274 > |
1275 > c1 c # replace: c -> c1
1275 > c1 c # replace: c -> c1
1276 > \ /
1276 > \ /
1277 > b
1277 > b
1278 > |
1278 > |
1279 > a
1279 > a
1280 > EOF
1280 > EOF
1281 1 new orphan changesets
1281 1 new orphan changesets
1282 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1282 $ hg debugobsolete `hg log -T "{node}" --hidden -r 'desc("c1")'`
1283 1 new obsolescence markers
1283 1 new obsolescence markers
1284 obsoleted 1 changesets
1284 obsoleted 1 changesets
1285 $ hg log -G -r 'a': --hidden
1285 $ hg log -G -r 'a': --hidden
1286 * 4:76be324c128b d
1286 * 4:76be324c128b d
1287 |
1287 |
1288 | x 3:ef8a456de8fa c1 (pruned)
1288 | x 3:ef8a456de8fa c1 (pruned)
1289 | |
1289 | |
1290 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1290 x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa)
1291 |/
1291 |/
1292 o 1:488e1b7e7341 b
1292 o 1:488e1b7e7341 b
1293 |
1293 |
1294 o 0:b173517d0057 a
1294 o 0:b173517d0057 a
1295
1295
1296 $ hg rebase -d 0 -r 2
1296 $ hg rebase -d 0 -r 2
1297 rebasing 2:a82ac2b38757 "c" (c)
1297 rebasing 2:a82ac2b38757 "c" (c)
1298 $ hg log -G -r 'a': --hidden
1298 $ hg log -G -r 'a': --hidden
1299 o 5:69ad416a4a26 c
1299 o 5:69ad416a4a26 c
1300 |
1300 |
1301 | * 4:76be324c128b d
1301 | * 4:76be324c128b d
1302 | |
1302 | |
1303 | | x 3:ef8a456de8fa c1 (pruned)
1303 | | x 3:ef8a456de8fa c1 (pruned)
1304 | | |
1304 | | |
1305 | x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa rewritten using rebase as 5:69ad416a4a26)
1305 | x | 2:a82ac2b38757 c (rewritten using replace as 3:ef8a456de8fa rewritten using rebase as 5:69ad416a4a26)
1306 | |/
1306 | |/
1307 | o 1:488e1b7e7341 b
1307 | o 1:488e1b7e7341 b
1308 |/
1308 |/
1309 o 0:b173517d0057 a
1309 o 0:b173517d0057 a
1310
1310
1311 $ cd ..
1311 $ cd ..
1312
1312
1313 Rebase merge where successor of one parent is equal to destination (issue5198)
1313 Rebase merge where successor of one parent is equal to destination (issue5198)
1314
1314
1315 $ hg init p1-succ-is-dest
1315 $ hg init p1-succ-is-dest
1316 $ cd p1-succ-is-dest
1316 $ cd p1-succ-is-dest
1317
1317
1318 $ hg debugdrawdag <<EOF
1318 $ hg debugdrawdag <<EOF
1319 > F
1319 > F
1320 > /|
1320 > /|
1321 > E D B # replace: D -> B
1321 > E D B # replace: D -> B
1322 > \|/
1322 > \|/
1323 > A
1323 > A
1324 > EOF
1324 > EOF
1325 1 new orphan changesets
1325 1 new orphan changesets
1326
1326
1327 $ hg rebase -d B -s D
1327 $ hg rebase -d B -s D
1328 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1328 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1329 rebasing 4:66f1a38021c9 "F" (F tip)
1329 rebasing 4:66f1a38021c9 "F" (F tip)
1330 $ hg log -G
1330 $ hg log -G
1331 o 5:50e9d60b99c6 F
1331 o 5:50e9d60b99c6 F
1332 |\
1332 |\
1333 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1333 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:50e9d60b99c6)
1334 | |/|
1334 | |/|
1335 | o | 3:7fb047a69f22 E
1335 | o | 3:7fb047a69f22 E
1336 | | |
1336 | | |
1337 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1337 | | x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1338 | |/
1338 | |/
1339 o | 1:112478962961 B
1339 o | 1:112478962961 B
1340 |/
1340 |/
1341 o 0:426bada5c675 A
1341 o 0:426bada5c675 A
1342
1342
1343 $ cd ..
1343 $ cd ..
1344
1344
1345 Rebase merge where successor of other parent is equal to destination
1345 Rebase merge where successor of other parent is equal to destination
1346
1346
1347 $ hg init p2-succ-is-dest
1347 $ hg init p2-succ-is-dest
1348 $ cd p2-succ-is-dest
1348 $ cd p2-succ-is-dest
1349
1349
1350 $ hg debugdrawdag <<EOF
1350 $ hg debugdrawdag <<EOF
1351 > F
1351 > F
1352 > /|
1352 > /|
1353 > E D B # replace: E -> B
1353 > E D B # replace: E -> B
1354 > \|/
1354 > \|/
1355 > A
1355 > A
1356 > EOF
1356 > EOF
1357 1 new orphan changesets
1357 1 new orphan changesets
1358
1358
1359 $ hg rebase -d B -s E
1359 $ hg rebase -d B -s E
1360 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1360 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1361 rebasing 4:66f1a38021c9 "F" (F tip)
1361 rebasing 4:66f1a38021c9 "F" (F tip)
1362 $ hg log -G
1362 $ hg log -G
1363 o 5:aae1787dacee F
1363 o 5:aae1787dacee F
1364 |\
1364 |\
1365 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1365 | | x 4:66f1a38021c9 F (rewritten using rebase as 5:aae1787dacee)
1366 | |/|
1366 | |/|
1367 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1367 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1368 | | |
1368 | | |
1369 | o | 2:b18e25de2cf5 D
1369 | o | 2:b18e25de2cf5 D
1370 | |/
1370 | |/
1371 o / 1:112478962961 B
1371 o / 1:112478962961 B
1372 |/
1372 |/
1373 o 0:426bada5c675 A
1373 o 0:426bada5c675 A
1374
1374
1375 $ cd ..
1375 $ cd ..
1376
1376
1377 Rebase merge where successor of one parent is ancestor of destination
1377 Rebase merge where successor of one parent is ancestor of destination
1378
1378
1379 $ hg init p1-succ-in-dest
1379 $ hg init p1-succ-in-dest
1380 $ cd p1-succ-in-dest
1380 $ cd p1-succ-in-dest
1381
1381
1382 $ hg debugdrawdag <<EOF
1382 $ hg debugdrawdag <<EOF
1383 > F C
1383 > F C
1384 > /| |
1384 > /| |
1385 > E D B # replace: D -> B
1385 > E D B # replace: D -> B
1386 > \|/
1386 > \|/
1387 > A
1387 > A
1388 > EOF
1388 > EOF
1389 1 new orphan changesets
1389 1 new orphan changesets
1390
1390
1391 $ hg rebase -d C -s D
1391 $ hg rebase -d C -s D
1392 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1392 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1393 rebasing 5:66f1a38021c9 "F" (F tip)
1393 rebasing 5:66f1a38021c9 "F" (F tip)
1394
1394
1395 $ hg log -G
1395 $ hg log -G
1396 o 6:0913febf6439 F
1396 o 6:0913febf6439 F
1397 |\
1397 |\
1398 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1398 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:0913febf6439)
1399 | | |
1399 | | |
1400 | o | 4:26805aba1e60 C
1400 | o | 4:26805aba1e60 C
1401 | | |
1401 | | |
1402 o | | 3:7fb047a69f22 E
1402 o | | 3:7fb047a69f22 E
1403 | | |
1403 | | |
1404 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1404 +---x 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1405 | |
1405 | |
1406 | o 1:112478962961 B
1406 | o 1:112478962961 B
1407 |/
1407 |/
1408 o 0:426bada5c675 A
1408 o 0:426bada5c675 A
1409
1409
1410 $ cd ..
1410 $ cd ..
1411
1411
1412 Rebase merge where successor of other parent is ancestor of destination
1412 Rebase merge where successor of other parent is ancestor of destination
1413
1413
1414 $ hg init p2-succ-in-dest
1414 $ hg init p2-succ-in-dest
1415 $ cd p2-succ-in-dest
1415 $ cd p2-succ-in-dest
1416
1416
1417 $ hg debugdrawdag <<EOF
1417 $ hg debugdrawdag <<EOF
1418 > F C
1418 > F C
1419 > /| |
1419 > /| |
1420 > E D B # replace: E -> B
1420 > E D B # replace: E -> B
1421 > \|/
1421 > \|/
1422 > A
1422 > A
1423 > EOF
1423 > EOF
1424 1 new orphan changesets
1424 1 new orphan changesets
1425
1425
1426 $ hg rebase -d C -s E
1426 $ hg rebase -d C -s E
1427 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1427 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1428 rebasing 5:66f1a38021c9 "F" (F tip)
1428 rebasing 5:66f1a38021c9 "F" (F tip)
1429 $ hg log -G
1429 $ hg log -G
1430 o 6:c6ab0cc6d220 F
1430 o 6:c6ab0cc6d220 F
1431 |\
1431 |\
1432 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1432 +---x 5:66f1a38021c9 F (rewritten using rebase as 6:c6ab0cc6d220)
1433 | | |
1433 | | |
1434 | o | 4:26805aba1e60 C
1434 | o | 4:26805aba1e60 C
1435 | | |
1435 | | |
1436 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1436 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1437 | | |
1437 | | |
1438 o---+ 2:b18e25de2cf5 D
1438 o---+ 2:b18e25de2cf5 D
1439 / /
1439 / /
1440 o / 1:112478962961 B
1440 o / 1:112478962961 B
1441 |/
1441 |/
1442 o 0:426bada5c675 A
1442 o 0:426bada5c675 A
1443
1443
1444 $ cd ..
1444 $ cd ..
1445
1445
1446 Rebase merge where successor of one parent is ancestor of destination
1446 Rebase merge where successor of one parent is ancestor of destination
1447
1447
1448 $ hg init p1-succ-in-dest-b
1448 $ hg init p1-succ-in-dest-b
1449 $ cd p1-succ-in-dest-b
1449 $ cd p1-succ-in-dest-b
1450
1450
1451 $ hg debugdrawdag <<EOF
1451 $ hg debugdrawdag <<EOF
1452 > F C
1452 > F C
1453 > /| |
1453 > /| |
1454 > E D B # replace: E -> B
1454 > E D B # replace: E -> B
1455 > \|/
1455 > \|/
1456 > A
1456 > A
1457 > EOF
1457 > EOF
1458 1 new orphan changesets
1458 1 new orphan changesets
1459
1459
1460 $ hg rebase -d C -b F
1460 $ hg rebase -d C -b F
1461 rebasing 2:b18e25de2cf5 "D" (D)
1461 rebasing 2:b18e25de2cf5 "D" (D)
1462 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1462 note: not rebasing 3:7fb047a69f22 "E" (E), already in destination as 1:112478962961 "B" (B)
1463 rebasing 5:66f1a38021c9 "F" (F tip)
1463 rebasing 5:66f1a38021c9 "F" (F tip)
1464 note: not rebasing 5:66f1a38021c9 "F" (F tip), its destination already has all its changes
1464 note: not rebasing 5:66f1a38021c9 "F" (F tip), its destination already has all its changes
1465 $ hg log -G
1465 $ hg log -G
1466 o 6:8f47515dda15 D
1466 o 6:8f47515dda15 D
1467 |
1467 |
1468 | x 5:66f1a38021c9 F (pruned using rebase)
1468 | x 5:66f1a38021c9 F (pruned using rebase)
1469 | |\
1469 | |\
1470 o | | 4:26805aba1e60 C
1470 o | | 4:26805aba1e60 C
1471 | | |
1471 | | |
1472 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1472 | | x 3:7fb047a69f22 E (rewritten using replace as 1:112478962961)
1473 | | |
1473 | | |
1474 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1474 | x | 2:b18e25de2cf5 D (rewritten using rebase as 6:8f47515dda15)
1475 | |/
1475 | |/
1476 o / 1:112478962961 B
1476 o / 1:112478962961 B
1477 |/
1477 |/
1478 o 0:426bada5c675 A
1478 o 0:426bada5c675 A
1479
1479
1480 $ cd ..
1480 $ cd ..
1481
1481
1482 Rebase merge where successor of other parent is ancestor of destination
1482 Rebase merge where successor of other parent is ancestor of destination
1483
1483
1484 $ hg init p2-succ-in-dest-b
1484 $ hg init p2-succ-in-dest-b
1485 $ cd p2-succ-in-dest-b
1485 $ cd p2-succ-in-dest-b
1486
1486
1487 $ hg debugdrawdag <<EOF
1487 $ hg debugdrawdag <<EOF
1488 > F C
1488 > F C
1489 > /| |
1489 > /| |
1490 > E D B # replace: D -> B
1490 > E D B # replace: D -> B
1491 > \|/
1491 > \|/
1492 > A
1492 > A
1493 > EOF
1493 > EOF
1494 1 new orphan changesets
1494 1 new orphan changesets
1495
1495
1496 $ hg rebase -d C -b F
1496 $ hg rebase -d C -b F
1497 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1497 note: not rebasing 2:b18e25de2cf5 "D" (D), already in destination as 1:112478962961 "B" (B)
1498 rebasing 3:7fb047a69f22 "E" (E)
1498 rebasing 3:7fb047a69f22 "E" (E)
1499 rebasing 5:66f1a38021c9 "F" (F tip)
1499 rebasing 5:66f1a38021c9 "F" (F tip)
1500 note: not rebasing 5:66f1a38021c9 "F" (F tip), its destination already has all its changes
1500 note: not rebasing 5:66f1a38021c9 "F" (F tip), its destination already has all its changes
1501
1501
1502 $ hg log -G
1502 $ hg log -G
1503 o 6:533690786a86 E
1503 o 6:533690786a86 E
1504 |
1504 |
1505 | x 5:66f1a38021c9 F (pruned using rebase)
1505 | x 5:66f1a38021c9 F (pruned using rebase)
1506 | |\
1506 | |\
1507 o | | 4:26805aba1e60 C
1507 o | | 4:26805aba1e60 C
1508 | | |
1508 | | |
1509 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1509 | | x 3:7fb047a69f22 E (rewritten using rebase as 6:533690786a86)
1510 | | |
1510 | | |
1511 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1511 | x | 2:b18e25de2cf5 D (rewritten using replace as 1:112478962961)
1512 | |/
1512 | |/
1513 o / 1:112478962961 B
1513 o / 1:112478962961 B
1514 |/
1514 |/
1515 o 0:426bada5c675 A
1515 o 0:426bada5c675 A
1516
1516
1517 $ cd ..
1517 $ cd ..
1518
1518
1519 Rebase merge where extinct node has successor that is not an ancestor of
1519 Rebase merge where extinct node has successor that is not an ancestor of
1520 destination
1520 destination
1521
1521
1522 $ hg init extinct-with-succ-not-in-dest
1522 $ hg init extinct-with-succ-not-in-dest
1523 $ cd extinct-with-succ-not-in-dest
1523 $ cd extinct-with-succ-not-in-dest
1524
1524
1525 $ hg debugdrawdag <<EOF
1525 $ hg debugdrawdag <<EOF
1526 > E C # replace: C -> E
1526 > E C # replace: C -> E
1527 > | |
1527 > | |
1528 > D B
1528 > D B
1529 > |/
1529 > |/
1530 > A
1530 > A
1531 > EOF
1531 > EOF
1532
1532
1533 $ hg rebase -d D -s B
1533 $ hg rebase -d D -s B
1534 rebasing 1:112478962961 "B" (B)
1534 rebasing 1:112478962961 "B" (B)
1535 note: not rebasing 3:26805aba1e60 "C" (C) and its descendants as this would cause divergence
1535 note: not rebasing 3:26805aba1e60 "C" (C) and its descendants as this would cause divergence
1536
1536
1537 $ cd ..
1537 $ cd ..
1538
1538
1539 $ hg init p2-succ-in-dest-c
1539 $ hg init p2-succ-in-dest-c
1540 $ cd p2-succ-in-dest-c
1540 $ cd p2-succ-in-dest-c
1541
1541
1542 The scenario here was that B::D were developed on default. B was queued on
1542 The scenario here was that B::D were developed on default. B was queued on
1543 stable, but amended before being push to hg-committed. C was queued on default,
1543 stable, but amended before being push to hg-committed. C was queued on default,
1544 along with unrelated J.
1544 along with unrelated J.
1545
1545
1546 $ hg debugdrawdag <<EOF
1546 $ hg debugdrawdag <<EOF
1547 > J
1547 > J
1548 > |
1548 > |
1549 > F
1549 > F
1550 > |
1550 > |
1551 > E
1551 > E
1552 > | D
1552 > | D
1553 > | |
1553 > | |
1554 > | C # replace: C -> F
1554 > | C # replace: C -> F
1555 > | | H I # replace: B -> H -> I
1555 > | | H I # replace: B -> H -> I
1556 > | B |/
1556 > | B |/
1557 > |/ G
1557 > |/ G
1558 > A
1558 > A
1559 > EOF
1559 > EOF
1560 1 new orphan changesets
1560 1 new orphan changesets
1561
1561
1562 This strip seems to be the key to avoid an early divergence warning.
1562 This strip seems to be the key to avoid an early divergence warning.
1563 $ hg --config extensions.strip= --hidden strip -qr H
1563 $ hg --config extensions.strip= --hidden strip -qr H
1564 1 new orphan changesets
1564 1 new orphan changesets
1565
1565
1566 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1566 $ hg rebase -b 'desc("D")' -d 'desc("J")'
1567 abort: this rebase will cause divergences from: 112478962961
1567 abort: this rebase will cause divergences from: 112478962961
1568 (to force the rebase please set experimental.evolution.allowdivergence=True)
1568 (to force the rebase please set experimental.evolution.allowdivergence=True)
1569 [255]
1569 [255]
1570
1570
1571 Rebase merge where both parents have successors in destination
1571 Rebase merge where both parents have successors in destination
1572
1572
1573 $ hg init p12-succ-in-dest
1573 $ hg init p12-succ-in-dest
1574 $ cd p12-succ-in-dest
1574 $ cd p12-succ-in-dest
1575 $ hg debugdrawdag <<'EOS'
1575 $ hg debugdrawdag <<'EOS'
1576 > E F
1576 > E F
1577 > /| /| # replace: A -> C
1577 > /| /| # replace: A -> C
1578 > A B C D # replace: B -> D
1578 > A B C D # replace: B -> D
1579 > | |
1579 > | |
1580 > X Y
1580 > X Y
1581 > EOS
1581 > EOS
1582 1 new orphan changesets
1582 1 new orphan changesets
1583 $ hg rebase -r A+B+E -d F
1583 $ hg rebase -r A+B+E -d F
1584 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1584 note: not rebasing 4:a3d17304151f "A" (A), already in destination as 0:96cc3511f894 "C" (C)
1585 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1585 note: not rebasing 5:b23a2cc00842 "B" (B), already in destination as 1:058c1e1fb10a "D" (D)
1586 rebasing 7:dac5d11c5a7d "E" (E tip)
1586 rebasing 7:dac5d11c5a7d "E" (E tip)
1587 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1587 abort: rebasing 7:dac5d11c5a7d will include unwanted changes from 3:59c792af609c, 5:b23a2cc00842 or 2:ba2b7fa7166d, 4:a3d17304151f
1588 [255]
1588 [255]
1589 $ cd ..
1589 $ cd ..
1590
1590
1591 Rebase a non-clean merge. One parent has successor in destination, the other
1591 Rebase a non-clean merge. One parent has successor in destination, the other
1592 parent moves as requested.
1592 parent moves as requested.
1593
1593
1594 $ hg init p1-succ-p2-move
1594 $ hg init p1-succ-p2-move
1595 $ cd p1-succ-p2-move
1595 $ cd p1-succ-p2-move
1596 $ hg debugdrawdag <<'EOS'
1596 $ hg debugdrawdag <<'EOS'
1597 > D Z
1597 > D Z
1598 > /| | # replace: A -> C
1598 > /| | # replace: A -> C
1599 > A B C # D/D = D
1599 > A B C # D/D = D
1600 > EOS
1600 > EOS
1601 1 new orphan changesets
1601 1 new orphan changesets
1602 $ hg rebase -r A+B+D -d Z
1602 $ hg rebase -r A+B+D -d Z
1603 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1603 note: not rebasing 0:426bada5c675 "A" (A), already in destination as 2:96cc3511f894 "C" (C)
1604 rebasing 1:fc2b737bb2e5 "B" (B)
1604 rebasing 1:fc2b737bb2e5 "B" (B)
1605 rebasing 3:b8ed089c80ad "D" (D)
1605 rebasing 3:b8ed089c80ad "D" (D)
1606
1606
1607 $ rm .hg/localtags
1607 $ rm .hg/localtags
1608 $ hg log -G
1608 $ hg log -G
1609 o 6:e4f78693cc88 D
1609 o 6:e4f78693cc88 D
1610 |
1610 |
1611 o 5:76840d832e98 B
1611 o 5:76840d832e98 B
1612 |
1612 |
1613 o 4:50e41c1f3950 Z
1613 o 4:50e41c1f3950 Z
1614 |
1614 |
1615 o 2:96cc3511f894 C
1615 o 2:96cc3511f894 C
1616
1616
1617 $ hg files -r tip
1617 $ hg files -r tip
1618 B
1618 B
1619 C
1619 C
1620 D
1620 D
1621 Z
1621 Z
1622
1622
1623 $ cd ..
1623 $ cd ..
1624
1624
1625 $ hg init p1-move-p2-succ
1625 $ hg init p1-move-p2-succ
1626 $ cd p1-move-p2-succ
1626 $ cd p1-move-p2-succ
1627 $ hg debugdrawdag <<'EOS'
1627 $ hg debugdrawdag <<'EOS'
1628 > D Z
1628 > D Z
1629 > /| | # replace: B -> C
1629 > /| | # replace: B -> C
1630 > A B C # D/D = D
1630 > A B C # D/D = D
1631 > EOS
1631 > EOS
1632 1 new orphan changesets
1632 1 new orphan changesets
1633 $ hg rebase -r B+A+D -d Z
1633 $ hg rebase -r B+A+D -d Z
1634 rebasing 0:426bada5c675 "A" (A)
1634 rebasing 0:426bada5c675 "A" (A)
1635 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1635 note: not rebasing 1:fc2b737bb2e5 "B" (B), already in destination as 2:96cc3511f894 "C" (C)
1636 rebasing 3:b8ed089c80ad "D" (D)
1636 rebasing 3:b8ed089c80ad "D" (D)
1637
1637
1638 $ rm .hg/localtags
1638 $ rm .hg/localtags
1639 $ hg log -G
1639 $ hg log -G
1640 o 6:1b355ed94d82 D
1640 o 6:1b355ed94d82 D
1641 |
1641 |
1642 o 5:a81a74d764a6 A
1642 o 5:a81a74d764a6 A
1643 |
1643 |
1644 o 4:50e41c1f3950 Z
1644 o 4:50e41c1f3950 Z
1645 |
1645 |
1646 o 2:96cc3511f894 C
1646 o 2:96cc3511f894 C
1647
1647
1648 $ hg files -r tip
1648 $ hg files -r tip
1649 A
1649 A
1650 C
1650 C
1651 D
1651 D
1652 Z
1652 Z
1653
1653
1654 $ cd ..
1654 $ cd ..
1655
1655
1656 Test that bookmark is moved and working dir is updated when all changesets have
1656 Test that bookmark is moved and working dir is updated when all changesets have
1657 equivalents in destination
1657 equivalents in destination
1658 $ hg init rbsrepo && cd rbsrepo
1658 $ hg init rbsrepo && cd rbsrepo
1659 $ echo "[experimental]" > .hg/hgrc
1659 $ echo "[experimental]" > .hg/hgrc
1660 $ echo "evolution=true" >> .hg/hgrc
1660 $ echo "evolution=true" >> .hg/hgrc
1661 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1661 $ echo "rebaseskipobsolete=on" >> .hg/hgrc
1662 $ echo root > root && hg ci -Am root
1662 $ echo root > root && hg ci -Am root
1663 adding root
1663 adding root
1664 $ echo a > a && hg ci -Am a
1664 $ echo a > a && hg ci -Am a
1665 adding a
1665 adding a
1666 $ hg up 0
1666 $ hg up 0
1667 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1667 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1668 $ echo b > b && hg ci -Am b
1668 $ echo b > b && hg ci -Am b
1669 adding b
1669 adding b
1670 created new head
1670 created new head
1671 $ hg rebase -r 2 -d 1
1671 $ hg rebase -r 2 -d 1
1672 rebasing 2:1e9a3c00cbe9 "b" (tip)
1672 rebasing 2:1e9a3c00cbe9 "b" (tip)
1673 $ hg log -r . # working dir is at rev 3 (successor of 2)
1673 $ hg log -r . # working dir is at rev 3 (successor of 2)
1674 3:be1832deae9a b (no-eol)
1674 3:be1832deae9a b (no-eol)
1675 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1675 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now
1676 bookmarking hidden changeset 1e9a3c00cbe9
1676 bookmarking hidden changeset 1e9a3c00cbe9
1677 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1677 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a)
1678 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1678 $ hg up 2 && hg log -r . # working dir is at rev 2 again
1679 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1679 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1680 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1680 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol)
1681 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1681 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1
1682 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1682 note: not rebasing 2:1e9a3c00cbe9 "b" (mybook), already in destination as 3:be1832deae9a "b" (tip)
1683 Check that working directory and bookmark was updated to rev 3 although rev 2
1683 Check that working directory and bookmark was updated to rev 3 although rev 2
1684 was skipped
1684 was skipped
1685 $ hg log -r .
1685 $ hg log -r .
1686 3:be1832deae9a b (no-eol)
1686 3:be1832deae9a b (no-eol)
1687 $ hg bookmarks
1687 $ hg bookmarks
1688 mybook 3:be1832deae9a
1688 mybook 3:be1832deae9a
1689 $ hg debugobsolete --rev tip
1689 $ hg debugobsolete --rev tip
1690 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1690 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'}
1691
1691
1692 Obsoleted working parent and bookmark could be moved if an ancestor of working
1692 Obsoleted working parent and bookmark could be moved if an ancestor of working
1693 parent gets moved:
1693 parent gets moved:
1694
1694
1695 $ hg init $TESTTMP/ancestor-wd-move
1695 $ hg init $TESTTMP/ancestor-wd-move
1696 $ cd $TESTTMP/ancestor-wd-move
1696 $ cd $TESTTMP/ancestor-wd-move
1697 $ hg debugdrawdag <<'EOS'
1697 $ hg debugdrawdag <<'EOS'
1698 > E D1 # rebase: D1 -> D2
1698 > E D1 # rebase: D1 -> D2
1699 > | |
1699 > | |
1700 > | C
1700 > | C
1701 > D2 |
1701 > D2 |
1702 > | B
1702 > | B
1703 > |/
1703 > |/
1704 > A
1704 > A
1705 > EOS
1705 > EOS
1706 $ hg update D1 -q
1706 $ hg update D1 -q
1707 $ hg bookmark book -i
1707 $ hg bookmark book -i
1708 $ hg rebase -r B+D1 -d E
1708 $ hg rebase -r B+D1 -d E
1709 rebasing 1:112478962961 "B" (B)
1709 rebasing 1:112478962961 "B" (B)
1710 note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2)
1710 note: not rebasing 5:15ecf15e0114 "D1" (book D1 tip), already in destination as 2:0807738e0be9 "D2" (D2)
1711 1 new orphan changesets
1711 1 new orphan changesets
1712 $ hg log -G -T '{desc} {bookmarks}'
1712 $ hg log -G -T '{desc} {bookmarks}'
1713 @ B book
1713 @ B book
1714 |
1714 |
1715 | x D1
1715 | x D1
1716 | |
1716 | |
1717 o | E
1717 o | E
1718 | |
1718 | |
1719 | * C
1719 | * C
1720 | |
1720 | |
1721 o | D2
1721 o | D2
1722 | |
1722 | |
1723 | x B
1723 | x B
1724 |/
1724 |/
1725 o A
1725 o A
1726
1726
1727 Rebasing a merge with one of its parent having a hidden successor
1727 Rebasing a merge with one of its parent having a hidden successor
1728
1728
1729 $ hg init $TESTTMP/merge-p1-hidden-successor
1729 $ hg init $TESTTMP/merge-p1-hidden-successor
1730 $ cd $TESTTMP/merge-p1-hidden-successor
1730 $ cd $TESTTMP/merge-p1-hidden-successor
1731
1731
1732 $ hg debugdrawdag <<'EOS'
1732 $ hg debugdrawdag <<'EOS'
1733 > E
1733 > E
1734 > |
1734 > |
1735 > B3 B2 # amend: B1 -> B2 -> B3
1735 > B3 B2 # amend: B1 -> B2 -> B3
1736 > |/ # B2 is hidden
1736 > |/ # B2 is hidden
1737 > | D
1737 > | D
1738 > | |\
1738 > | |\
1739 > | B1 C
1739 > | B1 C
1740 > |/
1740 > |/
1741 > A
1741 > A
1742 > EOS
1742 > EOS
1743 1 new orphan changesets
1743 1 new orphan changesets
1744
1744
1745 $ eval `hg tags -T '{tag}={node}\n'`
1745 $ eval `hg tags -T '{tag}={node}\n'`
1746 $ rm .hg/localtags
1746 $ rm .hg/localtags
1747
1747
1748 $ hg rebase -r $D -d $E
1748 $ hg rebase -r $D -d $E
1749 rebasing 5:9e62094e4d94 "D"
1749 rebasing 5:9e62094e4d94 "D"
1750
1750
1751 $ hg log -G
1751 $ hg log -G
1752 o 7:a699d059adcf D
1752 o 7:a699d059adcf D
1753 |\
1753 |\
1754 | o 6:ecc93090a95c E
1754 | o 6:ecc93090a95c E
1755 | |
1755 | |
1756 | o 4:0dc878468a23 B3
1756 | o 4:0dc878468a23 B3
1757 | |
1757 | |
1758 o | 1:96cc3511f894 C
1758 o | 1:96cc3511f894 C
1759 /
1759 /
1760 o 0:426bada5c675 A
1760 o 0:426bada5c675 A
1761
1761
1762 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1762 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.),
1763 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1763 rebasestate may contain hidden hashes. "rebase --abort" should work regardless.
1764
1764
1765 $ hg init $TESTTMP/hidden-state1
1765 $ hg init $TESTTMP/hidden-state1
1766 $ cd $TESTTMP/hidden-state1
1766 $ cd $TESTTMP/hidden-state1
1767 $ cat >> .hg/hgrc <<EOF
1767 $ cat >> .hg/hgrc <<EOF
1768 > [experimental]
1768 > [experimental]
1769 > rebaseskipobsolete=0
1769 > rebaseskipobsolete=0
1770 > EOF
1770 > EOF
1771
1771
1772 $ hg debugdrawdag <<'EOS'
1772 $ hg debugdrawdag <<'EOS'
1773 > C
1773 > C
1774 > |
1774 > |
1775 > D B # prune: B, C
1775 > D B # prune: B, C
1776 > |/ # B/D=B
1776 > |/ # B/D=B
1777 > A
1777 > A
1778 > EOS
1778 > EOS
1779
1779
1780 $ eval `hg tags -T '{tag}={node}\n'`
1780 $ eval `hg tags -T '{tag}={node}\n'`
1781 $ rm .hg/localtags
1781 $ rm .hg/localtags
1782
1782
1783 $ hg update -q $C --hidden
1783 $ hg update -q $C --hidden
1784 updated to hidden changeset 7829726be4dc
1784 updated to hidden changeset 7829726be4dc
1785 (hidden revision '7829726be4dc' is pruned)
1785 (hidden revision '7829726be4dc' is pruned)
1786 $ hg rebase -s $B -d $D
1786 $ hg rebase -s $B -d $D
1787 rebasing 1:2ec65233581b "B"
1787 rebasing 1:2ec65233581b "B"
1788 merging D
1788 merging D
1789 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1789 warning: conflicts while merging D! (edit, then use 'hg resolve --mark')
1790 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1790 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1791 [1]
1791 [1]
1792
1792
1793 $ cp -R . $TESTTMP/hidden-state2
1793 $ cp -R . $TESTTMP/hidden-state2
1794
1794
1795 $ hg log -G
1795 $ hg log -G
1796 @ 2:b18e25de2cf5 D
1796 @ 2:b18e25de2cf5 D
1797 |
1797 |
1798 o 0:426bada5c675 A
1798 o 0:426bada5c675 A
1799
1799
1800 $ hg summary
1800 $ hg summary
1801 parent: 2:b18e25de2cf5 tip
1801 parent: 2:b18e25de2cf5 tip
1802 D
1802 D
1803 branch: default
1803 branch: default
1804 commit: 1 modified, 1 added, 1 unknown, 1 unresolved
1804 commit: 1 modified, 1 added, 1 unknown, 1 unresolved
1805 update: (current)
1805 update: (current)
1806 phases: 2 draft
1806 phases: 2 draft
1807 rebase: 0 rebased, 2 remaining (rebase --continue)
1807 rebase: 0 rebased, 2 remaining (rebase --continue)
1808
1808
1809 $ hg rebase --abort
1809 $ hg rebase --abort
1810 rebase aborted
1810 rebase aborted
1811
1811
1812 Also test --continue for the above case
1812 Also test --continue for the above case
1813
1813
1814 $ cd $TESTTMP/hidden-state2
1814 $ cd $TESTTMP/hidden-state2
1815 $ hg resolve -m
1815 $ hg resolve -m
1816 (no more unresolved files)
1816 (no more unresolved files)
1817 continue: hg rebase --continue
1817 continue: hg rebase --continue
1818 $ hg rebase --continue
1818 $ hg rebase --continue
1819 rebasing 1:2ec65233581b "B"
1819 rebasing 1:2ec65233581b "B"
1820 rebasing 3:7829726be4dc "C" (tip)
1820 rebasing 3:7829726be4dc "C" (tip)
1821 $ hg log -G
1821 $ hg log -G
1822 @ 5:1964d5d5b547 C
1822 @ 5:1964d5d5b547 C
1823 |
1823 |
1824 o 4:68deb90c12a2 B
1824 o 4:68deb90c12a2 B
1825 |
1825 |
1826 o 2:b18e25de2cf5 D
1826 o 2:b18e25de2cf5 D
1827 |
1827 |
1828 o 0:426bada5c675 A
1828 o 0:426bada5c675 A
1829
1829
1830 ====================
1830 ====================
1831 Test --stop option |
1831 Test --stop option |
1832 ====================
1832 ====================
1833 $ cd ..
1833 $ cd ..
1834 $ hg init rbstop
1834 $ hg init rbstop
1835 $ cd rbstop
1835 $ cd rbstop
1836 $ echo a>a
1836 $ echo a>a
1837 $ hg ci -Aqma
1837 $ hg ci -Aqma
1838 $ echo b>b
1838 $ echo b>b
1839 $ hg ci -Aqmb
1839 $ hg ci -Aqmb
1840 $ echo c>c
1840 $ echo c>c
1841 $ hg ci -Aqmc
1841 $ hg ci -Aqmc
1842 $ echo d>d
1842 $ echo d>d
1843 $ hg ci -Aqmd
1843 $ hg ci -Aqmd
1844 $ hg up 0 -q
1844 $ hg up 0 -q
1845 $ echo f>f
1845 $ echo f>f
1846 $ hg ci -Aqmf
1846 $ hg ci -Aqmf
1847 $ echo D>d
1847 $ echo D>d
1848 $ hg ci -Aqm "conflict with d"
1848 $ hg ci -Aqm "conflict with d"
1849 $ hg up 3 -q
1849 $ hg up 3 -q
1850 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1850 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1851 o 5:00bfc9898aeb test
1851 o 5:00bfc9898aeb test
1852 | conflict with d
1852 | conflict with d
1853 |
1853 |
1854 o 4:dafd40200f93 test
1854 o 4:dafd40200f93 test
1855 | f
1855 | f
1856 |
1856 |
1857 | @ 3:055a42cdd887 test
1857 | @ 3:055a42cdd887 test
1858 | | d
1858 | | d
1859 | |
1859 | |
1860 | o 2:177f92b77385 test
1860 | o 2:177f92b77385 test
1861 | | c
1861 | | c
1862 | |
1862 | |
1863 | o 1:d2ae7f538514 test
1863 | o 1:d2ae7f538514 test
1864 |/ b
1864 |/ b
1865 |
1865 |
1866 o 0:cb9a9f314b8b test
1866 o 0:cb9a9f314b8b test
1867 a
1867 a
1868
1868
1869 $ hg rebase -s 1 -d 5
1869 $ hg rebase -s 1 -d 5
1870 rebasing 1:d2ae7f538514 "b"
1870 rebasing 1:d2ae7f538514 "b"
1871 rebasing 2:177f92b77385 "c"
1871 rebasing 2:177f92b77385 "c"
1872 rebasing 3:055a42cdd887 "d"
1872 rebasing 3:055a42cdd887 "d"
1873 merging d
1873 merging d
1874 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1874 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1875 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1875 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1876 [1]
1876 [1]
1877 $ hg rebase --stop
1877 $ hg rebase --stop
1878 1 new orphan changesets
1878 1 new orphan changesets
1879 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1879 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1880 o 7:7fffad344617 test
1880 o 7:7fffad344617 test
1881 | c
1881 | c
1882 |
1882 |
1883 o 6:b15528633407 test
1883 o 6:b15528633407 test
1884 | b
1884 | b
1885 |
1885 |
1886 o 5:00bfc9898aeb test
1886 o 5:00bfc9898aeb test
1887 | conflict with d
1887 | conflict with d
1888 |
1888 |
1889 o 4:dafd40200f93 test
1889 o 4:dafd40200f93 test
1890 | f
1890 | f
1891 |
1891 |
1892 | @ 3:055a42cdd887 test
1892 | @ 3:055a42cdd887 test
1893 | | d
1893 | | d
1894 | |
1894 | |
1895 | x 2:177f92b77385 test
1895 | x 2:177f92b77385 test
1896 | | c
1896 | | c
1897 | |
1897 | |
1898 | x 1:d2ae7f538514 test
1898 | x 1:d2ae7f538514 test
1899 |/ b
1899 |/ b
1900 |
1900 |
1901 o 0:cb9a9f314b8b test
1901 o 0:cb9a9f314b8b test
1902 a
1902 a
1903
1903
1904 Test it aborts if unstable csets is not allowed:
1904 Test it aborts if unstable csets is not allowed:
1905 ===============================================
1905 ===============================================
1906 $ cat >> $HGRCPATH << EOF
1906 $ cat >> $HGRCPATH << EOF
1907 > [experimental]
1907 > [experimental]
1908 > evolution.allowunstable=False
1908 > evolution.allowunstable=False
1909 > EOF
1909 > EOF
1910
1910
1911 $ hg strip 6 --no-backup -q
1911 $ hg strip 6 --no-backup -q
1912 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1912 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1913 o 5:00bfc9898aeb test
1913 o 5:00bfc9898aeb test
1914 | conflict with d
1914 | conflict with d
1915 |
1915 |
1916 o 4:dafd40200f93 test
1916 o 4:dafd40200f93 test
1917 | f
1917 | f
1918 |
1918 |
1919 | @ 3:055a42cdd887 test
1919 | @ 3:055a42cdd887 test
1920 | | d
1920 | | d
1921 | |
1921 | |
1922 | o 2:177f92b77385 test
1922 | o 2:177f92b77385 test
1923 | | c
1923 | | c
1924 | |
1924 | |
1925 | o 1:d2ae7f538514 test
1925 | o 1:d2ae7f538514 test
1926 |/ b
1926 |/ b
1927 |
1927 |
1928 o 0:cb9a9f314b8b test
1928 o 0:cb9a9f314b8b test
1929 a
1929 a
1930
1930
1931 $ hg rebase -s 1 -d 5
1931 $ hg rebase -s 1 -d 5
1932 rebasing 1:d2ae7f538514 "b"
1932 rebasing 1:d2ae7f538514 "b"
1933 rebasing 2:177f92b77385 "c"
1933 rebasing 2:177f92b77385 "c"
1934 rebasing 3:055a42cdd887 "d"
1934 rebasing 3:055a42cdd887 "d"
1935 merging d
1935 merging d
1936 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1936 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1937 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1937 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1938 [1]
1938 [1]
1939 $ hg rebase --stop
1939 $ hg rebase --stop
1940 abort: cannot remove original changesets with unrebased descendants
1940 abort: cannot remove original changesets with unrebased descendants
1941 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1941 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets)
1942 [255]
1942 [255]
1943 $ hg rebase --abort
1943 $ hg rebase --abort
1944 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1944 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1945 rebase aborted
1945 rebase aborted
1946
1946
1947 Test --stop when --keep is passed:
1947 Test --stop when --keep is passed:
1948 ==================================
1948 ==================================
1949 $ hg rebase -s 1 -d 5 --keep
1949 $ hg rebase -s 1 -d 5 --keep
1950 rebasing 1:d2ae7f538514 "b"
1950 rebasing 1:d2ae7f538514 "b"
1951 rebasing 2:177f92b77385 "c"
1951 rebasing 2:177f92b77385 "c"
1952 rebasing 3:055a42cdd887 "d"
1952 rebasing 3:055a42cdd887 "d"
1953 merging d
1953 merging d
1954 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1954 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1955 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1955 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
1956 [1]
1956 [1]
1957 $ hg rebase --stop
1957 $ hg rebase --stop
1958 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1958 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1959 o 7:7fffad344617 test
1959 o 7:7fffad344617 test
1960 | c
1960 | c
1961 |
1961 |
1962 o 6:b15528633407 test
1962 o 6:b15528633407 test
1963 | b
1963 | b
1964 |
1964 |
1965 o 5:00bfc9898aeb test
1965 o 5:00bfc9898aeb test
1966 | conflict with d
1966 | conflict with d
1967 |
1967 |
1968 o 4:dafd40200f93 test
1968 o 4:dafd40200f93 test
1969 | f
1969 | f
1970 |
1970 |
1971 | @ 3:055a42cdd887 test
1971 | @ 3:055a42cdd887 test
1972 | | d
1972 | | d
1973 | |
1973 | |
1974 | o 2:177f92b77385 test
1974 | o 2:177f92b77385 test
1975 | | c
1975 | | c
1976 | |
1976 | |
1977 | o 1:d2ae7f538514 test
1977 | o 1:d2ae7f538514 test
1978 |/ b
1978 |/ b
1979 |
1979 |
1980 o 0:cb9a9f314b8b test
1980 o 0:cb9a9f314b8b test
1981 a
1981 a
1982
1982
1983 Test --stop aborts when --collapse was passed:
1983 Test --stop aborts when --collapse was passed:
1984 =============================================
1984 =============================================
1985 $ cat >> $HGRCPATH << EOF
1985 $ cat >> $HGRCPATH << EOF
1986 > [experimental]
1986 > [experimental]
1987 > evolution.allowunstable=True
1987 > evolution.allowunstable=True
1988 > EOF
1988 > EOF
1989
1989
1990 $ hg strip 6
1990 $ hg strip 6
1991 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1991 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg
1992 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1992 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
1993 o 5:00bfc9898aeb test
1993 o 5:00bfc9898aeb test
1994 | conflict with d
1994 | conflict with d
1995 |
1995 |
1996 o 4:dafd40200f93 test
1996 o 4:dafd40200f93 test
1997 | f
1997 | f
1998 |
1998 |
1999 | @ 3:055a42cdd887 test
1999 | @ 3:055a42cdd887 test
2000 | | d
2000 | | d
2001 | |
2001 | |
2002 | o 2:177f92b77385 test
2002 | o 2:177f92b77385 test
2003 | | c
2003 | | c
2004 | |
2004 | |
2005 | o 1:d2ae7f538514 test
2005 | o 1:d2ae7f538514 test
2006 |/ b
2006 |/ b
2007 |
2007 |
2008 o 0:cb9a9f314b8b test
2008 o 0:cb9a9f314b8b test
2009 a
2009 a
2010
2010
2011 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2011 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d"
2012 rebasing 1:d2ae7f538514 "b"
2012 rebasing 1:d2ae7f538514 "b"
2013 rebasing 2:177f92b77385 "c"
2013 rebasing 2:177f92b77385 "c"
2014 rebasing 3:055a42cdd887 "d"
2014 rebasing 3:055a42cdd887 "d"
2015 merging d
2015 merging d
2016 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2016 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2017 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2017 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2018 [1]
2018 [1]
2019 $ hg rebase --stop
2019 $ hg rebase --stop
2020 abort: cannot stop in --collapse session
2020 abort: cannot stop in --collapse session
2021 [255]
2021 [255]
2022 $ hg rebase --abort
2022 $ hg rebase --abort
2023 rebase aborted
2023 rebase aborted
2024 $ hg diff
2024 $ hg diff
2025 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2025 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
2026 o 5:00bfc9898aeb test
2026 o 5:00bfc9898aeb test
2027 | conflict with d
2027 | conflict with d
2028 |
2028 |
2029 o 4:dafd40200f93 test
2029 o 4:dafd40200f93 test
2030 | f
2030 | f
2031 |
2031 |
2032 | @ 3:055a42cdd887 test
2032 | @ 3:055a42cdd887 test
2033 | | d
2033 | | d
2034 | |
2034 | |
2035 | o 2:177f92b77385 test
2035 | o 2:177f92b77385 test
2036 | | c
2036 | | c
2037 | |
2037 | |
2038 | o 1:d2ae7f538514 test
2038 | o 1:d2ae7f538514 test
2039 |/ b
2039 |/ b
2040 |
2040 |
2041 o 0:cb9a9f314b8b test
2041 o 0:cb9a9f314b8b test
2042 a
2042 a
2043
2043
2044 Test --stop raise errors with conflicting options:
2044 Test --stop raise errors with conflicting options:
2045 =================================================
2045 =================================================
2046 $ hg rebase -s 3 -d 5
2046 $ hg rebase -s 3 -d 5
2047 rebasing 3:055a42cdd887 "d"
2047 rebasing 3:055a42cdd887 "d"
2048 merging d
2048 merging d
2049 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2049 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2050 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2050 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2051 [1]
2051 [1]
2052 $ hg rebase --stop --dry-run
2052 $ hg rebase --stop --dry-run
2053 abort: cannot specify both --stop and --dry-run
2053 abort: cannot specify both --stop and --dry-run
2054 [255]
2054 [255]
2055
2055
2056 $ hg rebase -s 3 -d 5
2056 $ hg rebase -s 3 -d 5
2057 abort: rebase in progress
2057 abort: rebase in progress
2058 (use 'hg rebase --continue' or 'hg rebase --abort')
2058 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
2059 [255]
2059 [255]
2060 $ hg rebase --stop --continue
2060 $ hg rebase --stop --continue
2061 abort: cannot specify both --stop and --continue
2061 abort: cannot specify both --stop and --continue
2062 [255]
2062 [255]
2063
2063
2064 Test --stop moves bookmarks of original revisions to new rebased nodes:
2064 Test --stop moves bookmarks of original revisions to new rebased nodes:
2065 ======================================================================
2065 ======================================================================
2066 $ cd ..
2066 $ cd ..
2067 $ hg init repo
2067 $ hg init repo
2068 $ cd repo
2068 $ cd repo
2069
2069
2070 $ echo a > a
2070 $ echo a > a
2071 $ hg ci -Am A
2071 $ hg ci -Am A
2072 adding a
2072 adding a
2073
2073
2074 $ echo b > b
2074 $ echo b > b
2075 $ hg ci -Am B
2075 $ hg ci -Am B
2076 adding b
2076 adding b
2077 $ hg book X
2077 $ hg book X
2078 $ hg book Y
2078 $ hg book Y
2079
2079
2080 $ echo c > c
2080 $ echo c > c
2081 $ hg ci -Am C
2081 $ hg ci -Am C
2082 adding c
2082 adding c
2083 $ hg book Z
2083 $ hg book Z
2084
2084
2085 $ echo d > d
2085 $ echo d > d
2086 $ hg ci -Am D
2086 $ hg ci -Am D
2087 adding d
2087 adding d
2088
2088
2089 $ hg up 0 -q
2089 $ hg up 0 -q
2090 $ echo e > e
2090 $ echo e > e
2091 $ hg ci -Am E
2091 $ hg ci -Am E
2092 adding e
2092 adding e
2093 created new head
2093 created new head
2094
2094
2095 $ echo doubt > d
2095 $ echo doubt > d
2096 $ hg ci -Am "conflict with d"
2096 $ hg ci -Am "conflict with d"
2097 adding d
2097 adding d
2098
2098
2099 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2099 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2100 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2100 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2101 |
2101 |
2102 o 4: 9c1e55f411b6 'E' bookmarks:
2102 o 4: 9c1e55f411b6 'E' bookmarks:
2103 |
2103 |
2104 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2104 | o 3: 67a385d4e6f2 'D' bookmarks: Z
2105 | |
2105 | |
2106 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2106 | o 2: 49cb3485fa0c 'C' bookmarks: Y
2107 | |
2107 | |
2108 | o 1: 6c81ed0049f8 'B' bookmarks: X
2108 | o 1: 6c81ed0049f8 'B' bookmarks: X
2109 |/
2109 |/
2110 o 0: 1994f17a630e 'A' bookmarks:
2110 o 0: 1994f17a630e 'A' bookmarks:
2111
2111
2112 $ hg rebase -s 1 -d 5
2112 $ hg rebase -s 1 -d 5
2113 rebasing 1:6c81ed0049f8 "B" (X)
2113 rebasing 1:6c81ed0049f8 "B" (X)
2114 rebasing 2:49cb3485fa0c "C" (Y)
2114 rebasing 2:49cb3485fa0c "C" (Y)
2115 rebasing 3:67a385d4e6f2 "D" (Z)
2115 rebasing 3:67a385d4e6f2 "D" (Z)
2116 merging d
2116 merging d
2117 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2117 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
2118 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2118 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
2119 [1]
2119 [1]
2120 $ hg rebase --stop
2120 $ hg rebase --stop
2121 1 new orphan changesets
2121 1 new orphan changesets
2122 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2122 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n"
2123 o 7: 9c86c650b686 'C' bookmarks: Y
2123 o 7: 9c86c650b686 'C' bookmarks: Y
2124 |
2124 |
2125 o 6: 9b87b54e5fd8 'B' bookmarks: X
2125 o 6: 9b87b54e5fd8 'B' bookmarks: X
2126 |
2126 |
2127 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2127 @ 5: 39adf30bc1be 'conflict with d' bookmarks:
2128 |
2128 |
2129 o 4: 9c1e55f411b6 'E' bookmarks:
2129 o 4: 9c1e55f411b6 'E' bookmarks:
2130 |
2130 |
2131 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2131 | * 3: 67a385d4e6f2 'D' bookmarks: Z
2132 | |
2132 | |
2133 | x 2: 49cb3485fa0c 'C' bookmarks:
2133 | x 2: 49cb3485fa0c 'C' bookmarks:
2134 | |
2134 | |
2135 | x 1: 6c81ed0049f8 'B' bookmarks:
2135 | x 1: 6c81ed0049f8 'B' bookmarks:
2136 |/
2136 |/
2137 o 0: 1994f17a630e 'A' bookmarks:
2137 o 0: 1994f17a630e 'A' bookmarks:
2138
2138
General Comments 0
You need to be logged in to leave comments. Login now