# HG changeset patch # User Vadim Gelfer # Date 1147123237 25200 # Node ID 8b106ff5b8a980b1d76a8ee66461a4b6a35243a0 # Parent 4f072bb06e897e6e032821d79621073277943403# Parent b72562060e45ddca95a25a85f00e35bf598c69dd merge with mainline. diff -r b72562060e45 -r 8b106ff5b8a9 hgext/notify.py --- a/hgext/notify.py Mon May 08 14:32:43 2006 -0500 +++ b/hgext/notify.py Mon May 08 14:20:37 2006 -0700 @@ -210,6 +210,7 @@ msg['Message-Id'] = ('' % (short(node), int(time.time()), hash(self.repo.root), socket.getfqdn())) + msg['To'] = self.subs msgtext = msg.as_string(0) if self.ui.configbool('notify', 'test', True): @@ -225,7 +226,8 @@ if maxdiff == 0: return fp = templater.stringio() - commands.dodiff(fp, self.ui, self.repo, node, + prev = self.repo.changelog.parents(node)[0] + commands.dodiff(fp, self.ui, self.repo, prev, self.repo.changelog.tip()) difflines = fp.getvalue().splitlines(1) if maxdiff > 0 and len(difflines) > maxdiff: diff -r b72562060e45 -r 8b106ff5b8a9 mercurial/commands.py --- a/mercurial/commands.py Mon May 08 14:32:43 2006 -0500 +++ b/mercurial/commands.py Mon May 08 14:20:37 2006 -0700 @@ -2232,7 +2232,7 @@ return errs def revert(ui, repo, *pats, **opts): - """revert modified files or dirs to their states as of some revision + """revert files or dirs to their states as of some revision With no revision specified, revert the named files or directories to the contents they had in the parent of the working directory. @@ -2361,6 +2361,35 @@ repo.dirstate.update(remove[0], 'r') return r +def rollback(ui, repo): + """roll back the last transaction in this repository + + Roll back the last transaction in this repository, restoring the + project to its state prior to the transaction. + + Transactions are used to encapsulate the effects of all commands + that create new changesets or propagate existing changesets into a + repository. For example, the following commands are transactional, + and their effects can be rolled back: + + commit + import + pull + push (with this repository as destination) + unbundle + + This command should be used with care. There is only one level of + rollback, and there is no way to undo a rollback. + + This command is not intended for use on public repositories. Once + changes are visible for pull by other users, rolling a transaction + back locally is ineffective (someone else may already have pulled + the changes). Furthermore, a race is possible with readers of the + repository; for example an in-progress pull from the repository + may fail if a rollback is performed. + """ + repo.undo() + def root(ui, repo): """print the root (top) of the current working dir @@ -2676,19 +2705,12 @@ return postincoming(ui, repo, modheads, opts['update']) def undo(ui, repo): - """undo the last commit or pull - - Roll back the last pull or commit transaction on the - repository, restoring the project to its earlier state. - - This command should be used with care. There is only one level of - undo and there is no redo. - - This command is not intended for use on public repositories. Once - a change is visible for pull by other users, undoing it locally is - ineffective. Furthemore a race is possible with readers of the - repository, for example an ongoing pull from the repository will - fail and rollback. + """undo the last commit or pull (DEPRECATED) + + (DEPRECATED) + This command is now deprecated and will be removed in a future + release. Please use the rollback command instead. For usage + instructions, see the rollback command. """ repo.undo() @@ -3018,6 +3040,7 @@ ('I', 'include', [], _('include names matching given patterns')), ('X', 'exclude', [], _('exclude names matching given patterns'))], _('hg revert [-r REV] [NAME]...')), + "rollback": (rollback, [], _('hg rollback')), "root": (root, [], _('hg root')), "^serve": (serve, diff -r b72562060e45 -r 8b106ff5b8a9 notes.txt --- a/notes.txt Mon May 08 14:32:43 2006 -0500 +++ b/notes.txt Mon May 08 14:20:37 2006 -0700 @@ -121,7 +121,7 @@ of each file touched and its length prior to the transaction. On abort, we simply truncate each file to its prior length. This is one of the nice properties of the append-only structure of the revlogs. -We can also reuse this journal for "undo". +We can also reuse this journal for "rollback". Merging between repositories: diff -r b72562060e45 -r 8b106ff5b8a9 tests/test-help.out --- a/tests/test-help.out Mon May 08 14:32:43 2006 -0500 +++ b/tests/test-help.out Mon May 08 14:20:37 2006 -0700 @@ -14,7 +14,7 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - revert revert modified files or dirs to their states as of some revision + revert revert files or dirs to their states as of some revision serve export the repository via HTTP status show changed files in the working directory update update or merge working directory @@ -30,7 +30,7 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - revert revert modified files or dirs to their states as of some revision + revert revert files or dirs to their states as of some revision serve export the repository via HTTP status show changed files in the working directory update update or merge working directory @@ -68,7 +68,8 @@ recover roll back an interrupted transaction remove remove the specified files on the next commit rename rename files; equivalent of copy + remove - revert revert modified files or dirs to their states as of some revision + revert revert files or dirs to their states as of some revision + rollback roll back the last transaction in this repository root print the root (top) of the current working dir serve export the repository via HTTP status show changed files in the working directory @@ -76,7 +77,7 @@ tags list repository tags tip show the tip revision unbundle apply a changegroup file - undo undo the last commit or pull + undo undo the last commit or pull (DEPRECATED) update update or merge working directory verify verify the integrity of the repository version output version and copyright information @@ -110,7 +111,8 @@ recover roll back an interrupted transaction remove remove the specified files on the next commit rename rename files; equivalent of copy + remove - revert revert modified files or dirs to their states as of some revision + revert revert files or dirs to their states as of some revision + rollback roll back the last transaction in this repository root print the root (top) of the current working dir serve export the repository via HTTP status show changed files in the working directory @@ -118,7 +120,7 @@ tags list repository tags tip show the tip revision unbundle apply a changegroup file - undo undo the last commit or pull + undo undo the last commit or pull (DEPRECATED) update update or merge working directory verify verify the integrity of the repository version output version and copyright information @@ -226,7 +228,7 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - revert revert modified files or dirs to their states as of some revision + revert revert files or dirs to their states as of some revision serve export the repository via HTTP status show changed files in the working directory update update or merge working directory @@ -247,7 +249,7 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - revert revert modified files or dirs to their states as of some revision + revert revert files or dirs to their states as of some revision serve export the repository via HTTP status show changed files in the working directory update update or merge working directory diff -r b72562060e45 -r 8b106ff5b8a9 tests/test-hook --- a/tests/test-hook Mon May 08 14:32:43 2006 -0500 +++ b/tests/test-hook Mon May 08 14:20:37 2006 -0700 @@ -81,7 +81,7 @@ echo 'preoutgoing = echo preoutgoing hook: s=$HG_SOURCE' >> ../a/.hg/hgrc echo 'outgoing = echo outgoing hook: n=$HG_NODE s=$HG_SOURCE' >> ../a/.hg/hgrc hg pull ../a -hg undo +hg rollback # preoutgoing hook can prevent outgoing changes echo 'preoutgoing.forbid = echo preoutgoing.forbid hook; exit 1' >> ../a/.hg/hgrc diff -r b72562060e45 -r 8b106ff5b8a9 tests/test-rollback --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rollback Mon May 08 14:20:37 2006 -0700 @@ -0,0 +1,15 @@ +#!/bin/sh + +mkdir t +cd t +hg init +echo a > a +hg add a +hg commit -m "test" -d "1000000 0" +hg verify +hg parents +hg status +hg rollback +hg verify +hg parents +hg status diff -r b72562060e45 -r 8b106ff5b8a9 tests/test-rollback.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rollback.out Mon May 08 14:20:37 2006 -0700 @@ -0,0 +1,18 @@ +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +1 files, 1 changesets, 1 total revisions +changeset: 0:0acdaf898367 +tag: tip +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: test + +rolling back last transaction +checking changesets +checking manifests +crosschecking files in changesets and manifests +checking files +0 files, 0 changesets, 0 total revisions +A a diff -r b72562060e45 -r 8b106ff5b8a9 tests/test-undo --- a/tests/test-undo Mon May 08 14:32:43 2006 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh - -mkdir t -cd t -hg init -echo a > a -hg add a -hg commit -m "test" -d "1000000 0" -hg verify -hg parents -hg status -hg undo -hg verify -hg parents -hg status diff -r b72562060e45 -r 8b106ff5b8a9 tests/test-undo.out --- a/tests/test-undo.out Mon May 08 14:32:43 2006 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -1 files, 1 changesets, 1 total revisions -changeset: 0:0acdaf898367 -tag: tip -user: test -date: Mon Jan 12 13:46:40 1970 +0000 -summary: test - -rolling back last transaction -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -0 files, 0 changesets, 0 total revisions -A a