Attila Fulop
Attila Fulop

Reputation: 7011

Separating two projects with bazaar under the same directory

I've created yet another php framework that is a common base to multiple webapps I develop. This framework is also present as a launchpad project.

The webapps use the framework, and also extend it with custom (php) modules and with their own web/design files (css, images, html, js, etc)

During the development of these apps, I also modify the framework. In such cases I'd like to push changes (of framework files only) back to the framework-central directory, and from there, commit to launchpad.

As a separate project I also would like to have a bzr tree that only contains the files custom to the webapp. The directories are however nested in each-other on multiple levels, so it's not trivial (at least not for me)

See the directory layout:

[framework_central_dir] <---------> launchpad
 www/
 www/app/framework.php
 www/app/framework/**
 www/lib/**
  |
  |
  |
  |
  |
  |
  \/
[webapp_dir]
 www/app/local-module/** [->Webapp Repo]
 www/app/framework.php   [->Framew Repo]
 www/app/framework/**    [->Framew Repo]
 www/lib/**              [->Framew Repo]
 www/css/**              [->Webapp Repo]
 www/js/**               [->Webapp Repo]
 www/*                   [->Webapp Repo]

I saw that bzr-externals might be for me, but I'm not sure if I'm correct. I'd like to ask for advice if this can be achived or not. If yes, please show me the idea. If this question is a duplicated one, then I'm sorry about it, maybe I even saw it already but wasn't sure that it was for me, so please point me to it.

Thank you

Upvotes: 1

Views: 80

Answers (1)

bialix
bialix

Reputation: 21473

You cannot mix two different projects in the same root directory. You should put at least one of them into subdirectory. That's how bzr-externals supposed to work.

To make sure your framework will be invoked you might add some redirection stub to framework subdirectory. E.g. (based on your example)

[framework_central_dir] <---------> launchpad
 app/framework.php
 app/framework/**
 lib/**
  |
  |
  |
  V

[webapp_dir]
 www/app/local-module/** [->Webapp Repo]
 www/app/redirection.php [->Webapp Repo, redirects to actual framework.php]
 www/framework/          [->Framew Repo placeholder]
 www/framework/app/framework.php   [->Framew Repo]
 www/framework/app/framework/**    [->Framew Repo]
 www/framework/lib/**              [->Framew Repo]
 www/css/**              [->Webapp Repo]
 www/js/**               [->Webapp Repo]
 www/*                   [->Webapp Repo]

Sorry, I'm not PHP developer, so maybe my redirection.php is wrong idea. It's just illustration of one of the possible way to join 2 projects at the code level.

Upvotes: 3

Related Questions