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

Commitbb0f3d7

Browse files
committed
Fixed flake8 and a minor test regression.
The latter happened as now BadName is thrown, instead of BadObject.Changes.rst was marked accordingly
1 parente492113 commitbb0f3d7

File tree

6 files changed

+34
-30
lines changed

6 files changed

+34
-30
lines changed

‎doc/source/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Changelog
88
* `[include]` sections in git configuration files are now respected
99
* Added `GitConfigParser.rename_section()`
1010
* Added `Submodule.rename()`
11+
* **POSSIBLY BREAKING CHANGE**: As `rev_parse` will now throw `BadName` as well as `BadObject`, client code will have to catch both exception types.
1112
* A list of all issues can be found here: https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v0.3.6+-+Features%22+
1213

1314
0.3.5 - Bugfixes

‎git/objects/submodule/base.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _set_cache_(self, attr):
116116
exceptcp.NoSectionError:
117117
raiseValueError("This submodule instance does not exist anymore in '%s' file"
118118
%os.path.join(self.repo.working_tree_dir,'.gitmodules'))
119-
# end
119+
# end
120120
self._url=reader.get_value('url')
121121
# git-python extension values - optional
122122
self._branch_path=reader.get_value(self.k_head_option,git.Head.to_full_path(self.k_head_default))
@@ -411,7 +411,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False):
411411
del(writer)
412412

413413
# we deliberatly assume that our head matches our index !
414-
414+
415415
try:
416416
repo.head.commit
417417
parent_repo_is_empty=False
@@ -429,7 +429,7 @@ def add(cls, repo, name, path, url=None, branch=None, no_checkout=False):
429429
returnsm
430430

431431
defupdate(self,recursive=False,init=True,to_latest_revision=False,progress=None,dry_run=False,
432-
force=False,keep_going=False):
432+
force=False,keep_going=False):
433433
"""Update the repository of this submodule to point to the checkout
434434
we point at with the binsha of this instance.
435435
@@ -444,14 +444,14 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
444444
:param progress: UpdateProgress instance or None of no progress should be shown
445445
:param dry_run: if True, the operation will only be simulated, but not performed.
446446
All performed operations are read-only
447-
:param force:
447+
:param force:
448448
If True, we may reset heads even if the repository in question is dirty. Additinoally we will be allowed
449-
to set a tracking branch which is ahead of its remote branch back into the past or the location of the
449+
to set a tracking branch which is ahead of its remote branch back into the past or the location of the
450450
remote branch. This will essentially 'forget' commits.
451-
If False, local tracking branches that are in the future of their respective remote branches will simply
451+
If False, local tracking branches that are in the future of their respective remote branches will simply
452452
not be moved.
453-
:param keep_going: if True, we will ignore but log all errors, and keep going recursively.
454-
Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see
453+
:param keep_going: if True, we will ignore but log all errors, and keep going recursively.
454+
Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see
455455
otherwise.
456456
In conjunction with dry_run, it can be useful to anticipate all errors when updating submodules
457457
:note: does nothing in bare repositories
@@ -487,7 +487,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
487487
op|=BEGIN
488488
# END handle start
489489

490-
progress.update(op,i,len_rmts,prefix+"Fetching remote %s of submodule %r"% (remote,self.name))
490+
progress.update(op,i,len_rmts,prefix+"Fetching remote %s of submodule %r"
491+
% (remote,self.name))
491492
#===============================
492493
ifnotdry_run:
493494
remote.fetch(progress=progress)
@@ -589,11 +590,11 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
589590
base_commit=mrepo.merge_base(mrepo.head.commit,hexsha)
590591
iflen(base_commit)==0orbase_commit[0].hexsha==hexsha:
591592
ifforce:
592-
log.debug("Will force checkout or reset on local branch that is possibly in the future of"+
593-
"the commit it will be checked out to, effectively 'forgetting' new commits")
593+
log.debug("Will force checkout or reset on local branch that is possibly in the future of"
594+
+"the commit it will be checked out to, effectively 'forgetting' new commits")
594595
else:
595-
log.info("Skipping %s on branch '%s' of submodule repo '%s' as it containsun-pushed commits",
596-
is_detachedand"checkout"or"reset",mrepo.head,mrepo)
596+
log.info("Skipping %s on branch '%s' of submodule repo '%s' as it contains"
597+
+"un-pushed commits",is_detachedand"checkout"or"reset",mrepo.head,mrepo)
597598
may_reset=False
598599
# end handle force
599600
# end handle if we are in the future
@@ -619,7 +620,8 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
619620
mrepo.head.reset(hexsha,index=True,working_tree=True)
620621
# END handle checkout
621622
# if we may reset/checkout
622-
progress.update(END|UPDWKTREE,0,1,prefix+"Done updating working tree for submodule %r"%self.name)
623+
progress.update(END|UPDWKTREE,0,1,prefix+"Done updating working tree for submodule %r"
624+
%self.name)
623625
# END update to new commit only if needed
624626
exceptExceptionaserr:
625627
ifnotkeep_going:
@@ -633,7 +635,7 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
633635
# in dry_run mode, the module might not exist
634636
ifmrepoisnotNone:
635637
forsubmoduleinself.iter_items(self.module()):
636-
submodule.update(recursive,init,to_latest_revision,progress=progress,dry_run=dry_run,
638+
submodule.update(recursive,init,to_latest_revision,progress=progress,dry_run=dry_run,
637639
force=force,keep_going=keep_going)
638640
# END handle recursive update
639641
# END handle dry run
@@ -898,14 +900,14 @@ def set_parent_commit(self, commit, check=True):
898900
"""Set this instance to use the given commit whose tree is supposed to
899901
contain the .gitmodules blob.
900902
901-
:param commit:
902-
Commit'ish reference pointing at the root_tree, or None to always point to the
903+
:param commit:
904+
Commit'ish reference pointing at the root_tree, or None to always point to the
903905
most recent commit
904906
:param check:
905907
if True, relatively expensive checks will be performed to verify
906908
validity of the submodule.
907909
:raise ValueError: if the commit's tree didn't contain the .gitmodules blob.
908-
:raise ValueError:
910+
:raise ValueError:
909911
if the parent commit didn't store this submodule under the current path
910912
:return: self"""
911913
ifcommitisNone:

‎git/objects/submodule/root.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init=
8585
Unless force_reset is specified, a local tracking branch will never be reset into its past, therefore
8686
the remote branch must be in the future for this to have an effect.
8787
:param force_reset: if True, submodules may checkout or reset their branch even if the repository has
88-
pending changes that would be overwritten, or if the local tracking branch is in the future of the
88+
pending changes that would be overwritten, or if the local tracking branch is in the future of the
8989
remote tracking branch and would be reset into its past.
9090
:param progress: RootUpdateProgress instance or None if no progress should be sent
9191
:param dry_run: if True, operations will not actually be performed. Progress messages
9292
will change accordingly to indicate the WOULD DO state of the operation.
93-
:param keep_going: if True, we will ignore but log all errors, and keep going recursively.
94-
Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see
93+
:param keep_going: if True, we will ignore but log all errors, and keep going recursively.
94+
Unless dry_run is set as well, keep_going could cause subsequent/inherited errors you wouldn't see
9595
otherwise.
9696
In conjunction with dry_run, it can be useful to anticipate all errors when updating submodules
9797
:return: self"""
@@ -136,7 +136,7 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init=
136136
###################
137137
rrsm= (spsms-ssms)
138138
len_rrsm=len(rrsm)
139-
139+
140140
fori,rsminenumerate(rrsm):
141141
op=REMOVE
142142
ifi==0:
@@ -168,7 +168,8 @@ def update(self, previous_commit=None, recursive=True, force_remove=False, init=
168168
##############
169169
ifsm.path!=psm.pathandpsm.module_exists():
170170
progress.update(BEGIN|PATHCHANGE,i,len_csms,prefix+
171-
"Moving repository of submodule %r from %s to %s"% (sm.name,psm.abspath,sm.abspath))
171+
"Moving repository of submodule %r from %s to %s"
172+
% (sm.name,psm.abspath,sm.abspath))
172173
# move the module to the new path
173174
ifnotdry_run:
174175
psm.move(sm.path,module=True,configuration=False)

