# HG changeset patch # User Alexis S. L. Carvalho # Date 1173395304 10800 # Node ID c0271aba6abe6f5c9da103bafb10821a84dc6140 # Parent 0d0f098e5d5102d56d27816f42f68c1905dcf209 small fixes for the parent patch - format.usestore is a boolean option - python wart: ("revlogv1") is a string, not a tuple - only create a dummy changelog if we're using a store - add a test diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -41,20 +41,19 @@ class localrepository(repo.repository): if not os.path.exists(path): os.mkdir(path) os.mkdir(self.path) - if parentui.config('format', 'usestore', 1): + requirements = ["revlogv1"] + if parentui.configbool('format', 'usestore', True): os.mkdir(os.path.join(self.path, "store")) - requirements = ("revlogv1", "store") - else: - requirements = ("revlogv1") + requirements.append("store") + # create an invalid changelog + self.opener("00changelog.i", "a").write( + '\0\0\0\2' # represents revlogv2 + ' dummy changelog to prevent using the old repo layout' + ) reqfile = self.opener("requires", "w") for r in requirements: reqfile.write("%s\n" % r) reqfile.close() - # create an invalid changelog - self.opener("00changelog.i", "a").write( - '\0\0\0\2' # represents revlogv2 - ' dummy changelog to prevent using the old repo layout' - ) else: raise repo.RepoError(_("repository %s not found") % path) elif create: diff --git a/tests/test-init b/tests/test-init --- a/tests/test-init +++ b/tests/test-init @@ -22,11 +22,31 @@ echo Got arguments 1:$1 2:$2 3:$3 4:$4 5 EOF chmod +x dummyssh +checknewrepo() +{ + name=$1 + + if [ -d $name/.hg/store ]; then + echo store created + fi + + if [ -f $name/.hg/00changelog.i ]; then + echo 00changelog.i created + fi + + cat $name/.hg/requires +} + echo "# creating 'local'" hg init local +checknewrepo local echo this > local/foo hg ci --cwd local -A -m "init" -d "1000000 0" +echo "# creating repo with old format" +hg --config format.usestore=false init old +checknewrepo old + echo "#test failure" hg init local diff --git a/tests/test-init.out b/tests/test-init.out --- a/tests/test-init.out +++ b/tests/test-init.out @@ -1,5 +1,11 @@ # creating 'local' +store created +00changelog.i created +revlogv1 +store adding foo +# creating repo with old format +revlogv1 #test failure abort: repository local already exists! # init+push to remote2