def run(self): try: loom_branch.require_loom_branch(self.branch) except loom_branch.NotALoom: response = question_dialog( _i18n("Upgrade to Loom branch?"), _i18n("Branch is not a loom branch. Upgrade to Loom format?"), parent=self) # Doesn't set a parent for the dialog.. if response == Gtk.ResponseType.NO: return assert self.branch.nick is not None loom_branch.loomify(self.branch) self._load_threads() return super(LoomDialog, self).run()
def makeLoomBranchAndTree(self, tree_directory): """Make a looms-enabled branch and working tree.""" tree = self.make_branch_and_tree(tree_directory) tree.lock_write() try: tree.branch.nick = "bottom-thread" loom_branch.loomify(tree.branch) finally: tree.unlock() loom_tree = tree.bzrdir.open_workingtree() loom_tree.lock_write() loom_tree.branch.new_thread("bottom-thread") loom_tree.commit("this is a commit", rev_id="commit-1") loom_tree.unlock() loom_tree.branch.record_loom("sample loom") return loom_tree
def loomify(self, branch): tree = branch.create_checkout("checkout") tree.lock_write() try: tree.branch.nick = "bottom-thread" loom_branch.loomify(tree.branch) finally: tree.unlock() loom_tree = tree.bzrdir.open_workingtree() loom_tree.lock_write() loom_tree.branch.new_thread("bottom-thread") loom_tree.commit("this is a commit", rev_id="commit-1") loom_tree.unlock() loom_tree.branch.record_loom("sample loom") self.get_transport().delete_tree("checkout") return loom_tree
def makeLoomBranchAndTree(self, tree_directory): """Make a looms-enabled branch and working tree.""" tree = self.make_branch_and_tree(tree_directory) tree.lock_write() try: tree.branch.nick = 'bottom-thread' loom_branch.loomify(tree.branch) finally: tree.unlock() loom_tree = tree.bzrdir.open_workingtree() loom_tree.lock_write() loom_tree.branch.new_thread('bottom-thread') loom_tree.commit('this is a commit', rev_id='commit-1') loom_tree.unlock() loom_tree.branch.record_loom('sample loom') return loom_tree
def loomify(self, branch): tree = branch.create_checkout('checkout') tree.lock_write() try: tree.branch.nick = 'bottom-thread' loom_branch.loomify(tree.branch) finally: tree.unlock() loom_tree = tree.bzrdir.open_workingtree() loom_tree.lock_write() loom_tree.branch.new_thread('bottom-thread') loom_tree.commit('this is a commit', rev_id='commit-1') loom_tree.unlock() loom_tree.branch.record_loom('sample loom') self.get_transport().delete_tree('checkout') return loom_tree
def prepare(self, format='pack-0.92', loomify_branch=False): """Prepare an upgrade test. :param format: The branch format to use, as a string. :param loomify_branch: If true, convert the branch to a loom. """ self.useBzrBranches(direct_database=True) branch, tree = self.create_branch_and_tree(format=format) tree.commit('foo', rev_id='prepare-commit', committer='*****@*****.**') if loomify_branch: loomify(tree.branch) bzr_branch = tree.bzrdir.open_branch() else: bzr_branch = tree.branch return self.getUpgrader(bzr_branch, branch)