subrepo: avoid redundant "util.makedirs" invocation
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Wed, 19 Nov 2014 18:35:14 +0900
changeset 23363 55525924af43
parent 23362 cc83cac41619
child 23364 83736508e98a
subrepo: avoid redundant "util.makedirs" invocation "util.makedirs" for the (sub-)repository root of "hgsubrepo" is also executed in the constructor of "localrepository", if "create" is True and ".hg" of it doesn't exist. This patch avoids redundant "util.makedirs" invocation in the constructor of "hgsubrepo".
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Wed Nov 19 08:50:08 2014 -0800
+++ b/mercurial/subrepo.py	Wed Nov 19 18:35:14 2014 +0900
@@ -522,10 +522,7 @@
         self._state = state
         r = ctx._repo
         root = r.wjoin(path)
-        create = False
-        if not os.path.exists(os.path.join(root, '.hg')):
-            create = True
-            util.makedirs(root)
+        create = not os.path.exists(os.path.join(root, '.hg'))
         self._repo = hg.repository(r.baseui, root, create=create)
         for s, k in [('ui', 'commitsubrepos')]:
             v = r.ui.config(s, k)