Sharing a common library between (otherwise) unrelated projects

Asked by besy

I have two projects which share the code of a common library. The projects are otherwise unrelated. The library still is in development, thus it will regularly change. Each project should have its *own state* of the library. However, it should be possible to pull/merge the current state of the library from one project into the other.

Example:
-----------

Project 1 consists of the following directories: E:\Project1\ and E:\Project1\Lib
Project 2 consists of the following directories: E:\Project2\ and E:\Project2\Lib
The code files in E:\Project1\ and E:\Project2\ are completely unrelated. However, the code files in the Lib-directories are related (but not necessarily identical).

I'd like to commit/push Project1 *inclusive* its Lib directory and to commit/push Project2 *inclusive* its Lib directory. Then I'd like to be able to pull/merge Project1\Lib into Project2\Lib *alone*, or Project2\Lib into Project1\Lib *alone*.

Is this possible? AFAIK, I can't simply use nested branches ("bzr init E:\Project1" and "bzr init E:\Project1\Lib") , because there is no "bzr commit --recursively E:\Project1" which would commit Project1 *inclusive* its Lib directory.

If my idea doesn't work with Bazaar, is there another way of (comfortably) managing both projects?

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
besy (besy) said :
#2

Hm, my question expired because nobody has answered.

Is it impossible to share a common library between projects in Bazaar?

Revision history for this message
Alexander Röhnsch (roehnsch) said :
#3

I just tried the repo-push plugin. Its description seems to solve your problem, though I ended up with an error. Probably a bug. Here's what I did:

D:\test>mkdir proj1
D:\test>bzr init proj1
Created a standalone tree (format: 2a)
D:\test>mkdir proj1\Lib
D:\test>bzr init proj1\Lib
Created a standalone tree (format: 2a)
D:\test>bzr branch proj1 joes_p1
Branched 0 revision(s).
D:\test>cd proj1
D:\test\proj1>bzr repo-push ..\joes_p1
Pushing 1 branches from file:///D:/test/proj1/ to file:///D:/test/joes_p1/
c:\programme\bazaar\lib\library.zip\bzrlib\fetch.py:65: UserWarning: pb paramete
r to RepoFetcher.__init__ was deprecated in version 1.14.0.

I don't know of another way of solving your scenario. Stumbled over it before, too.

If the repo-push worked however, it is essential for your workflow to branch Lib into your second project. The Lib nested branches need to be branched off each other in order for push/pull/merge to work between them.

Revision history for this message
besy (besy) said :
#4

Thank you for the hint. Unfortunately, currently, the repo-push plugin doesn't work correctly, as you stated in your bug report (https://bugs.launchpad.net/bzr-repo-push/+bug/477855).

If the repo-push worked correctly with nested branches, it would probably solve my problem.

Revision history for this message
Martin Pool (mbp) said :
#5

What I would probably do at the moment is manually create the branches and push each of them, or look at the scmproj plugin.

Eventually this should be handled by the nested-branches feature.

Revision history for this message
besy (besy) said :
#6

Thanks for the info. Could you please tell me which commands I would need for my example above when using the scmproj plugin?

I agree that, eventually, my workflow should be able to be handled by a nested-branches feature.

Revision history for this message
Martin Pool (mbp) said :
#7

please check out the scmproj docs and ask if you have questions then

Revision history for this message
Brian (vielster) said :
#8

Curious, has there been any progress in this area? I have a similar setup which I would like to implement... Essentially, I have a branch which is a library that is constantly maintained and updated. The library is linked from several projects (GUI's, Embedded Applications, conversion tools, etc). I want to be able to include the lib as a sub-folder inside of each of these programs allowing me to pull the most recent version to keep all of the programs up to date. Putting a branch inside of the project gives all sorts of issues.

I currently just keep the library outside of the projects, requiring 2 checkouts/branches to build the program...one to the application and one to the library. I'd like to consolidate this into a single checkout/branch.

Any help would be appreciated.

Revision history for this message
Martin Pool (mbp) said :
#9

Sorry, no changes here since November, scmproj remains the best option afaik.

Can you help with this problem?

Provide an answer of your own, or ask besy for more information if necessary.

To post a message you must log in.