Ejemplo n.º 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'')
Ejemplo n.º 2
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'')
Ejemplo n.º 3
0
Archivo: repo.py Proyecto: zbal/dulwich
 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'), '')
Ejemplo n.º 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'), '')
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 12
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())
Ejemplo n.º 13
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())
Ejemplo n.º 14
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())