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

Commit9519f18

Browse files
committed
Fixed all imports, refactoring appears to be complete
1 parent4c34d5c commit9519f18

File tree

6 files changed

+45
-14
lines changed

6 files changed

+45
-14
lines changed

‎lib/git/objects/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
"""
44
importinspect
55
frombaseimport*
6+
# Fix import dependency - add IndexObject to the util module, so that it can be
7+
# imported by the submodule.base
8+
importsubmodule.util
9+
submodule.util.IndexObject=IndexObject
10+
fromsubmodule.baseimport*
11+
fromsubmodule.rootimport*
12+
13+
# must come after submodule was made available
614
fromtagimport*
715
fromblobimport*
8-
fromtreeimport*
916
fromcommitimport*
10-
fromsubmoduleimport*
17+
fromtreeimport*
1118
fromutilimportActor
1219

1320
__all__= [nameforname,objinlocals().items()

‎lib/git/objects/submodule/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11

2-
frombaseimport*
3-
fromrootimport*

‎lib/git/objects/submodule/base.py

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1-
importgit.objects.base
2-
fromutilimport*
1+
importutil
2+
fromutilimport (
3+
mkhead,
4+
sm_name,
5+
sm_section,
6+
unbare_repo,
7+
SubmoduleConfigParser,
8+
find_first_remote_branch
9+
)
310
fromgit.objects.utilimportTraversable
411
fromStringIOimportStringIO# need a dict to set bloody .name field
5-
fromgit.utilimportIterable,join_path_native,to_native_path_linux
12+
fromgit.utilimport (
13+
Iterable,
14+
join_path_native,
15+
to_native_path_linux
16+
)
617
fromgit.configimportSectionConstraint
7-
fromgit.excimportInvalidGitRepositoryError,NoSuchPathError
18+
fromgit.excimport (
19+
InvalidGitRepositoryError,
20+
NoSuchPathError
21+
)
822
importstat
923
importgit
1024

@@ -13,11 +27,13 @@
1327

1428
importshutil
1529

16-
__all__=("Submodule","RootModule")
30+
__all__=["Submodule"]
1731

1832

19-
20-
classSubmodule(git.objects.base.IndexObject,Iterable,Traversable):
33+
# IndexObject comes via util module, its a 'hacky' fix thanks to pythons import
34+
# mechanism which cause plenty of trouble of the only reason for packages and
35+
# modules is refactoring - subpackages shoudn't depend on parent packages
36+
classSubmodule(util.IndexObject,Iterable,Traversable):
2137
"""Implements access to a git submodule. They are special in that their sha
2238
represents a commit in the submodule's repository which is to be checked out
2339
at the path of this instance.
@@ -41,6 +57,7 @@ class Submodule(git.objects.base.IndexObject, Iterable, Traversable):
4157
def__init__(self,repo,binsha,mode=None,path=None,name=None,parent_commit=None,url=None,branch=None):
4258
"""Initialize this instance with its attributes. We only document the ones
4359
that differ from ``IndexObject``
60+
4461
:param repo: Our parent repository
4562
:param binsha: binary sha referring to a commit in the remote repository, see url parameter
4663
:param parent_commit: see set_parent_commit()
@@ -163,6 +180,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False):
163180
as well as the .gitmodules file, but will not create a new commit.
164181
If the submodule already exists, no matter if the configuration differs
165182
from the one provided, the existing submodule will be returned.
183+
166184
:param repo: Repository instance which should receive the submodule
167185
:param name: The name/identifier for the submodule
168186
:param path: repository-relative or absolute path at which the submodule
@@ -260,6 +278,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False):
260278
defupdate(self,recursive=False,init=True,to_latest_revision=False):
261279
"""Update the repository of this submodule to point to the checkout
262280
we point at with the binsha of this instance.
281+
263282
:param recursive: if True, we will operate recursively and update child-
264283
modules as well.
265284
:param init: if True, the module repository will be cloned into place if necessary
@@ -382,6 +401,7 @@ def move(self, module_path, configuration=True, module=True):
382401
"""Move the submodule to a another module path. This involves physically moving
383402
the repository at our current path, changing the configuration, as well as
384403
adjusting our index entry accordingly.
404+
385405
:param module_path: the path to which to move our module, given as
386406
repository-relative path. Intermediate directories will be created
387407
accordingly. If the path already exists, it must be empty.
@@ -484,6 +504,7 @@ def move(self, module_path, configuration=True, module=True):
484504
defremove(self,module=True,force=False,configuration=True,dry_run=False):
485505
"""Remove this submodule from the repository. This will remove our entry
486506
from the .gitmodules file and the entry in the .git/config file.
507+
487508
:param module: If True, the module we point to will be deleted
488509
as well. If the module is currently on a commit which is not part
489510
of any branch in the remote, if the currently checked out branch
@@ -588,6 +609,7 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
588609
defset_parent_commit(self,commit,check=True):
589610
"""Set this instance to use the given commit whose tree is supposed to
590611
contain the .gitmodules blob.
612+
591613
:param commit: Commit'ish reference pointing at the root_tree
592614
:param check: if True, relatively expensive checks will be performed to verify
593615
validity of the submodule.

‎lib/git/objects/submodule/root.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
frombaseimportSubmodule
2+
fromutilimport (
3+
mkhead,
4+
find_first_remote_branch
5+
)
26
fromgit.excimportInvalidGitRepositoryError
37
importgit
48

‎lib/git/objects/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
frombaseimportIndexObject
88
fromgit.utilimportjoin_path
99
fromblobimportBlob
10-
fromsubmoduleimportSubmodule
10+
fromsubmodule.baseimportSubmodule
1111
importgit.diffasdiff
1212

1313
fromfunimport (

‎test/git/test_submodule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
fromtest.testlibimport*
55
fromgit.excimport*
6-
fromgit.objects.submoduleimport*
6+
fromgit.objects.submodule.baseimportSubmodule
7+
fromgit.objects.submodule.rootimportRootModule
78
fromgit.utilimportto_native_path_linux,join_path_native
89
importshutil
910
importgit
@@ -315,7 +316,6 @@ def _do_base_tests(self, rwrepo):
315316
# Error if there is no submodule file here
316317
self.failUnlessRaises(IOError,Submodule._config_parser,rwrepo,rwrepo.commit(self.k_no_subm_tag),True)
317318

318-
319319
@with_rw_repo(k_subm_current)
320320
deftest_base_rw(self,rwrepo):
321321
self._do_base_tests(rwrepo)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp