@@ -172,14 +172,16 @@ def _do_base_tests(self, rwrepo):
172
172
173
173
174
174
# reset both heads to the previous version, verify that to_latest_revision works
175
- for repo in (csm .module (), sm .module ()):
175
+ smods = (sm .module (), csm .module ())
176
+ for repo in smods :
176
177
repo .head .reset ('HEAD~1' , working_tree = 1 )
177
178
# END for each repo to reset
178
179
179
180
sm .update (recursive = True , to_latest_revision = True )
180
- for repo in ( sm . module (), csm . module ()) :
181
+ for repo in smods :
181
182
assert repo .head .commit == repo .head .ref .tracking_branch ().commit
182
183
# END for each repo to check
184
+ del (smods )
183
185
184
186
# if the head is detached, it still works ( but warns )
185
187
smref = sm .module ().head .ref
@@ -356,8 +358,8 @@ def test_root_module(self, rwrepo):
356
358
rm .config_writer ()
357
359
358
360
# deep traversal gitdb / async
359
- rsms = list ( rm .traverse ())
360
- assert len (rsms ) == 2 # gitdb and async, async being a child of gitdb
361
+ rsmsp = [ sm . path for sm in rm .traverse ()]
362
+ assert len (rsmsp ) == 2 # gitdb and async, async being a child of gitdb
361
363
362
364
# cannot set the parent commit as root module's path didn't exist
363
365
self .failUnlessRaises (ValueError , rm .set_parent_commit , 'HEAD' )
@@ -406,9 +408,9 @@ def test_root_module(self, rwrepo):
406
408
#================
407
409
nsmn = "newsubmodule"
408
410
nsmp = "submrepo"
409
- async_url = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsms [0 ]. path , rsms [1 ]. path ))
411
+ async_url = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsmsp [0 ], rsmsp [1 ]))
410
412
nsm = Submodule .add (rwrepo , nsmn , nsmp , url = async_url )
411
- csmadded = rwrepo .index .commit ("Added submodule" )
413
+ csmadded = rwrepo .index .commit ("Added submodule" ). hexsha # make sure we don't keep the repo reference
412
414
nsm .set_parent_commit (csmadded )
413
415
assert nsm .module_exists ()
414
416
# in our case, the module should not exist, which happens if we update a parent
@@ -439,7 +441,7 @@ def test_root_module(self, rwrepo):
439
441
# to the first repository, this way we have a fast checkout, and a completely different
440
442
# repository at the different url
441
443
nsm .set_parent_commit (csmremoved )
442
- nsmurl = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsms [0 ]. path ))
444
+ nsmurl = to_native_path_linux (join_path_native (self .rorepo .working_tree_dir , rsmsp [0 ]))
443
445
nsm .config_writer ().set_value ('url' , nsmurl )
444
446
csmpathchange = rwrepo .index .commit ("changed url" )
445
447
nsm .set_parent_commit (csmpathchange )
0 commit comments