Frage

I have a main branch located on the server (launchpad.net). I want to remove the last version which is bad, but not sure how to achieve that. Thanks!

War es hilfreich?

Lösung

There are two ways to accomplish this goal, either with or without modifying history. Not modifying history is safer (and generally recommended if you're sharing the repository with other people), but creates an ugly "inverse" revision. To accomplish this, do:

bzr merge -r last:1..last:2 .
bzr commit

This will create a new revision that inverts the effects of the previous one via reverse cherrypicking.

If you're willing to modify history -- which may look cleaner, but may potentially destroy history that your collaborators rely on -- you can use overwrite the existing branch. This requires that the branch is NOT configured to only allow appends (i.e. what happens when you do bzr init --append-revisions-only).

You can then use bzr push --overwrite to replace an existing branch with your local copy.

To drop a revision, you can thus use bzr uncommit locally to get rid of the bad revision, then push the branch without the bad revision.

However, I'd advise you to be careful if this repository is shared with somebody else. Modifying history is generally dangerous and, worse, if you do accidentally remove too much history, thus losing work. It is a good idea to back up the main branch before you overwrite it.

You can use:

bzr -d <branch> append_revisions_only=True

to protect your branch against accidental overwriting. Similarly, you can use:

bzr -d <branch> append_revisions_only=False

to allow for overwriting.

In general, bzr push --overwrite is a dangerous feature that should be used with caution.

Note: I am not familiar with launchpad; launchpad may have this feature disabled by default for safety reasons and/or may use other tools to enable/disable it.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top