<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def release_apply(ui, repo, clname, **opts):
 	"""apply a CL to the release branch 	Creates a new CL copying a previously committed change 	from the main branch to the release branch. 	The current client must either be clean or already be in 	the release branch. 	 	The release branch must be created by starting with a 	clean client, disabling the code review plugin, and running: 	 		hg update weekly.YYYY-MM-DD 		hg branch release-branch.rNN 		hg commit -m 'create release-branch.rNN' 		hg push --new-branch 	 	Then re-enable the code review plugin. 	 	People can test the release branch by running 	 		hg update release-branch.rNN 	 	in a clean client. To return to the normal tree, 	 		hg update default 	 	Move changes since the weekly into the release branch 	using hg release-apply followed by the usual code review 	process and hg submit. 	When it comes time to tag the release, record the 	final long-form tag of the release-branch.rNN 	in the *default* branch's .hgtags file. That is, run 	 		hg update default 	 	and then edit .hgtags as you would for a weekly. 		 	"""

	c = repo[None]
	if not releaseBranch:
		raise hg_util.Abort("no active release branches")
	if c.branch() != releaseBranch:
		if c.modified() or c.added() or c.removed():
			raise hg_util.Abort("uncommitted local changes - cannot switch branches")
		err = hg_clean(repo, releaseBranch)
		if err:
			raise hg_util.Abort(err)
	try:
		err = clpatch_or_undo(ui, repo, clname, opts, mode="backport")
		if err:
			raise hg_util.Abort(err)
	except Exception, e:
		hg_clean(repo, "default")
		raise e