Fri, 20 Jun 2014 00:42:35 +0900 subrepo: ensure "close()" execution at the end of "_initrepo()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Fri, 20 Jun 2014 00:42:35 +0900] rev 21891
subrepo: ensure "close()" execution at the end of "_initrepo()" Before this patch, "close()" for the file object opened in "_initrepo()" may not be executed, if unexpected exception is raised, because it isn't executed in "finally" clause. This patch ensures "close()" execution at the end of "_initrepo()" by moving it into "finally" clause. This patch puts configuration lines into "lines" array and write them out at once, to narrow the scope of "try"/"finally" for review-ability. This patch doesn't use "vfs.write()", because: - current "vfs.write()" implementation doesn't take "mode" argument to open file in "text" mode - writing hgrc file out in binary mode may break backward compatibility
(0) -10000 -3000 -1000 -300 -100 -30 -10 -1 +1 +10 +30 +100 +300 +1000 +3000 +10000 tip