summaryrefslogtreecommitdiff
path: root/test/git/test_submodule.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2010-11-16 12:11:29 +0100
committerSebastian Thiel <byronimo@gmail.com>2010-11-16 12:11:29 +0100
commit78d2cd65b8b778f3b0cfef5268b0684314ca22ef (patch)
tree87f116bafa784986585954178e97748db71e23f2 /test/git/test_submodule.py
parent21b4db556619db2ef25f0e0d90fef7e38e6713e5 (diff)
downloadgitpython-78d2cd65b8b778f3b0cfef5268b0684314ca22ef.tar.gz
implemented update to_last_revision option including test. Its now possible to update submodules such as svn-externals
Diffstat (limited to 'test/git/test_submodule.py')
-rw-r--r--test/git/test_submodule.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/git/test_submodule.py b/test/git/test_submodule.py
index 40836e1b..9849a50f 100644
--- a/test/git/test_submodule.py
+++ b/test/git/test_submodule.py
@@ -132,6 +132,29 @@ class TestSubmodule(TestBase):
# this flushed in a sub-submodule
assert len(list(rwrepo.iter_submodules())) == 2
+
+
+ # reset both heads to the previous version, verify that to_latest_revision works
+ for repo in (csm.module(), sm.module()):
+ repo.head.reset('HEAD~1', working_tree=1)
+ # END for each repo to reset
+
+ sm.update(recursive=True, to_latest_revision=True)
+ for repo in (sm.module(), csm.module()):
+ assert repo.head.commit == repo.head.ref.tracking_branch().commit
+ # END for each repo to check
+
+ # if the head is detached, it still works ( but warns )
+ smref = sm.module().head.ref
+ sm.module().head.ref = 'HEAD~1'
+ # if there is no tracking branch, we get a warning as well
+ csm_tracking_branch = csm.module().head.ref.tracking_branch()
+ csm.module().head.ref.set_tracking_branch(None)
+ sm.update(recursive=True, to_latest_revision=True)
+
+ # undo the changes
+ sm.module().head.ref = smref
+ csm.module().head.ref.set_tracking_branch(csm_tracking_branch)
# END handle bare mode