문제

I'm new to Bazaar, coming to it from a background of Subversion and git. I thought I had a working grasp of some basic concepts, but have already hit a stumbling block in my first major commit.

The project is hosted on Launchpad. I created a local branch ("working") with bzr branch. I made changes, added new files, renamed others. In the interim another person on the team committed and pushed their changes. At this point the commit history looked something like this:

3. Team Member A
2. Me (trivial commit of .bzrignore)
1. Original commit

This morning I bzr commit my changes locally. The commit number was reported as 3, which I assumed (wrongly) would be reconciled when I sync'd with the server. When I did a bzr pull I got this message:

Using saved parent location: bzr+ssh://bazaar.launchpad.net/...
bzr: ERROR: These branches have diverged. Use the missing command to see how.
Use the merge command to reconcile them.

I did bzr merge. No conflicts were discovered but three files were left as modified in my local branch. I inspected and committed those with a comment, which was reported to me as commit 4. Then I did a bzr push, which reported no errors.

Now the commit history (bzr log --include-merges) looks like this:

4.    My merge commit
2.1.1 Team Member A
3.    My commit this morning
2.    My .bzrignore commit
1.    Original commit

There's a high desire here to keep the trunk line serialized and avoid these merge bubbles. (Annoyingly, Launchpad doesn't display the 2.1.1 commit, making it look like I overwrote it.) What is the best workflow in this situation to avoid these bubbles? Should I have pulled first? I'm wary of having to merge other people's code into my local uncommitted changes.

In addition, although rebase is commonly used in git, it appears it's not generally approved of in the Bazaar world. If we can avoid using the bzr-rebase plugin, that would be great.

도움이 되었습니까?

해결책

One way to have a cleaner mainline history would be to do your work in a separate feature branch, while maintaining a mirror of the mainline branch. I'm assuming branches with working trees here, but you could use treeless branches and a checkout to save disk space.

// setup the mirror branch
cd <mirror directory>
bzr pull <mainline>

// setup a feature branch
cd <feature directory>
bzr branch <mirror directory> .

// work on your feature branch
bzr commit -m "Did some work"
...
bzr commit -m "Did some more work"

// ready to commit your feature
cd <mirror directory>
bzr pull
bzr merge <feature directory>

// your integration testing is done
bzr commit -m "My shiny feature"
bzr push
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top