monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Re: Undo a commit


From: Daniel Carrera
Subject: Re: [Monotone-devel] Re: Undo a commit
Date: Fri, 10 Oct 2008 12:27:09 +0200
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

Thomas Keller wrote:
Ludovic Brenta schrieb:
That's where my trick comes in: manually edit _MTN/revision without
changing anything else in your workspace, then kill the head revision.

I'd do it "safely" without messing around with _MTN/revision and move
the current changes aside to re-apply them later on:

$ mtn diff > current_changes.txt
$ mtn revert .
$ mtn db kill_rev_locally dcfbf59823cf21e292b60ba8f8463f65ea383597
$ patch -p0 < current_changes.txt


Hi Thomas. I tried this and it looks like the diff/patch step is unnecessary - and indeed, if you run patch you actually break the workspace. It appears that 'mtn revert .' is enough to solve the problem with kill_rev_locally.

Here is a test:

------------------ START EXAMPLE
## Start with no changes.
% ls
_MTN/ foo
% mtn status
Current branch: foo.sandbox.branch
Changes against parent 9f79e6063616d8fb85cad56253e39c2c49927899
  no changes


## Make changes.
% echo "platypus" > foo
% echo "platypus" > asdf
% mtn add asdf
mtn: adding asdf to workspace manifest


## Commit 'foo' (this is the wrong commit).
% mtn commit foo
mtn: beginning commit on branch 'foo.sandbox.branch'
mtn: committed revision 3be3ed81bd01509d0c1e2db46e987b1040bbc222


## OOps - wrong commit.
% mtn revert .
% mtn db kill_rev_locally 3be3ed81bd01509d0c1e2db46e987b1040bbc222
mtn: applying changes from 3be3ed81bd01509d0c1e2db46e987b1040bbc222 on the current workspace


## Ok, so *now* I should be exactly where I started.
% mtn status
Current branch: foo.sandbox.branch
Changes against parent 9f79e6063616d8fb85cad56253e39c2c49927899
  patched  foo
% ls
_MTN/ asdf  foo
% cat asdf
platypus
------------------ END EXAMPLE

If I add the diff/patch step then 'cat asdf' shows that there are *two* lines of "platypus" in asdf.


Cheers,
Daniel.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]