summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2008-11-03 11:24:59 -0800
committerShawn O. Pearce <sop@google.com>2008-11-03 11:24:59 -0800
commit9fa44db94bfabcf43160316660801a2c1db2dbb9 (patch)
tree4a8ffcba60cfd6c02e88c9f401a66d4cab1b18b0 /project.py
parentc9ef744c7b5f6bcab446cf0a0bc9cc1b016dd5f8 (diff)
downloadgit-repo-9fa44db94bfabcf43160316660801a2c1db2dbb9.tar.gz
Introduce 'repo abandon <branchname>' as an alias for 'git branch -D'v1.0.9
This destroys a local development branch, removing all history of that branch from ever existing. If the branch is currently checked out we move back to the upstream revision. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/project.py b/project.py
index f963576b..0637f4bf 100644
--- a/project.py
+++ b/project.py
@@ -710,6 +710,22 @@ class Project(object):
710 else: 710 else:
711 raise GitError('%s checkout %s ' % (self.name, rev)) 711 raise GitError('%s checkout %s ' % (self.name, rev))
712 712
713 def AbandonBranch(self, name):
714 """Destroy a local topic branch.
715 """
716 try:
717 tip_rev = self.bare_git.rev_parse(R_HEADS + name)
718 except GitError:
719 return
720
721 if self.CurrentBranch == name:
722 self._Checkout(
723 self.GetRemote(self.remote.name).ToLocal(self.revision),
724 quiet=True)
725
726 cmd = ['branch', '-D', name]
727 GitCommand(self, cmd, capture_stdout=True).Wait()
728
713 def PruneHeads(self): 729 def PruneHeads(self):
714 """Prune any topic branches already merged into upstream. 730 """Prune any topic branches already merged into upstream.
715 """ 731 """