It does not work when fishing.
Source
Bulbapedia has a page on the repel trick, which is a method where you have a specific level Pokemon in the front of your party with a Repel active in order to find the highest level Pokemon available. It clearly states that this repel trick only works in normal grass encounters, as it states that fishing, Sweet Scent, Horde Encounters, phenomena, and ambush encounters do not work.
This trick works in all generations.
Unfortunately, this also means that it does not work while fishing in all generations.
Hope I could help!