Maintain two very close, but separate lines of development under svn?

We have our project under svn, and everything is going well and well. Recently, a large client asked us to make some rather specific settings for them, which require encoding and so on (cannot be done using configuration or deployment). We decided to maintain two separate lines of development:

  • The industry trunkis our standard version, which is deployed for regular customers.
  • The branch is arshfor this client and is in constant development separately from what is happening intrunk

Now the thing is arshto get mostly updates from trunk, and sometimes the functions implemented in arshare useful in trunk. The relation has the form of bidirectional, but one direction is quite common (from trunkto arsh), but the other is random.

What would be the best way to do this? work flows? best practics? ideas?

EDIT: we use PHP 5.3, MySQL, Apache and Linux.

+5
source share
2 answers

Best practice #ifdef(or individual implementations of the same interface, conditionally included or conditionally dependent, introduced by the run-time configuration or any other compilation time or run time)!

. .

, A B B A, . . , , .

.

  • - , , , , .
  • , Java .

, - , , , .

PHP. , . , , , , .

. ++, 20 , . , , , . , . , , ( , 8 , ).

+3

, , , - , , / factory , . ( #):

public interface IProcessor {
    void ProcessFile(string fileName);
}

public abstract class BaseProcessor : IProcessor {
    void IProcessor.ProcessFile(string fileName) {

        // Do shared stuff here like logging, validation, etc.

        ProcessFileForClient(fileName);
    }
    protected abstract void ProcessFileForClient(string fileName);
}

public class NormalProcessor : BaseProcessor {
    protected override void ProcessFileForClient(string fileName) {
        // Do your normal routine here
    }
}

public class AcmeProcessor : BaseProcessor {
    protected override void ProcessFileForClient(string fileName) {
        // Do your custom stuff here
    }
}

// This can be as complex as you need - you should probably use an IoC/DI framework,
// but this is a simple example.
public static class ProcessorFactory {
    public static IProcessor GetProcessor(string clientCode) {
        switch (clientCode) {
            case "Acme": return new AcmeProcessor();
            default: return new NormalProcessor();
        }
    }
}

, , , .

0

All Articles