reverting changes nondestructively
Faheem Mitha
faheem at email.unc.edu
Fri Dec 2 02:24:21 UTC 2005
On Thu, 1 Dec 2005, Robin Farine wrote:
> Hi,
>
> On Thursday December 1 2005 04:53, Faheem Mitha wrote:
>
>> However, I want to reverse the last change without removing n+1.
>> In other words, I want to make a commit n+2 so that the diff from
>> n+1 to n+2 is the reverse diff from n to n+1, and revision n+2 is
>> the same as n.
>
> You can revert a clean tree at changeset n+1 to the state it had at
> changeset n using "hg revert -r n" and then commit using "hg commit
> -A ...". You need commit -A because "hg revert" does not mark the
> files it resurrects as tracked (at least the version I am using
> does not).
This (hg revert) appears to work, but I'm puzzled. The man page says it
reverts any uncommitted modifications. In that case, if the modification
has been made, it should be a no-op.
I must be missing something, because if that is correct, then
specifying a revision is clearly redundant.
BTW, does hg have any concept like svn about having the working
directory be at a particular revision?
Thanks. Faheem.
*************************************************************************
revert [names ...]
Revert any uncommitted modifications made to the named
files or directories. This restores the contents of the affected files
to an unmodified state.
If a file has been deleted, it is recreated. If the
executable mode of a file was changed, it is reset.
If a directory is given, all files in that directory and its
subdirectories are reverted.
If no arguments are given, all files in the current
directory and its subdirectories are reverted.
options:
-r, --rev <rev> revision to revert to
-n, --nonrecursive do not recurse into subdirectories
More information about the Mercurial
mailing list