问题
A developer in my team has been using a branch bound to the server (IE, only using checkout, update, and commit), but also often uses the --local flag on commit and then commits to the server in a batch. She recently experienced a situation where she is missing some local commits, and can't find them in the repo OR her local code. She suspects that this is because she did a pull at some point in bettween local commits and server commits.
Neither of us are particularly experience with Bazaar -- What may have happened, and where can we look for this missing code? She is fairly certain that she never did anything destructive, and I am fairly certain that Bazaar would have asked her if it was going to do that. I vaguely remember that Bazaar has some notion of "hidden" repos/trees/whatever where it puts things before changing a bunch of code, from which someone might recover lost code, but I can't manage to google for what that is.
回答1:
I figured out that the "'hidden' repos/trees/whatever" that I was referring to are "dead heads", viewed with bzr heads
.
We found our dead head and merged it back in -- code saved!
$ bzr heads
$ # output shows various heads, with names like: revision-id: john@mycomputer-20100630175358-39qro1z5qdq2o9ay(dead)
$ bzr merge john@mycomputer-20100630175358-39qro1z5qdq2o9ay
回答2:
If all else fails, you can try asking in the bazaar IRC channel.
Go there now* and wander into the #bzr channel. There are usually people there and they are usually helpful.
**That's freenode's web interface. If you haven't used IRC before, you make up your own nickname, choose the #bzr channel, and no need to auth (as long as your nickname is unique).*
回答3:
At any time you can do a
bzr status
and this will should you if there are any uncommitted changes, including merges that have not been committed. This may help in determining where everything is at. If you do a merge and you haven't followed it up with a commit (whether or not there were conflicts) then the result of the merge will remain uncommitted.
Doing a bzr pull
shouldn't have wiped out any work - as I understand it, it should just fail if the local branch has uncommitted changes.
来源:https://stackoverflow.com/questions/3162481/some-code-was-lost-after-doing-bzr-commit-local-bzr-pull-bzr-commit