‎git/test/test_repo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,8 @@ def test_rev_parse(self):
591591
commit=rev_parse(first_rev)
592592
assertlen(commit.parents)==0
593593
assertcommit.hexsha==first_rev
594-
self.failUnlessRaises(BadObject,rev_parse,first_rev+"~")
595-
self.failUnlessRaises(BadObject,rev_parse,first_rev+"^")
594+
self.failUnlessRaises(BadName,rev_parse,first_rev+"~")
595+
self.failUnlessRaises(BadName,rev_parse,first_rev+"^")
596596

597597
# short SHA1
598598
commit2=rev_parse(first_rev[:20])

‎git/test/test_submodule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def test_root_module(self, rwrepo):
535535
touch(nsm_file)
536536
nsm.module().index.add([nsm])
537537
nsm.module().index.commit("added new file")
538-
rm.update(recursive=False,dry_run=True,progress=prog)# would not change head, and thus doens't fail
538+
rm.update(recursive=False,dry_run=True,progress=prog)# would not change head, and thus doens't fail
539539
# Everything we can do from now on will trigger the 'future' check, so no is_dirty() check will even run
540540
# This would only run if our local branch is in the past and we have uncommitted changes
541541

@@ -691,7 +691,7 @@ def test_git_submodule_compatibility(self, rwdir):
691691
defassert_exists(sm,value=True):
692692
assertsm.exists()==value
693693
assertsm.module_exists()==value
694-
# end
694+
# end
695695

696696
# As git is backwards compatible itself, it would still recognize what we do here ... unless we really
697697
# muss it up. That's the only reason why the test is still here ... .

‎git/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ def _parse_progress_line(self, line):
251251
message=message[:-len(done_token)]
252252
# END end message handling
253253

254-
self.update(op_code,
255-
cur_countandfloat(cur_count),
256-
max_countandfloat(max_count),
254+
self.update(op_code,
255+
cur_countandfloat(cur_count),
256+
max_countandfloat(max_count),
257257
message)
258258
# END for each sub line
259259
returnfailed_lines

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp