diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-11-16 09:30:10 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-11-16 09:30:10 +0100 |
commit | af5abca21b56fcf641ff916bd567680888c364aa (patch) | |
tree | 72503602d20646502e287f2d33c21d68dbebd530 /test/git/test_submodule.py | |
parent | d4fd7fca515ba9b088a7c811292f76f47d16cd7b (diff) | |
download | gitpython-af5abca21b56fcf641ff916bd567680888c364aa.tar.gz |
Added a few utility methods and improved the test. Refs need an improvement though to allow easy configuration of branch-specific settings
Diffstat (limited to 'test/git/test_submodule.py')
-rw-r--r-- | test/git/test_submodule.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/git/test_submodule.py b/test/git/test_submodule.py index 79413a9c..5b1cad6c 100644 --- a/test/git/test_submodule.py +++ b/test/git/test_submodule.py @@ -88,6 +88,10 @@ class TestSubmodule(TestBase): else: # its not checked out in our case self.failUnlessRaises(InvalidGitRepositoryError, sm.module) + assert not sm.module_exists() + + # currently there is only one submodule + assert len(list(rwrepo.iter_submodules())) == 1 # lets update it - its a recursive one too newdir = os.path.join(sm.module_path(), 'dir') @@ -98,12 +102,29 @@ class TestSubmodule(TestBase): os.rmdir(newdir) assert sm.update() is sm + assert sm.module_exists() assert isinstance(sm.module(), git.Repo) assert sm.module().working_tree_dir == sm.module_path() # delete the whole directory and re-initialize shutil.rmtree(sm.module_path()) + sm.update(recursive=False) + assert len(list(rwrepo.iter_submodules())) == 2 + assert len(sm.children()) == 1 # its not checked out yet + csm = sm.children()[0] + assert not csm.module_exists() + + # adjust the path of the submodules module to point to the local destination + new_csm_path = to_native_path_linux(join_path_native(self.rorepo.working_tree_dir, sm.path, csm.path)) + csm.config_writer().set_value('url', new_csm_path) + assert csm.url == new_csm_path + + + # update recuesively again sm.update(recursive=True) + + # this flushed in a sub-submodule + assert len(list(rwrepo.iter_submodules())) == 2 # END handle bare mode |