diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-20 22:01:45 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-20 22:01:45 +0100 |
commit | beccf1907dae129d95cee53ebe61cc8076792d07 (patch) | |
tree | 9732e22a0e677413ec269e8b53ff31aa5b347a25 /lib/git/objects/submodule/base.py | |
parent | ca3fdbe2232ceb2441dedbec1b685466af95e73b (diff) | |
download | gitpython-beccf1907dae129d95cee53ebe61cc8076792d07.tar.gz |
Tried to get rid of held references which could keep a filehandle open. In fact, it didn't work, and ... something else keeps them open. Its odd, its weird, its windows, and I give up on it for now
Diffstat (limited to 'lib/git/objects/submodule/base.py')
-rw-r--r-- | lib/git/objects/submodule/base.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/git/objects/submodule/base.py b/lib/git/objects/submodule/base.py index e9493820..7e0444f1 100644 --- a/lib/git/objects/submodule/base.py +++ b/lib/git/objects/submodule/base.py @@ -24,6 +24,7 @@ import git import os import sys +import time import shutil @@ -586,16 +587,26 @@ class Submodule(util.IndexObject, Iterable, Traversable): if num_branches_with_new_commits == len(rrefs): raise InvalidGitRepositoryError("Cannot delete module at %s as there are new commits" % mod.working_tree_dir) # END handle new commits + # have to manually delete references as python's scoping is + # not existing, they could keep handles open ( on windows this is a problem ) + if len(rrefs): + del(rref) + #END handle remotes + del(rrefs) + del(remote) # END for each remote # gently remove all submodule repositories for sm in self.children(): sm.remove(module=True, force=False, configuration=False, dry_run=dry_run) + del(sm) # END for each child-submodule # finally delete our own submodule if not dry_run: - shutil.rmtree(mod.working_tree_dir) + wtd = mod.working_tree_dir + del(mod) # release file-handles (windows) + shutil.rmtree(wtd) # END delete tree if possible # END handle force # END handle module deletion |