views:

295

answers:

3

I am relatively new to bazaar (primarily used cvs, then subversion, and at my current job we're using SourceUnsafe). My current development environment is structured like this:

\dev                 (shared repository)
  \trunk
    \project1        (branch)
    \project2        (branch)
  \branches
    \proj1-bugfix123 (branch of \trunk\project1)
    \proj1-featureA  (branch of \trunk\project1)

Now, if I decide that certain aspects of project1 would be better suited as a library (or assembly, since it is a c# project) rather than classes inside the project, what would be the best approach for structuring this in bazaar. I have come up with two possibilities that I think are viable. The first I think is the "right" way.

\dev                 (shared repository)
  \trunk
    \project1        (branch)
    \project2        (branch)
    \libXXX
  \branches
    \proj1-bugfix123
      \main          (branch of \trunk\project1)
      \libXXX        (branch of \trunk\libXXX)
    \proj1-featureA
      \main          (branch of \trunk\project1)
      \libXXX        (branch of \trunk\libXXX)

The problems with this is that now I need to remember to update the solution file to include the right projects whenever I make a branch and to not push that back, and also to remember to push changes back to both the project and library at the same time (for instance, if featureA in project1 requires changes to libXXX to work).

\dev                 (shared repository)
  \trunk
    \project1        (branch)
    \project2        (branch)
      \libXXX
  \branches
    \proj1-bugfix123 (branch of \trunk\project1)
      \libXXX
    \proj1-featureA  (branch of \trunk\project1)
      \libXXX        

The problems with this approach are that if another project, say project3 wanted to use libXXX and be in source control, it would need to be a branch off of project1, with the project1 files deleted. It would be messy.

I suppose there is a third option of having the entire trunk be a branch as in subversion, but that seems to be counter to the way things I think they are supposed to work in bazaar.

If this were done in SourceSafe, I would just do it like the second example, but have the libxxx folders in both places, but shared, since that is the only mechanism sourcesafe has to do it in.

A: 

Wouldn't you want any new libraries to have their own solution and be built as part of that and then referenced by the other projects. That way the library has only a single version being built (instead of one per solution)

Brody
well, the library would have its own solution, but in project1, it would have the .csproj for the UI, and the .csproj for the library. The problem is where to put them.
FryGuy
If you want to use a library in multiple projects it weill have to really be a project of its own (with its own branches) I guess.
Brody
+2  A: 

There is no simple solution yet in bzr. You need nested trees support, but it's not implemented yet (http://bazaar-vcs.org/NestedTreeSupport), but may will be soon.

There is old tool called config-manager (https://launchpad.net/config-manager).

Also there is new plugin for bzr called scmproj (https://launchpad.net/bzr-scmproj), it's alpha now and in active development.

bialix
+1  A: 

Until nested trees support in Bazaar is fixed, or Bazaar develops something akin to Subversion 'Externals' (if I understand them correctly), your flexibility in including libraries into the tree of a Bazaar branch is limited.

Until then, maintain the library as a separate project in a nice clean 'branch' of its own. If you need the library included in a project such as its files are within the project's own tree, then copy them across. If you make any changes to files in that library that you want to contribute back to the library, bring the changes back into your local branch of that library and merge/commit there.

thomasrutter