Keeping a modification while getting latest source?

Started by teaspoon, February 14, 2013, 04:31:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

teaspoon

So, I've modified Alex's great work on ML AUTO ISO to make it suit my needs. I've changed the maximum ISO to 6400 and I've put in a lot more shutter speed options in the Av mode (which I use almost always).

What is the best way to keep these changes and continue to benefit from future releases?

I don't think everyone will agree with my mods so I don't want to suggest that they be incorporated into the main source. Some people might though... so how do I make these changes available for them?

Thanks
Daniel
ML for stills: 5DII, 16-35 f2.8 II, 50 f1.4, 100 f2.8, 135 f2, 300 f4, 1.4X extender.

scrax

You have to clone main repo, add your changes and then update it with mercurial
Also you can put the changes in a #ifdef statements and add the define in your makefile.user (but I prefer tu put a menu option to enable my modifications so to let user choose if use them or not).

for example:

#ifdef ADD_MY_MODIFICATION
  here you put your new code
#else
here stay the original ML code
#endif

in makefile.user add: -DADD_MY_MODIFICATION in the CFLAG_USER part before the back slash (\)

# You can customize CFLAG here
CFLAG_USER = -DADD_MY_MODIFICATION  \
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

teaspoon

Hi Scrax

I'm afraid I don't understand your reply. Are you suggesting I update the main repo with my own code? Does this mean that without review, my changes would get included into the current source? Even with the compile flag and the ifdef, wouldn't this bloat the code and make it unreadable since the part I'm changing is some of the existing code and is not a new add on.

Thanks
Daniel
ML for stills: 5DII, 16-35 f2.8 II, 50 f1.4, 100 f2.8, 135 f2, 300 f4, 1.4X extender.

scrax

Quote from: teaspoon on February 15, 2013, 11:38:48 AM
Hi Scrax

I'm afraid I don't understand your reply. Are you suggesting I update the main repo with my own code? Does this mean that without review, my changes would get included into the current source? Even with the compile flag and the ifdef, wouldn't this bloat the code and make it unreadable since the part I'm changing is some of the existing code and is not a new add on.

Thanks
Daniel

On the repo you cloned make the changes, compile and use it like you already do I suppose.
When there are new commits in the main repo you use mercurial to keep track of them and update your clone without losing your changes. The ifdef options are useful is you want to compile with it or without.


Suppose that your change is that:


    int min_iso = MIN_ISO;
-    int max_iso = auto_iso_range & 0xFF;
+   int max_iso = 6400;
   

You can make it like this:

    int min_iso = MIN_ISO;
#ifdef FULL_AUTO_ISO_RANGE
    int max_iso = 6400;
#else
    int max_iso = auto_iso_range & 0xFF;
#endif



Having -DFULL_AUTO_ISO_RANGE in your CFLAGS settings (makefile.user) will compile with your changes, without it will compile with normal ML code.

hope it's more clear..
I'm using ML2.3 for photography with:
EOS 600DML | EOS 400Dplus | EOS 5D MLbeta5- EF 100mm f/2.8 USM Macro  - EF-S 17-85mm f4-5.6 IS USM - EF 70-200mm f/4 L USM - 580EXII - OsX, PS, LR, RawTherapee, LightZone -no video experience-

1%

Better off makin it a featue and adding to features.h

teaspoon

Hi Scrax

Yes, thanks that is clearer.

What about if I think other people might be interested in using it? Is that where features.h comes in 1% or is that again just for myself?

Cheers
Daniel
ML for stills: 5DII, 16-35 f2.8 II, 50 f1.4, 100 f2.8, 135 f2, 300 f4, 1.4X extender.

1%

If you make it in the main tree then yes, other people will be able to use it. You can also clone the repo and put your modifications there.

Its a way to section off the code. like

#ifdef FEATURE_Myfeature
blah blah code
#endif

and then in features.h
#define FEATURE_Myfeature

Now it compiles, comment it out and it doesn't. If you use the d-config method other people will have to edit their makefiles instead.

You still have to work out the conflicts when doing a pull but its generally much easier.