本文整理汇总了Python中dulwich.config.ConfigFile.set方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigFile.set方法的具体用法?Python ConfigFile.set怎么用?Python ConfigFile.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dulwich.config.ConfigFile
的用法示例。
在下文中一共展示了ConfigFile.set方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_files
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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'')
示例2: _init_files
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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'), '')
示例3: test_write_to_file_subsection
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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())
示例4: test_write_to_file_section
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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())
示例5: test_write_to_file_subsection
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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())
示例6: test_write_to_file_section
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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())
示例7: test_set_hash_gets_quoted
# 需要导入模块: from dulwich.config import ConfigFile [as 别名]
# 或者: from dulwich.config.ConfigFile import set [as 别名]
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())