localrepository: remove None as default value of path argument in __init__()
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 04 Dec 2016 23:22:34 +0530
changeset 30571 91db2aa0edfe
parent 30570 c4c51fd0e11d
child 30572 cfb227016d01
localrepository: remove None as default value of path argument in __init__() The path variable in localrepository.__init__() has a default value None. So it gives us a option to create an object to localrespository class without path variable. But things break if you try to do so. The second line in the init which will be executed when we try to create a localrepository object will call os.path.expandvars(path) which returns TypeError: argument of type 'NoneType' is not iterable I checked occurrences when it is called and can't find any piece of code which calls it without path variable. Also if something is calling it, its should break.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Dec 01 13:12:04 2016 +0530
+++ b/mercurial/localrepo.py	Sun Dec 04 23:22:34 2016 +0530
@@ -249,7 +249,7 @@
     # only functions defined in module of enabled extensions are invoked
     featuresetupfuncs = set()
 
-    def __init__(self, baseui, path=None, create=False):
+    def __init__(self, baseui, path, create=False):
         self.requirements = set()
         self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
         self.wopener = self.wvfs