Git branch support strategy which with different API versions?

Is there an efficient way to use gitto manage two branches that are based on the same code logic but support different APIs? Here is a specific example: suppose I have a repo with a single Python 2 file named abc.py. In commit Aon the branch, the py2contents of the file:

print 'A'

Now I am disconnecting Awith a new branch py3and doing commit A3with this content:

print('A')

Back in the branch py2, someone makes a new commit Bwith content

print 'A'
print 'B'

In py3I combine py2to get the update Band get this merge conflict:

<<<<<<< HEAD
print('A')
=======
print 'A'
print 'B'
>>>>>>> 9d898

Thus, the conflict over is print 'A'recreated. I allow this for

print('A')
print('B')

py2 commit C

print 'A'
print 'B'
print 'C'

py3

<<<<<<< HEAD
print('A')
print('B')
=======
print 'A'
print 'B'
print 'C'
>>>>>>> 2c5a5

, .

, py2 py3 , . git , , ? , , "" , , .

. Python 2 Python 3. , Python 2, , Python 2, Python 3 - . , 2 3 . Python 2, Python 3 , , , , Python 2 , .

: , , __future__ Python 2, . , , , Python 2/3.

+4
1

, , , , . " " , , , .

, , gpp, m4 ( ac/c++) cpp.

0

Source: https://habr.com/ru/post/1679270/


All Articles