Exemple #1
0
    def _init_files(self, bare):
        """Initialize a default set of named files."""
        from dulwich.config import ConfigFile
        self._put_named_file('description', b"Unnamed repository")
        f = BytesIO()
        cf = ConfigFile()
        cf.set(b"core", b"repositoryformatversion", b"0")
        if self._determine_file_mode():
            cf.set(b"core", b"filemode", True)
        else:
            cf.set(b"core", b"filemode", False)

        cf.set(b"core", b"bare", bare)
        cf.set(b"core", b"logallrefupdates", True)
        cf.write_to_file(f)
        self._put_named_file('config', f.getvalue())
        self._put_named_file(os.path.join('info', 'exclude'), b'')
    def _init_files(self, bare):
        """Initialize a default set of named files."""
        from dulwich.config import ConfigFile
        self._put_named_file('description', b"Unnamed repository")
        f = BytesIO()
        cf = ConfigFile()
        cf.set(b"core", b"repositoryformatversion", b"0")
        if self._determine_file_mode():
            cf.set(b"core", b"filemode", True)
        else:
            cf.set(b"core", b"filemode", False)

        cf.set(b"core", b"bare", bare)
        cf.set(b"core", b"logallrefupdates", True)
        cf.write_to_file(f)
        self._put_named_file('config', f.getvalue())
        self._put_named_file(os.path.join('info', 'exclude'), b'')
Exemple #3
0
 def _init_files(self, bare):
     """Initialize a default set of named files."""
     from dulwich.config import ConfigFile
     self._put_named_file('description', "Unnamed repository")
     f = StringIO()
     cf = ConfigFile()
     cf.set("core", "repositoryformatversion", "0")
     cf.set("core", "filemode", "true")
     cf.set("core", "bare", str(bare).lower())
     cf.set("core", "logallrefupdates", "true")
     cf.write_to_file(f)
     self._put_named_file('config', f.getvalue())
     self._put_named_file(os.path.join('info', 'exclude'), '')
Exemple #4
0
 def _init_files(self, bare):
     """Initialize a default set of named files."""
     from dulwich.config import ConfigFile
     self._put_named_file('description', "Unnamed repository")
     f = StringIO()
     cf = ConfigFile()
     cf.set("core", "repositoryformatversion", "0")
     cf.set("core", "filemode", "true")
     cf.set("core", "bare", str(bare).lower())
     cf.set("core", "logallrefupdates", "true")
     cf.write_to_file(f)
     self._put_named_file('config', f.getvalue())
     self._put_named_file(os.path.join('info', 'exclude'), '')
Exemple #5
0
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set(("branch", "blie"), "foo", "bar")
     f = StringIO()
     c.write_to_file(f)
     self.assertEqual("[branch \"blie\"]\nfoo = bar\n", f.getvalue())
Exemple #6
0
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set(("core", ), "foo", "bar")
     f = StringIO()
     c.write_to_file(f)
     self.assertEqual("[core]\nfoo = bar\n", f.getvalue())
Exemple #7
0
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set(("branch", "blie"), "foo", "bar")
     f = StringIO()
     c.write_to_file(f)
     self.assertEquals("[branch \"blie\"]\nfoo = bar\n", f.getvalue())
Exemple #8
0
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set(("core", ), "foo", "bar")
     f = StringIO()
     c.write_to_file(f)
     self.assertEquals("[core]\nfoo = bar\n", f.getvalue())
Exemple #9
0
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set((b"branch", b"blie"), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[branch \"blie\"]\n\tfoo = bar\n", f.getvalue())
Exemple #10
0
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set((b"core", ), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[core]\n\tfoo = bar\n", f.getvalue())
Exemple #11
0
 def test_set_hash_gets_quoted(self):
     c = ConfigFile()
     c.set(b"xandikos", b"color", b"#665544")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[xandikos]\n\tcolor = \"#665544\"\n", f.getvalue())
 def test_set_hash_gets_quoted(self):
     c = ConfigFile()
     c.set(b"xandikos", b"color", b"#665544")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[xandikos]\n\tcolor = \"#665544\"\n", f.getvalue())
 def test_write_to_file_subsection(self):
     c = ConfigFile()
     c.set((b"branch", b"blie"), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[branch \"blie\"]\n\tfoo = bar\n", f.getvalue())
 def test_write_to_file_section(self):
     c = ConfigFile()
     c.set((b"core", ), b"foo", b"bar")
     f = BytesIO()
     c.write_to_file(f)
     self.assertEqual(b"[core]\n\tfoo = bar\n", f.getvalue())