South African income tax legislation (as modified by a DTA), dictates on how capital gains are taxed in South Africa. Unfortunately the legislation is not necessarily reciprocal and you would have to refer to local (in your case) Portuguese legislation (as modified by any DTA) in order to assess the tax implications on your side.....
For example, and not relevant to your case, but para 12(4) of the 8th Schedule of the South African Income tax act dictates how a incoming immigrant Base cost is reset on becoming a South African resident. There is no modification in the DTA necessary. For completeness, the relevant income tax legislation reads as follows.
4) A person who commences to be a resident must, subject to paragraph 24, be treated as having
disposed of each of that person's assets, other than assets in the Republic listed in paragraph 2 (1) (b) (i) and (ii), and as having acquired each of those assets at a cost equal to the market value of each of those assets, which cost must be treated as an amount of expenditure actually incurred and paid for the purposes of paragraph 20 (1) (a).Incidently, you'll note that there is no mention of "exit tax" (which is a misnomer anyway). So irrespective if "exit tax" was paid, South Africa regards the base cost as being "reset".
In your case, the key to unlocking the puzzle is to understand what Portuguese legislation say's, and if you're in luck, it may have a similar provision to the above.......
Tax legislation, and in particular international tax implications are not alway's logical and I strongly advise you once again to seek appropriate expert tax advice (not from myself). Don't just assume because "South Africa do it this way, Portugal must treat you the same"