Show More
@@ -204,17 +204,26 b' def archive(ui, repo, dest, **opts):' | |||||
204 | def backout(ui, repo, node=None, rev=None, **opts): |
|
204 | def backout(ui, repo, node=None, rev=None, **opts): | |
205 | '''reverse effect of earlier changeset |
|
205 | '''reverse effect of earlier changeset | |
206 |
|
206 | |||
207 | Commit the backed out changes as a new changeset. The new |
|
207 | The backout command merges the reverse effect of the reverted | |
208 | changeset is a child of the backed out changeset. |
|
208 | changeset into the working directory. | |
209 |
|
209 | |||
210 | If you backout a changeset other than the tip, a new head is |
|
210 | With the --merge option, it first commits the reverted changes | |
211 | created. This head will be the new tip and you should merge this |
|
211 | as a new changeset. This new changeset is a child of the reverted | |
212 | backout changeset with another head. |
|
212 | changeset. | |
213 |
|
||||
214 | The --merge option remembers the parent of the working directory |
|
213 | The --merge option remembers the parent of the working directory | |
215 | before starting the backout, then merges the new head with that |
|
214 | before starting the backout, then merges the new head with that | |
216 | changeset afterwards. This saves you from doing the merge by hand. |
|
215 | changeset afterwards. | |
217 | The result of this merge is not committed, as with a normal merge. |
|
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 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
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 | revert_opts['rev'] = hex(parent) |
|
277 | revert_opts['rev'] = hex(parent) | |
269 | revert_opts['no_backup'] = None |
|
278 | revert_opts['no_backup'] = None | |
270 | revert(ui, repo, **revert_opts) |
|
279 | revert(ui, repo, **revert_opts) | |
|
280 | if not opts.get('merge') and op1 != node: | |||
|
281 | return hg.update(repo, op1) | |||
|
282 | ||||
271 | commit_opts = opts.copy() |
|
283 | commit_opts = opts.copy() | |
272 | commit_opts['addremove'] = False |
|
284 | commit_opts['addremove'] = False | |
273 | if not commit_opts['message'] and not commit_opts['logfile']: |
|
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 | return '%d:%s' % (repo.changelog.rev(node), short(node)) |
|
291 | return '%d:%s' % (repo.changelog.rev(node), short(node)) | |
280 | ui.status(_('changeset %s backs out changeset %s\n') % |
|
292 | ui.status(_('changeset %s backs out changeset %s\n') % | |
281 | (nice(repo.changelog.tip()), nice(node))) |
|
293 | (nice(repo.changelog.tip()), nice(node))) | |
282 | if op1 != node: |
|
294 | if opts.get('merge') and op1 != node: | |
283 | hg.clean(repo, op1, show_stats=False) |
|
295 | hg.clean(repo, op1, show_stats=False) | |
284 | if opts.get('merge'): |
|
|||
285 | ui.status(_('merging with changeset %s\n') |
|
296 | ui.status(_('merging with changeset %s\n') | |
286 | % nice(repo.changelog.tip())) |
|
297 | % nice(repo.changelog.tip())) | |
287 |
|
|
298 | return hg.merge(repo, hex(repo.changelog.tip())) | |
288 | else: |
|
299 | return 0 | |
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')) |
|
|||
293 |
|
300 | |||
294 | def bisect(ui, repo, rev=None, extra=None, command=None, |
|
301 | def bisect(ui, repo, rev=None, extra=None, command=None, | |
295 | reset=None, good=None, bad=None, skip=None, noupdate=None): |
|
302 | reset=None, good=None, bad=None, skip=None, noupdate=None): |
@@ -39,7 +39,7 b' file that was removed is recreated' | |||||
39 | $ hg rm a |
|
39 | $ hg rm a | |
40 | $ hg commit -d '1 0' -m b |
|
40 | $ hg commit -d '1 0' -m b | |
41 |
|
41 | |||
42 |
$ hg backout -d '2 0' |
|
42 | $ hg backout -d '2 0' tip | |
43 | adding a |
|
43 | adding a | |
44 | changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 |
|
44 | changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372 | |
45 | $ cat a |
|
45 | $ cat a | |
@@ -131,12 +131,26 b' backout should not back out subsequent c' | |||||
131 | $ echo 1 > b |
|
131 | $ echo 1 > b | |
132 | $ hg commit -d '2 0' -A -m c |
|
132 | $ hg commit -d '2 0' -A -m c | |
133 | adding b |
|
133 | adding b | |
|
134 | ||||
|
135 | without --merge | |||
134 | $ hg backout -d '3 0' 1 |
|
136 | $ hg backout -d '3 0' 1 | |
135 | reverting a |
|
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 | created new head |
|
149 | created new head | |
137 | changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 |
|
150 | changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5 | |
138 | the backout changeset is a new head - do not forget to merge |
|
151 | merging with changeset 3:3202beb76721 | |
139 | (use "backout --merge" if you want to auto-merge) |
|
152 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
153 | (branch merge, don't forget to commit) | |||
140 | $ hg locate b |
|
154 | $ hg locate b | |
141 | b |
|
155 | b | |
142 | $ hg update -C tip |
|
156 | $ hg update -C tip | |
@@ -220,14 +234,28 b' named branches' | |||||
220 | $ echo branch2 > file2 |
|
234 | $ echo branch2 > file2 | |
221 |
$ |
|
235 | $ hg ci -d '2 0' -Am file2 | |
222 | adding file2 |
|
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 | removing file1 |
|
252 | removing file1 | |
225 | created new head |
|
253 | created new head | |
226 | changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 |
|
254 | changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3 | |
227 | the backout changeset is a new head - do not forget to merge |
|
255 | merging with changeset 3:d4e8f6db59fb | |
228 | (use "backout --merge" if you want to auto-merge) |
|
256 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
229 |
|
257 | (branch merge, don't forget to commit) | ||
230 | XXX maybe backout shouldn't suggest a merge here as it is a different branch? |
|
258 | $ hg update -q -C 2 | |
231 |
|
259 | |||
232 | on branch2 with branch1 not merged, so file1 should still exist: |
|
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