Pregunta

I have very recently started using a Bzr shared repository to manage my project. I derived this by branching from a standalone repository to which I had been up to now making incremental commits. This new shared repository has a '/trunk, /branches' layout:

--xxxx_shared
  --trunk
    --src
    --lib
    --doc
  --branches

So I merged some changes from the trunk of this repository into the main line, but when I later attempted to push some further changes from the trunk I got an error stating that the two branches had diverged. I had committed the merge into the main line, and so there was a divergence. But how does one avoid this, given that one has to commit any merge? Or am I seriously misunderstanding things?

In order to resolve this conflict I merged from the main line BACK into the shared trunk branch. I suspect this was a mistake, since I now have a revision history for /xxxx_shared/trunk which looks like this:

    ------------------------------------------------------------
    revno: 74 [merge]
    committer: Chris <xxxxxxxx@yahoo.com>
    branch nick: trunk
    timestamp: Wed 2011-12-14 03:47:49 +0000
    message:
      Committing merge from parent branch.
        ------------------------------------------------------------
        revno: 71.1.1 [merge]
        committer: Chris <xxxxxxxx@yahoo.com>
        branch nick: mainline
        timestamp: Tue 2011-12-13 21:13:06 +0000
        message:
          Merged WinAPI toolbar updates from /projects/xxxx_shared/trunk.
    ------------------------------------------------------------
    revno: 73
    committer: Chris <xxxxxxxx@yahoo.com>
    branch nick: trunk
    timestamp: Wed 2011-12-14 03:33:35 +0000
    message:
      Updated the WinAPI toolbar button code...

So 71.1.1 above has been merged from the main line, and refers to the merge FROM /projects/xxxx_shared/trunk (shared repo) TO the main line.

I hope all this is clear. But how can I resolve this issue so as to recover a linear line of development? And what would be a conservative 'best practice' with Bzr so as to avoid this kind of thing in the future? I still have an unmodified copy of the original standalone repository, so I can always go back to that and start over again, if need be.

¿Fue útil?

Solución

If you want to have "main line" as exact mirror of the "trunk" you should only push from trunk to main line, or better pull from trunk into main line:

cd mainline
bzr pull /path/to/repo/trunk

If you have diverged branches situation then you need to use command bzr missing to understand why there is divergence occurs, after that merge to trunk, and execute the pull command above. Thus your main line will be exact copy of trunk.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top