chiark / gitweb /
Remove obsolete files when deleting a branch
authorKarl Hasselström <kha@treskal.com>
Tue, 15 May 2007 19:38:40 +0000 (21:38 +0200)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 15 May 2007 21:39:20 +0000 (22:39 +0100)
Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/stack.py

index 5e8d2d718228e46eab70202c4603e23cf0f587b7..d9c4b99728711210da38e8ec843bc6fc72f9fb7b 100644 (file)
@@ -666,6 +666,15 @@ class Series(StgitObject):
             if os.path.exists(self._dir()+'/orig-base'):
                 os.remove(self._dir()+'/orig-base')
 
             if os.path.exists(self._dir()+'/orig-base'):
                 os.remove(self._dir()+'/orig-base')
 
+            # Remove obsolete files that StGIT no longer uses, but
+            # that might still be around if this is an old repository.
+            for obsolete in ([os.path.join(self._dir(), fn)
+                              for fn in ['current', 'description']]
+                             + [os.path.join(self.__base_dir,
+                                             'refs', 'bases', self.__name)]):
+                if os.path.exists(obsolete):
+                    os.remove(obsolete)
+
             if not os.listdir(self.__patch_dir):
                 os.rmdir(self.__patch_dir)
             else:
             if not os.listdir(self.__patch_dir):
                 os.rmdir(self.__patch_dir)
             else: