Well, the "proper" way to repair it is either to cut a section out and splice in a new one, welding the joints and drilling/machining to match the pattern.
That might not be impossible even if the rail is no longer made, because sometimes you can steal a few feet from one end (and match the other side) or sometimes you can have a machine shop slice off three (six?)feet of aluminum angle iron, and match it up.
Onceuponatime this was something any village blacksmith could do everyday. These days--you can also do some of it online with CAD/CAM tools. Take a look at CNC Machine Shop | Custom Waterjet, Plasma, Laser Cutting | eMachineShop.com
for one place that will give you free CAD software, let you work out the plans, and then they'll machine the stock for you. If your local machine shop wants big rent money to do work... There are online resources.
Of course if you've got a generous insurer or the damage in someone else's problem, you just say "Pull both rails and replace with something very similar" and that's REALLY the right way to do it, if you can't fabricate in a new piece.
Old boat? Beater? Lots of wrinkles? OK, then you just bang it back into shape as best you can. Body shops used to repair Rolls Royce the same way, a good tinsmith can work that metal back to damn near new. In fact, if you go to a local auto body shop with some photos, you might be able to get a pro to come do the work on his own time. They have an array of special hammers, anvils, wheels, designed to reshape the metal without distorting it. Getting rid of the distortions, or preventing them, takes skill and practice.
The main thing is, "make haste slowly". Check out your options, you may find pleasant surprises.