From 0e72a26117fb0098dbff4ea588e63a345e141089 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Fri, 20 Feb 2009 10:28:56 -0500 Subject: [PATCH] workdir: override cmd_branch Prevent deleting a branch that is checked-out in another working copy --- plugins/workdir.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/workdir.py b/plugins/workdir.py index 9b4b3d6..51acd1b 100644 --- a/plugins/workdir.py +++ b/plugins/workdir.py @@ -110,6 +110,19 @@ class WorkdirPlugin(YapCore): print "Workdir created at %s for branch %s" % (workdir, branch) + def cmd_branch(self, *args, **flags): + if '-d' in flags: + branch = flags['-d'] + repodir = self._get_repodir() + self._lock_branch(branch, repodir) + else: + branch = None + + super(WorkdirPlugin, self).cmd_branch(*args, **flags) + + if branch: + self._unlock_branch(branch) + def cmd_switch(self, branch, *args, **flags): self._check_git() -- 2.11.4.GIT