Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite00bf79

Browse files
committed
root submodule: Added parent_commit parameter for convenience. Fixed submodule tests to run
1 parent7076f43 commite00bf79

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

‎git/objects/submodule/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self, repo, binsha, mode=None, path=None, name = None, parent_commi
8989
9090
:param repo: Our parent repository
9191
:param binsha: binary sha referring to a commit in the remote repository, see url parameter
92-
:param parent_commit: see set_parent_commit()
92+
:param parent_commit:a Commit object instance,see set_parent_commit() for more information
9393
:param url: The url to the remote repository which is the submodule
9494
:param branch_path: full (relative) path to ref to checkout when cloning the remote repository"""
9595
super(Submodule,self).__init__(repo,binsha,mode,path)

‎git/objects/submodule/root.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ class RootModule(Submodule):
3737

3838
k_root_name='__ROOT__'
3939

40-
def__init__(self,repo):
41-
# repo, binsha, mode=None, path=None, name = None, parent_commit=None, url=None, ref=None)
40+
def__init__(self,repo,parent_commit=None):
4241
super(RootModule,self).__init__(
4342
repo,
4443
binsha=self.NULL_BIN_SHA,
4544
mode=self.k_default_mode,
4645
path='',
4746
name=self.k_root_name,
48-
parent_commit=repo.head.commit,
47+
parent_commit=parent_commitorrepo.head.commit,
4948
url='',
5049
branch_path=git.Head.to_full_path(self.k_head_default)
5150
)

‎git/test/objects/test_submodule.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,17 @@ def test_base_bare(self, rwrepo):
394394
@with_rw_repo(k_subm_current,bare=False)
395395
deftest_root_module(self,rwrepo):
396396
# Can query everything without problems
397-
rm=RootModule(self.rorepo)
398-
assertrm.module()isself.rorepo
397+
rm=RootModule(rwrepo)
398+
# test new constructor
399+
assertrm.parent_commit==RootModule(self.rorepo,self.rorepo.commit(self.k_subm_current)).parent_commit
400+
assertrm.module()isrwrepo
399401

400402
# try attributes
401403
rm.binsha
402404
rm.mode
403405
rm.path
404406
assertrm.name==rm.k_root_name
405-
assertrm.parent_commit==self.rorepo.head.commit
407+
assertrm.parent_commit==self.rorepo.commit(self.k_subm_current)
406408
rm.url
407409
rm.branch
408410

@@ -412,7 +414,7 @@ def test_root_module(self, rwrepo):
412414

413415
# deep traversal git / async
414416
rsmsp= [sm.pathforsminrm.traverse()]
415-
assertlen(rsmsp)==2#git, async, smmap, async being a child of git.
417+
assertlen(rsmsp)==1#gitdb only - its not yet uptodate so it has no submodule
416418

417419
# cannot set the parent commit as root module's path didn't exist
418420
self.failUnlessRaises(ValueError,rm.set_parent_commit,'HEAD')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp