You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by stv <st...@gmail.com> on 2006/04/08 10:42:24 UTC

Managing localized/static branches

How does one manage different branches that contain a few files with a
few lines of static "localized" changes. I've re-read the Branches &
Merging section of the book, and I'm wondering if I'm missing
something.

I would like to use Subversion to manage both the production & staging
servers for a website (for which I have only FTP access). There are
two areas of particular interest for me, but I imagine this is a more
generic problem. Personally, I want to change one line in a CSS file
and three lines in a db-config file so that my staging site has a
strong visual cue and uses a staging database. I imagine that a
traditionally installed application with localizations for various
sites may have similar needs.

Obviously, in my case, it's not a huge issue, but this is a personal
project I'm pursuing so I can learn to do things right. I'd be curious
how a similar problem of larger scale is solved.

My guess is that I'll have an eternal branch called "production" where
I will make extremely few changes: (the four lines I mentioned
earlier). Each time I want to push a version into production, I will
merge the eternal branch with trunk, accept all changes, and then tag
& publish (not sure I need that last step).

Right now I have a post-commit script that FTPs all relevant changes
to staging. I also have a shell script that will do a clean build on
production given a revision & path.

Basically, I think I'm looking for #IFDEF ( ... if I got that right,
my C days are getting hazy)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Managing localized/static branches

Posted by William Nagel <bi...@stagelogic.com>.
On Apr 8, 2006, at 9:40 AM, stv wrote:

> I realized there's one other twist ... conditionally deploying entire
> files depending on the "branch" ... something not really suited to the
> #IFDEF situaion (unless you no-op the entire file content ...)

Create scripts to do the deployment, and then include them in  
Subversion.  Then when you want to do the deployment it's just a  
matter of running the appropriate script to deploy only those files  
that should be included.

-Bill

>
> On 4/8/06, stv <st...@gmail.com> wrote:
>> Ahhh. Yeah, well, I'm new to PHP as well, so thanks for the tip :)
>> That'll work just fine for what I need now.
>>
>> I'm still curious as to how one would handle this in a less trivial
>> example? Say I'm a printer manufacturer, and we have a print utility.
>> I rebrand my printers with the rebranded software ... is this type of
>> thing generally handled in #IFDEF code, or via scm?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Managing localized/static branches

Posted by stv <st...@gmail.com>.
I realized there's one other twist ... conditionally deploying entire
files depending on the "branch" ... something not really suited to the
#IFDEF situaion (unless you no-op the entire file content ...)

On 4/8/06, stv <st...@gmail.com> wrote:
> Ahhh. Yeah, well, I'm new to PHP as well, so thanks for the tip :)
> That'll work just fine for what I need now.
>
> I'm still curious as to how one would handle this in a less trivial
> example? Say I'm a printer manufacturer, and we have a print utility.
> I rebrand my printers with the rebranded software ... is this type of
> thing generally handled in #IFDEF code, or via scm?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Managing localized/static branches

Posted by stv <st...@gmail.com>.
Ahhh. Yeah, well, I'm new to PHP as well, so thanks for the tip :)
That'll work just fine for what I need now.

I'm still curious as to how one would handle this in a less trivial
example? Say I'm a printer manufacturer, and we have a print utility.
I rebrand my printers with the rebranded software ... is this type of
thing generally handled in #IFDEF code, or via scm?

On 4/8/06, Ryan Schmidt <su...@ryandesign.com> wrote:
>
> On Apr 8, 2006, at 12:42, stv wrote:
>
> > I would like to use Subversion to manage the production & staging
> > servers for a website (for which I have only FTP access). There are
> > two areas of particular interest for me, but I imagine this is a more
> > generic problem. Personally, I want to change one line in a CSS file
> > and three lines in a db-config file so that my staging site has a
> > strong visual cue and uses a staging database. I imagine that a
> > traditionally installed application with localizations for various
> > sites may have similar needs.
>
> [snip]
>
> > Basically, I think I'm looking for #IFDEF ( ... if I got that right,
> > my C days are getting hazy)
>
> That's how we do it. We leave Subversion out of it completely. No
> need to have a separate branch if all that's ever going to be
> different is these few changes. Much less hassle to keep it all in
> one branch and use your programming language to conditionalize this
> stuff. Our DB connection script says something like:
>
> <?php
> if (IS_STAGING_SYSTEM) {
>         define('DB_NAME', 'staging_system');
> } else {
>         define('DB_NAME', 'live_system');
> }
> ?>
>
> and the HTML file has something like:
>
> <?php if (IS_STAGING_SYSTEM): ?>
> <link rel="stylesheet" type="text/css" href="staging_extras.css" />
> <?php endif; ?>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Managing localized/static branches

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Apr 8, 2006, at 12:42, stv wrote:

> I would like to use Subversion to manage both the production & staging
> servers for a website (for which I have only FTP access). There are
> two areas of particular interest for me, but I imagine this is a more
> generic problem. Personally, I want to change one line in a CSS file
> and three lines in a db-config file so that my staging site has a
> strong visual cue and uses a staging database. I imagine that a
> traditionally installed application with localizations for various
> sites may have similar needs.

[snip]

> Basically, I think I'm looking for #IFDEF ( ... if I got that right,
> my C days are getting hazy)

That's how we do it. We leave Subversion out of it completely. No  
need to have a separate branch if all that's ever going to be  
different is these few changes. Much less hassle to keep it all in  
one branch and use your programming language to conditionalize this  
stuff. Our DB connection script says something like:

<?php
if (IS_STAGING_SYSTEM) {
	define('DB_NAME', 'staging_system');
} else {
	define('DB_NAME', 'live_system');
}
?>

and the HTML file has something like:

<?php if (IS_STAGING_SYSTEM): ?>
<link rel="stylesheet" type="text/css" href="staging_extras.css" />
<?php endif; ?>

How you define the IS_STAGING_SYSTEM constant is up to you; we do it  
by hostname.

<?php
define('IS_STAGING_SYSTEM', 'stage.example.com' == $_SERVER 
['HTTP_HOST']);
?>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org