def switch_to_branch(self, s_name): """Switch to the named branch.""" if not dmtcpmanager.branch_exists(s_name): fredutil.fred_error("Branch '%s' does not exist." % s_name) return for b in self.l_branches: if b.get_name() == s_name: self.branch = b dmtcpmanager.switch_branch(s_name) # Switching to branches always restarts in ckpt 0: self.branch.set_current_checkpoint(self.branch.get_checkpoint(0)) self.update_state() fredutil.fred_info("Switched to branch '%s'." % s_name)
def do_branch(self, s_name): """Create and switch to a new branch named s_name.""" if dmtcpmanager.branch_exists(s_name): fredutil.fred_error("Branch '%s' already exists." % s_name) return self.branch = Branch(s_name) self.l_branches.append(self.branch) dmtcpmanager.create_branch(s_name) # Creating branches always creates ckpt 0: self.branch.add_checkpoint(Checkpoint(0)) self.branch.set_current_checkpoint(self.branch.get_checkpoint(0)) self.update_state() fredutil.fred_info("Now in new branch '%s'." % s_name)