diff options
-rw-r--r-- | project.py | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -770,7 +770,8 @@ class Project(object): | |||
770 | """ | 770 | """ |
771 | cb = self.CurrentBranch | 771 | cb = self.CurrentBranch |
772 | kill = [] | 772 | kill = [] |
773 | for name in self._allrefs.keys(): | 773 | left = self._allrefs |
774 | for name in left.keys(): | ||
774 | if name.startswith(R_HEADS): | 775 | if name.startswith(R_HEADS): |
775 | name = name[len(R_HEADS):] | 776 | name = name[len(R_HEADS):] |
776 | if cb is None or name != cb: | 777 | if cb is None or name != cb: |
@@ -783,14 +784,12 @@ class Project(object): | |||
783 | self.work_git.DetachHead(HEAD) | 784 | self.work_git.DetachHead(HEAD) |
784 | kill.append(cb) | 785 | kill.append(cb) |
785 | 786 | ||
786 | deleted = set() | ||
787 | if kill: | 787 | if kill: |
788 | try: | 788 | try: |
789 | old = self.bare_git.GetHead() | 789 | old = self.bare_git.GetHead() |
790 | except GitError: | 790 | except GitError: |
791 | old = 'refs/heads/please_never_use_this_as_a_branch_name' | 791 | old = 'refs/heads/please_never_use_this_as_a_branch_name' |
792 | 792 | ||
793 | rm_re = re.compile(r"^Deleted branch (.*)\.$") | ||
794 | try: | 793 | try: |
795 | self.bare_git.DetachHead(rev) | 794 | self.bare_git.DetachHead(rev) |
796 | 795 | ||
@@ -802,14 +801,12 @@ class Project(object): | |||
802 | b.Wait() | 801 | b.Wait() |
803 | finally: | 802 | finally: |
804 | self.bare_git.SetHead(old) | 803 | self.bare_git.SetHead(old) |
804 | left = self._allrefs | ||
805 | 805 | ||
806 | for line in b.stdout.split("\n"): | 806 | for branch in kill: |
807 | m = rm_re.match(line) | 807 | if (R_HEADS + branch) not in left: |
808 | if m: | 808 | self.CleanPublishedCache() |
809 | deleted.add(m.group(1)) | 809 | break |
810 | |||
811 | if deleted: | ||
812 | self.CleanPublishedCache() | ||
813 | 810 | ||
814 | if cb and cb not in kill: | 811 | if cb and cb not in kill: |
815 | kill.append(cb) | 812 | kill.append(cb) |
@@ -817,7 +814,7 @@ class Project(object): | |||
817 | 814 | ||
818 | kept = [] | 815 | kept = [] |
819 | for branch in kill: | 816 | for branch in kill: |
820 | if branch not in deleted: | 817 | if (R_HEADS + branch) in left: |
821 | branch = self.GetBranch(branch) | 818 | branch = self.GetBranch(branch) |
822 | base = branch.LocalMerge | 819 | base = branch.LocalMerge |
823 | if not base: | 820 | if not base: |