Simple way to reverse a changeset

Bug #118532 reported by Matt Zimmerman
4
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Wishlist
Unassigned

Bug Description

Sometimes, a change which was committed earlier is determined to be unwanted, and the user decides that the best course of action is simply to revert it. Usually this is done with something like "bzr diff -rX..Y | patch -p0 -R", but I think it is common enough that a command would be useful, and it would be very handy if it did the right thing with files which were added/removed/renamed.

If there is already a way to do this in bzr, I haven't come across it.

Tags: doc
Matt Zimmerman (mdz)
Changed in bzr:
importance: Undecided → Wishlist
Revision history for this message
Lukáš Lalinský (luks) wrote :

You can do "bzr merge -rY..X"

Revision history for this message
John A Meinel (jameinel) wrote :

Well, actually it is "bzr merge -r Y..X ."

The last "." is significant, so that it uses the local branch (otherwise it uses the parent branch, which is likely to be correct, but is not absolutely correct).

I'm leaving this "Confirmed" as a documentation bug, since it isn't easily discovered (and this use case isn't described in "bzr help merge").

It may just be a tutorial thing, or maybe revert might hint at using merge, and merge could describe it.

Matt, where did you start looking for it, as that would give some ideas of how we could make it discoverable.

Changed in bzr:
status: Unconfirmed → Confirmed
Revision history for this message
Matt Zimmerman (mdz) wrote : Re: [Bug 118532] Re: Simple way to reverse a changeset

On Mon, Jun 04, 2007 at 02:36:18AM -0000, John A Meinel wrote:
> Well, actually it is "bzr merge -r Y..X ."
>
> The last "." is significant, so that it uses the local branch (otherwise
> it uses the parent branch, which is likely to be correct, but is not
> absolutely correct).
>
> I'm leaving this "Confirmed" as a documentation bug, since it isn't
> easily discovered (and this use case isn't described in "bzr help
> merge").

I wouldn't have thought to use 'merge' for this. It makes some sense
retroactively, I suppose, but I don't think it would be made discoverable by
adding to the help for 'merge'. I also think about the operation as being
able to apply to a single revision, reversing the changes which went into
it, rather than having to be a range, and I wouldn't expect to have to
explicitly say that I wanted it to operate on the local branch.

> It may just be a tutorial thing, or maybe revert might hint at using
> merge, and merge could describe it.
>
> Matt, where did you start looking for it, as that would give some ideas
> of how we could make it discoverable.

I started looking at uncommit, actually, expecting that if I tried to
uncommit something other than the most recent revision, it would do
something like what I wanted.

Would it be reasonable to have a command for this?

bzr reverse # reverse most recent revision
bzr reverse -r X # reverse changes from the specified revision
bzr reverse -r X..Y # reverse all changes from this sequence of revisions

I would expect this to put the necessary modifications into my working tree
so that they could be committed as a new revision.

I think of it as a high-level operation unto itself, like revert is. I
confess that too many distinct operations might get confusing (undo,
uncommit, revert, reverse...).

--
 - mdz

Revision history for this message
Aaron Bentley (abentley) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John A Meinel wrote:
> It may just be a tutorial thing, or maybe revert might hint at using
> merge, and merge could describe it.

Revert already hints:

To remove only some changes, without reverting to a prior version, use
merge instead. For example, "merge . --r-2..-3" will remove the changes
introduced by -2, without affecting the changes introduced by -1.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZGer0F+nu1YWqI0RAnvnAKCJnX4G/7QRpXJxBTP4af/6jL2GiwCfTh5N
wMtoX4QCk29klm4O5GxI5qY=
=MWy/
-----END PGP SIGNATURE-----

Revision history for this message
Martin Pool (mbp) wrote :

I think 'reverse' would be reasonable.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.