本文整理汇总了Python中bzrlib.bzrdir.BzrDir.create_standalone_workingtree方法的典型用法代码示例。如果您正苦于以下问题:Python BzrDir.create_standalone_workingtree方法的具体用法?Python BzrDir.create_standalone_workingtree怎么用?Python BzrDir.create_standalone_workingtree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bzrlib.bzrdir.BzrDir
的用法示例。
在下文中一共展示了BzrDir.create_standalone_workingtree方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: newtree_cb
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def newtree_cb(self, menu, vfs_file):
# We can only cope with local files
if vfs_file.get_uri_scheme() != 'file':
return
file = vfs_file.get_uri()
# We only want to continue here if we get a NotBranchError
try:
tree, path = WorkingTree.open_containing(file)
except NotBranchError:
BzrDir.create_standalone_workingtree(file)
示例2: setup_tree
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def setup_tree(self):
wt = BzrDir.create_standalone_workingtree('.')
wt.commit("base A", allow_pointless=True, rev_id='A')
wt.commit("base B", allow_pointless=True, rev_id='B')
wt.commit("base C", allow_pointless=True, rev_id='C')
return wt
示例3: prepare_simple_history
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def prepare_simple_history(self):
"""Prepare and return a working tree with one commit of one file"""
# Commit with modified file should say so
wt = BzrDir.create_standalone_workingtree('.')
self.build_tree(['hello.txt', 'extra.txt'])
wt.add(['hello.txt'])
wt.commit(message='added')
return wt
示例4: test_verbose_commit_with_unknown
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def test_verbose_commit_with_unknown(self):
"""Unknown files should not be listed by default in verbose output"""
# Is that really the best policy?
wt = BzrDir.create_standalone_workingtree('.')
self.build_tree(['hello.txt', 'extra.txt'])
wt.add(['hello.txt'])
out,err = self.run_bzr('commit -m added')
self.assertEqual('', out)
self.assertContainsRe(err, '^Committing to: .*\n'
'added hello\.txt\n'
'Committed revision 1\.\n$')
示例5: make_trees
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def make_trees(self):
grandparent_tree = BzrDir.create_standalone_workingtree('grandparent')
self.build_tree_contents([('grandparent/file1', 'grandparent')])
grandparent_tree.add('file1')
grandparent_tree.commit('initial commit', rev_id='revision1')
parent_bzrdir = grandparent_tree.bzrdir.sprout('parent')
parent_tree = parent_bzrdir.open_workingtree()
parent_tree.commit('next commit', rev_id='revision2')
branch_tree = parent_tree.bzrdir.sprout('branch').open_workingtree()
self.build_tree_contents([('branch/file1', 'branch')])
branch_tree.commit('last commit', rev_id='revision3')
示例6: create_branch_with_one_revision
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def create_branch_with_one_revision(branch_dir, format=None):
"""Create a dummy Bazaar branch at the given directory."""
if not os.path.exists(branch_dir):
os.makedirs(branch_dir)
try:
tree = BzrDir.create_standalone_workingtree(branch_dir, format)
except FileExists:
return
f = open(os.path.join(branch_dir, "hello"), "w")
f.write("foo")
f.close()
tree.commit("message")
return tree
示例7: create_branches
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def create_branches(self):
self.build_tree(['base/', 'base/a', 'base/b'])
format = bzrdir.format_registry.make_bzrdir('knit')
try:
wt_base = BzrDir.create_standalone_workingtree(
self.get_url('base'), format=format)
except errors.NotLocalUrl:
raise TestSkipped('Not a local URL')
b_base = wt_base.branch
wt_base.add('a')
wt_base.add('b')
wt_base.commit('first', rev_id='[email protected]')
wt_child = b_base.bzrdir.sprout('child').open_workingtree()
self.sftp_base = Branch.open(self.get_url('base'))
wt_child.branch.bind(self.sftp_base)
# check the branch histories are ready for using in tests.
self.assertEqual(['[email protected]'], b_base.revision_history())
self.assertEqual(['[email protected]'], wt_child.branch.revision_history())
return b_base, wt_child
示例8: test_simple_binding
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def test_simple_binding(self):
self.build_tree(['base/', 'base/a', 'base/b', 'child/'])
try:
wt_base = BzrDir.create_standalone_workingtree(self.get_url('base'))
except errors.NotLocalUrl:
raise TestSkipped('Not a local URL')
wt_base.add('a')
wt_base.add('b')
wt_base.commit('first', rev_id='[email protected]')
b_base = wt_base.branch
# manually make a branch we can bind, because the default format
# may not be bindable-from, and we want to test the side effects etc
# of bondage.
format = bzrdir.format_registry.make_bzrdir('knit')
b_child = BzrDir.create_branch_convenience('child', format=format)
self.assertEqual(None, b_child.get_bound_location())
self.assertEqual(None, b_child.get_master_branch())
sftp_b_base = Branch.open(self.get_url('base'))
b_child.bind(sftp_b_base)
self.assertEqual(sftp_b_base.base, b_child.get_bound_location())
# the bind must not have given b_child history:
self.assertEqual([], b_child.revision_history())
# we should be able to update the branch at this point:
self.assertEqual(None, b_child.update())
# and now there must be history.
self.assertEqual(['[email protected]'], b_child.revision_history())
# this line is more of a working tree test line, but - what the hey,
# it has work to do.
b_child.bzrdir.open_workingtree().update()
self.failUnlessExists('child/a')
self.failUnlessExists('child/b')
b_child.unbind()
self.assertEqual(None, b_child.get_bound_location())
示例9: prepare_tree
# 需要导入模块: from bzrlib.bzrdir import BzrDir [as 别名]
# 或者: from bzrlib.bzrdir.BzrDir import create_standalone_workingtree [as 别名]
def prepare_tree(self):
return BzrDir.create_standalone_workingtree(".")