How do I repair a chain link fence?
I think the answer depends on what "pretty mushed" means. And before you read on, here's a caveat: my sole experience with chain link fences is taking them down, not putting them up (but I've taken down quite a few :-)).

That said, my experience is that the links will collapse in on one another, not actually bend. Which means that the fencing as a whole can be straightened out again. Also, even though the posts appear untouched, you should ensure that they're plumb.

The rails are easy to replace; every home center should carry them, as well as the caps and other accessories. The important piece that you'll need is a coupling: a short section of pipe that fits snugly over the ends of two existing pieces, to join them together (in the fences that I've disassembled, this is just press fit, not welded or brazed, but I suspect a dab of epoxy would help).

Cut the existing rails with a reciprocating saw, close to the existing rails that still have caps (you could also use a hacksaw; you won't be able to get enough clearance to use a pipe cutter). Slide the new section(s) of rail through the caps, attach them to the posts, cut to length, and slide the coupling in place.

That just leaves re-attaching the fencing. I think that you can stretch it to the rail using baling wire and a pair of pliers: loop the wire through fence and rail, and twist it to take up all slack. Then attach normally.