Mercurial > hg-stable
comparison tests/test-debugcomplete.t @ 15183:59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
You can get into trouble if you commit, update back to an older
changeset, and then rollback. The update removes your valuable changes
from the working dir, then rollback removes them history. Oops: you've
just irretrievably lost data running nothing but core Mercurial
commands. (More subtly: rollback from a shared clone that was already
at an older changeset -- no update required, just rollback from the
wrong directory.)
The fix assumes that only "commit" transactions have irreplaceable
data, and allows rolling back non-commit transactions as always. But
when rolling back a commit, check that the working dir is checked out
to tip, i.e. the changeset we're about to destroy. If not, abort. You
can get back the old (dangerous) behaviour with --force.
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Fri, 30 Sep 2011 21:58:54 -0400 |
parents | cac04f2f475b |
children | 269374b89b74 |
comparison
equal
deleted
inserted
replaced
15182:de496752d936 | 15183:59e8bc22506e |
---|---|
255 paths: | 255 paths: |
256 recover: | 256 recover: |
257 rename: after, force, include, exclude, dry-run | 257 rename: after, force, include, exclude, dry-run |
258 resolve: all, list, mark, unmark, no-status, tool, include, exclude | 258 resolve: all, list, mark, unmark, no-status, tool, include, exclude |
259 revert: all, date, rev, no-backup, include, exclude, dry-run | 259 revert: all, date, rev, no-backup, include, exclude, dry-run |
260 rollback: dry-run | 260 rollback: dry-run, force |
261 root: | 261 root: |
262 showconfig: untrusted | 262 showconfig: untrusted |
263 tag: force, local, rev, remove, edit, message, date, user | 263 tag: force, local, rev, remove, edit, message, date, user |
264 tags: | 264 tags: |
265 tip: patch, git, style, template | 265 tip: patch, git, style, template |