Southwest Airlines and a union representing its mechanics could be on the verge of ending a bitter, long-running labor dispute that has triggered hundreds of flight cancellations and raised safety concerns. The two sides announced the tentative contract agreement late Saturday after six years of negotiations between Southwest and the Aircraft Mechanics Fraternal Association. The agreement, reached in a week of mediation, came after the Federal Aviation Administration warned that the deteriorating relationship between Southwest and its mechanics threatened to undermine the airline’s safety-management system.