##// END OF EJS Templates
backout: provide linear backout as a default (without --merge option)...
Gilles Moris -
r12727:52971985 default
parent child Browse files
Show More
@@ -204,17 +204,26 b' def archive(ui, repo, dest, **opts):'
204 204 def backout(ui, repo, node=None, rev=None, **opts):
205 205 '''reverse effect of earlier changeset
206 206
207 Commit the backed out changes as a new changeset. The new
208 changeset is a child of the backed out changeset.
209
210 If you backout a changeset other than the tip, a new head is
211 created. This head will be the new tip and you should merge this
212 backout changeset with another head.
213
207 The backout command merges the reverse effect of the reverted
208 changeset into the working directory.
209
210 With the --merge option, it first commits the reverted changes
211 as a new changeset. This new changeset is a child of the reverted
212 changeset.
214 213 The --merge option remembers the parent of the working directory
215 214 before starting the backout, then merges the new head with that
216 changeset afterwards. This saves you from doing the merge by hand.
217 The result of this merge is not committed, as with a normal merge.
215 changeset afterwards.
216 This will result in an explicit merge in the history.
217
218 If you backout a changeset other than the original parent of the
219 working directory, the result of this merge is not committed,
220 as with a normal merge. Otherwise, no merge is needed and the
221 commit is automatic.
222
223 Note that the default behavior (without --merge) has changed in
224 version 1.7. To restore the previous default behavior, use
225 :hg:`backout --merge` and then :hg:`update --clean .` to get rid of
226 the ongoing merge.
218 227
219 228 See :hg:`help dates` for a list of formats valid for -d/--date.
220 229
@@ -268,6 +277,9 b' def backout(ui, repo, node=None, rev=Non'
268 277 revert_opts['rev'] = hex(parent)
269 278 revert_opts['no_backup'] = None
270 279 revert(ui, repo, **revert_opts)
280 if not opts.get('merge') and op1 != node:
281 return hg.update(repo, op1)
282
271 283 commit_opts = opts.copy()
272 284 commit_opts['addremove'] = False
273 285 if not commit_opts['message'] and not commit_opts['logfile']:
@@ -279,17 +291,12 b' def backout(ui, repo, node=None, rev=Non'
279 291 return '%d:%s' % (repo.changelog.rev(node), short(node))
280 292 ui.status(_('changeset %s backs out changeset %s\n') %
281 293 (nice(repo.changelog.tip()), nice(node)))
282 if op1 != node:
294 if opts.get('merge') and op1 != node:
283 295 hg.clean(repo, op1, show_stats=False)
284 if opts.get('merge'):
285 296 ui.status(_('merging with changeset %s\n')
286 297 % nice(repo.changelog.tip()))
287 hg.merge(repo, hex(repo.changelog.tip()))
288 else:
289 ui.status(_('the backout changeset is a new head - '
290 'do not forget to merge\n'))
291 ui.status(_('(use "backout --merge" '
292 'if you want to auto-merge)\n'))
298 return hg.merge(repo, hex(repo.changelog.tip()))
299 return 0
293 300
294 301 def bisect(ui, repo, rev=None, extra=None, command=None,
295 302 reset=None, good=None, bad=None, skip=None, noupdate=None):
@@ -39,7 +39,7 b' file that was removed is recreated'
39 39 $ hg rm a
40 40 $ hg commit -d '1 0' -m b
41 41
42 $ hg backout -d '2 0' --merge tip
42 $ hg backout -d '2 0' tip
43 43 adding a
44 44 changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372
45 45 $ cat a
@@ -131,12 +131,26 b' backout should not back out subsequent c'
131 131 $ echo 1 > b
132 132 $ hg commit -d '2 0' -A -m c
133 133 adding b
134
135 without --merge
134 136 $ hg backout -d '3 0' 1
135 137 reverting a
138 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 $ hg locate b
140 b
141 $ hg update -C tip
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 $ hg locate b
144 b
145
146 with --merge
147 $ hg backout --merge -d '3 0' 1
148 reverting a
136 149 created new head
137 150 changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5
138 the backout changeset is a new head - do not forget to merge
139 (use "backout --merge" if you want to auto-merge)
151 merging with changeset 3:3202beb76721
152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 (branch merge, don't forget to commit)
140 154 $ hg locate b
141 155 b
142 156 $ hg update -C tip
@@ -220,14 +234,28 b' named branches'
220 234 $ echo branch2 > file2
221 235 $ hg ci -d '2 0' -Am file2
222 236 adding file2
223 $ hg backout -d '3 0' -r 1 -m 'backout on branch1'
237
238 without --merge
239 $ hg backout -r 1
240 removing file1
241 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 $ hg branch
243 branch2
244 $ hg status -A
245 R file1
246 C default
247 C file2
248
249 with --merge
250 $ hg update -qC
251 $ hg backout --merge -d '3 0' -r 1 -m 'backout on branch1'
224 252 removing file1
225 253 created new head
226 254 changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
227 the backout changeset is a new head - do not forget to merge
228 (use "backout --merge" if you want to auto-merge)
229
230 XXX maybe backout shouldn't suggest a merge here as it is a different branch?
255 merging with changeset 3:d4e8f6db59fb
256 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
257 (branch merge, don't forget to commit)
258 $ hg update -q -C 2
231 259
232 260 on branch2 with branch1 not merged, so file1 should still exist:
233 261
General Comments 0
You need to be logged in to leave comments. Login now