Texas oil and natural gas firm Diamondback Energy will buy its privately held competitor Endeavor Energy in an agreement valuing the latter at roughly $26 billion, the latest massive energy deal amid an otherwise quiet time for dealmaking.