From 8f24f9540afc0db61d197bc4932697737bff1506 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 20 Nov 2010 18:33:43 +0100 Subject: Submodule: Assured we properly convert paths to using the slash separator --- lib/git/objects/submodule/base.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/git/objects/submodule/base.py') diff --git a/lib/git/objects/submodule/base.py b/lib/git/objects/submodule/base.py index 403b2e18..7cc47e4b 100644 --- a/lib/git/objects/submodule/base.py +++ b/lib/git/objects/submodule/base.py @@ -211,6 +211,12 @@ class Submodule(util.IndexObject, Iterable, Traversable): path = path[:-1] # END handle trailing slash + # assure we never put backslashes into the url, as some operating systems + # like it ... + if url != None: + url = to_native_path_linux(url) + #END assure url correctness + # INSTANTIATE INTERMEDIATE SM sm = cls(repo, cls.NULL_BIN_SHA, cls.k_default_mode, path, name) if sm.exists(): -- cgit v1.2.1 From ca3fdbe2232ceb2441dedbec1b685466af95e73b Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 20 Nov 2010 20:46:21 +0100 Subject: submodule.update: now forcing the checkout - see in-code comments --- lib/git/objects/submodule/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/git/objects/submodule/base.py') diff --git a/lib/git/objects/submodule/base.py b/lib/git/objects/submodule/base.py index 7cc47e4b..e9493820 100644 --- a/lib/git/objects/submodule/base.py +++ b/lib/git/objects/submodule/base.py @@ -387,7 +387,11 @@ class Submodule(util.IndexObject, Iterable, Traversable): # update the working tree if mrepo.head.commit.binsha != binsha: if is_detached: - mrepo.git.checkout(hexsha) + # NOTE: for now we force, the user is no supposed to change detached + # submodules anyway. Maybe at some point this becomes an option, to + # properly handle user modifications - see below for future options + # regarding rebase and merge. + mrepo.git.checkout(hexsha, force=True) else: # TODO: allow to specify a rebase, merge, or reset # TODO: Warn if the hexsha forces the tracking branch off the remote -- cgit v1.2.1 From beccf1907dae129d95cee53ebe61cc8076792d07 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 20 Nov 2010 22:01:45 +0100 Subject: 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 --- lib/git/objects/submodule/base.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/git/objects/submodule/base.py') 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 -- cgit v1.2.1