Domanda

I have a branch with several shelves and this branch is now out of developement because we branched a new one from it. Now I need to take over my shelved changes without modifying the old branch to the new one. What is the easiest way?

I know I could unshelve, manually take over the changes and revert the old branch, but that is tedious. Any better solution?

È stato utile?

Soluzione

This will take a few steps per changeset.

In the old branch directory, do:

bzr unshelve --keep ID

In the new branch directory, do:

bzr merge --uncommitted OLD_BRANCH_DIRECTORY
bzr shelve --all -m MESSAGE

Back in the old branch, do:

bzr revert

to get it back to its original state.

The unshelve operation puts the changes in the working directory of the old branch, the merge transfers them to the working directory of the new branch, the shelve operation does its usual work, and the revert resets the old branch to its original state.

Choose ID, OLD_BRANCH_DIRECTORY, and MESSAGE as needed. Repeat for each shelved changeset.

Altri suggerimenti

Maybe the cleanest and best way is to create a replica of the old branch, convert the shelves to proper commits, and merge them. For example:

cd /path/to/repo
mv oldbranch work            # we will unshelve in "work"
bzr branch work oldbranch    # the replica, but without shelves
cd work
bzr unshelve
bzr commit -m 'some change'
bzr unshelve
bzr commit -m 'another change'
cd ../targetbranch
bzr merge ../work

Another way, but less clean, is perhaps using bzr unshelve --preview and the patch command:

bzr unshelve --preview -d /path/to/oldbranch | patch -d /path/to/targetbranch

But I really recommend the first option.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top