cvs diff --ifdef=NEWFEATURE file.c
you will get a file with all differences merged, but depending on the preprocessor symbol NEWFEATURE (-D has a different meaning for CVS merge, you'll have to use the long form). So you'll get something like:
void f()
/* common code */
#ifndef NEWFEATURE
/* deleted code */
#else
/* added code */
#endif
/* more common code */
}
Is also cool if you want to wrap changes in if()-else, you just have to search and replace the preprocessor code. The only thing that I don't like is the fact that the test is negativ, I would prefer
#ifdef NEWFEATURE
/* added code */
#else
/* deleted code */
#endif
since I don't like negative tests with else branches. But maybe it's just me. And it only works if you use C/C++ or their pre-processor, obviously.
Keine Kommentare:
Kommentar veröffentlichen