small fixes for the parent patch
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 08 Mar 2007 20:08:24 -0300
changeset 4166 c0271aba6abe
parent 4165 0d0f098e5d51
child 4181 ac9e891f2c0f
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
mercurial/localrepo.py
tests/test-init
tests/test-init.out
--- a/mercurial/localrepo.py	Thu Mar 08 16:13:16 2007 -0600
+++ b/mercurial/localrepo.py	Thu Mar 08 20:08:24 2007 -0300
@@ -41,20 +41,19 @@
                 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:
--- a/tests/test-init	Thu Mar 08 16:13:16 2007 -0600
+++ b/tests/test-init	Thu Mar 08 20:08:24 2007 -0300
@@ -22,11 +22,31 @@
 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
 
--- a/tests/test-init.out	Thu Mar 08 16:13:16 2007 -0600
+++ b/tests/test-init.out	Thu Mar 08 20:08:24 2007 -0300
@@ -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