Show More
@@ -2232,7 +2232,7 b' def rename(ui, repo, *pats, **opts):' | |||||
2232 | return errs |
|
2232 | return errs | |
2233 |
|
2233 | |||
2234 | def revert(ui, repo, *pats, **opts): |
|
2234 | def revert(ui, repo, *pats, **opts): | |
2235 |
"""revert |
|
2235 | """revert files or dirs to their states as of some revision | |
2236 |
|
2236 | |||
2237 | With no revision specified, revert the named files or directories |
|
2237 | With no revision specified, revert the named files or directories | |
2238 | to the contents they had in the parent of the working directory. |
|
2238 | to the contents they had in the parent of the working directory. | |
@@ -2361,6 +2361,35 b' def revert(ui, repo, *pats, **opts):' | |||||
2361 | repo.dirstate.update(remove[0], 'r') |
|
2361 | repo.dirstate.update(remove[0], 'r') | |
2362 | return r |
|
2362 | return r | |
2363 |
|
2363 | |||
|
2364 | def rollback(ui, repo): | |||
|
2365 | """roll back the last transaction in this repository | |||
|
2366 | ||||
|
2367 | Roll back the last transaction in this repository, restoring the | |||
|
2368 | project to its state prior to the transaction. | |||
|
2369 | ||||
|
2370 | Transactions are used to encapsulate the effects of all commands | |||
|
2371 | that create new changesets or propagate existing changesets into a | |||
|
2372 | repository. For example, the following commands are transactional, | |||
|
2373 | and their effects can be rolled back: | |||
|
2374 | ||||
|
2375 | commit | |||
|
2376 | import | |||
|
2377 | pull | |||
|
2378 | push (with this repository as destination) | |||
|
2379 | unbundle | |||
|
2380 | ||||
|
2381 | This command should be used with care. There is only one level of | |||
|
2382 | rollback, and there is no way to undo a rollback. | |||
|
2383 | ||||
|
2384 | This command is not intended for use on public repositories. Once | |||
|
2385 | changes are visible for pull by other users, rolling a transaction | |||
|
2386 | back locally is ineffective (someone else may already have pulled | |||
|
2387 | the changes). Furthermore, a race is possible with readers of the | |||
|
2388 | repository; for example an in-progress pull from the repository | |||
|
2389 | may fail if a rollback is performed. | |||
|
2390 | """ | |||
|
2391 | repo.undo() | |||
|
2392 | ||||
2364 | def root(ui, repo): |
|
2393 | def root(ui, repo): | |
2365 | """print the root (top) of the current working dir |
|
2394 | """print the root (top) of the current working dir | |
2366 |
|
2395 | |||
@@ -2676,19 +2705,12 b' def unbundle(ui, repo, fname, **opts):' | |||||
2676 | return postincoming(ui, repo, modheads, opts['update']) |
|
2705 | return postincoming(ui, repo, modheads, opts['update']) | |
2677 |
|
2706 | |||
2678 | def undo(ui, repo): |
|
2707 | def undo(ui, repo): | |
2679 | """undo the last commit or pull |
|
2708 | """undo the last commit or pull (DEPRECATED) | |
2680 |
|
2709 | |||
2681 | Roll back the last pull or commit transaction on the |
|
2710 | (DEPRECATED) | |
2682 | repository, restoring the project to its earlier state. |
|
2711 | This command is now deprecated and will be removed in a future | |
2683 |
|
2712 | release. Please use the rollback command instead. For usage | ||
2684 | This command should be used with care. There is only one level of |
|
2713 | instructions, see the rollback command. | |
2685 | undo and there is no redo. |
|
|||
2686 |
|
||||
2687 | This command is not intended for use on public repositories. Once |
|
|||
2688 | a change is visible for pull by other users, undoing it locally is |
|
|||
2689 | ineffective. Furthemore a race is possible with readers of the |
|
|||
2690 | repository, for example an ongoing pull from the repository will |
|
|||
2691 | fail and rollback. |
|
|||
2692 | """ |
|
2714 | """ | |
2693 | repo.undo() |
|
2715 | repo.undo() | |
2694 |
|
2716 | |||
@@ -3018,6 +3040,7 b' table = {' | |||||
3018 | ('I', 'include', [], _('include names matching given patterns')), |
|
3040 | ('I', 'include', [], _('include names matching given patterns')), | |
3019 | ('X', 'exclude', [], _('exclude names matching given patterns'))], |
|
3041 | ('X', 'exclude', [], _('exclude names matching given patterns'))], | |
3020 | _('hg revert [-r REV] [NAME]...')), |
|
3042 | _('hg revert [-r REV] [NAME]...')), | |
|
3043 | "rollback": (rollback, [], _('hg rollback')), | |||
3021 | "root": (root, [], _('hg root')), |
|
3044 | "root": (root, [], _('hg root')), | |
3022 | "^serve": |
|
3045 | "^serve": | |
3023 | (serve, |
|
3046 | (serve, |
@@ -121,7 +121,7 b' changeset entry gets added last. We keep' | |||||
121 | of each file touched and its length prior to the transaction. On |
|
121 | of each file touched and its length prior to the transaction. On | |
122 | abort, we simply truncate each file to its prior length. This is one |
|
122 | abort, we simply truncate each file to its prior length. This is one | |
123 | of the nice properties of the append-only structure of the revlogs. |
|
123 | of the nice properties of the append-only structure of the revlogs. | |
124 |
We can also reuse this journal for " |
|
124 | We can also reuse this journal for "rollback". | |
125 |
|
125 | |||
126 | Merging between repositories: |
|
126 | Merging between repositories: | |
127 |
|
127 |
@@ -81,7 +81,7 b" echo '[hooks]' > ../a/.hg/hgrc" | |||||
81 | echo 'preoutgoing = echo preoutgoing hook: s=$HG_SOURCE' >> ../a/.hg/hgrc |
|
81 | echo 'preoutgoing = echo preoutgoing hook: s=$HG_SOURCE' >> ../a/.hg/hgrc | |
82 | echo 'outgoing = echo outgoing hook: n=$HG_NODE s=$HG_SOURCE' >> ../a/.hg/hgrc |
|
82 | echo 'outgoing = echo outgoing hook: n=$HG_NODE s=$HG_SOURCE' >> ../a/.hg/hgrc | |
83 | hg pull ../a |
|
83 | hg pull ../a | |
84 | hg undo |
|
84 | hg rollback | |
85 |
|
85 | |||
86 | # preoutgoing hook can prevent outgoing changes |
|
86 | # preoutgoing hook can prevent outgoing changes | |
87 | echo 'preoutgoing.forbid = echo preoutgoing.forbid hook; exit 1' >> ../a/.hg/hgrc |
|
87 | echo 'preoutgoing.forbid = echo preoutgoing.forbid hook; exit 1' >> ../a/.hg/hgrc |
@@ -9,7 +9,7 b' hg commit -m "test" -d "1000000 0"' | |||||
9 | hg verify |
|
9 | hg verify | |
10 | hg parents |
|
10 | hg parents | |
11 | hg status |
|
11 | hg status | |
12 | hg undo |
|
12 | hg rollback | |
13 | hg verify |
|
13 | hg verify | |
14 | hg parents |
|
14 | hg parents | |
15 | hg status |
|
15 | hg status |
1 | NO CONTENT: file renamed from tests/test-undo.out to tests/test-rollback.out |
|
NO CONTENT: file renamed from tests/test-undo.out to tests/test-rollback.out |
General Comments 0
You need to be logged in to leave comments.
Login now