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

Commit411635f

Browse files
cool-RRByron
authored andcommitted
Fix exception causes all over the codebase
1 parent99ba753 commit411635f

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

‎git/__init__.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def _init_externals():
2323

2424
try:
2525
importgitdb
26-
exceptImportError:
27-
raiseImportError("'gitdb' could not be found in your PYTHONPATH")
26+
exceptImportErrorase:
27+
raiseImportError("'gitdb' could not be found in your PYTHONPATH")frome
2828
# END verify import
2929

3030
#} END initialization
@@ -54,7 +54,7 @@ def _init_externals():
5454
rmtree,
5555
)
5656
exceptGitErrorasexc:
57-
raiseImportError('%s: %s'% (exc.__class__.__name__,exc))
57+
raiseImportError('%s: %s'% (exc.__class__.__name__,exc))fromexc
5858

5959
#} END imports
6060

@@ -82,5 +82,5 @@ def refresh(path=None):
8282
try:
8383
refresh()
8484
exceptExceptionasexc:
85-
raiseImportError('Failed to initialize: {0}'.format(exc))
85+
raiseImportError('Failed to initialize: {0}'.format(exc))fromexc
8686
#################

‎git/db.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def partial_to_complete_sha_hex(self, partial_hexsha):
5353
try:
5454
hexsha,_typename,_size=self._git.get_object_header(partial_hexsha)
5555
returnhex_to_bin(hexsha)
56-
except (GitCommandError,ValueError):
57-
raiseBadObject(partial_hexsha)
56+
except (GitCommandError,ValueError)ase:
57+
raiseBadObject(partial_hexsha)frome
5858
# END handle exceptions
5959

6060
#} END interface

‎git/index/base.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ def _write_path_to_stdin(self, proc, filepath, item, fmakeexc, fprogress,
420420
rval=None
421421
try:
422422
proc.stdin.write(("%s\n"%filepath).encode(defenc))
423-
exceptIOError:
423+
exceptIOErrorase:
424424
# pipe broke, usually because some error happened
425-
raisefmakeexc()
425+
raisefmakeexc()frome
426426
# END write exception handling
427427
proc.stdin.flush()
428428
ifread_from_stdout:
@@ -954,7 +954,7 @@ def commit(self, message, parent_commits=None, head=True, author=None,
954954
ifnotskip_hooks:
955955
run_commit_hook('post-commit',self)
956956
returnrval
957-
957+
958958
def_write_commit_editmsg(self,message):
959959
withopen(self._commit_editmsg_filepath(),"wb")ascommit_editmsg_file:
960960
commit_editmsg_file.write(message.encode(defenc))

‎git/index/fun.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def run_commit_hook(name, index, *args):
8282
close_fds=is_posix,
8383
creationflags=PROC_CREATIONFLAGS,)
8484
exceptExceptionasex:
85-
raiseHookExecutionError(hp,ex)
85+
raiseHookExecutionError(hp,ex)fromex
8686
else:
8787
stdout= []
8888
stderr= []

‎git/objects/submodule/base.py‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def _set_cache_(self, attr):
121121
# default submodule values
122122
try:
123123
self.path=reader.get('path')
124-
exceptcp.NoSectionError:
124+
exceptcp.NoSectionErrorase:
125125
raiseValueError("This submodule instance does not exist anymore in '%s' file"
126-
%osp.join(self.repo.working_tree_dir,'.gitmodules'))
126+
%osp.join(self.repo.working_tree_dir,'.gitmodules'))frome
127127
# end
128128
self._url=reader.get('url')
129129
# git-python extension values - optional
@@ -189,9 +189,9 @@ def _config_parser(cls, repo, parent_commit, read_only):
189189
assertparent_commitisnotNone,"need valid parent_commit in bare repositories"
190190
try:
191191
fp_module=cls._sio_modules(parent_commit)
192-
exceptKeyError:
192+
exceptKeyErrorase:
193193
raiseIOError("Could not find %s file in the tree of parent commit %s"%
194-
(cls.k_modules_file,parent_commit))
194+
(cls.k_modules_file,parent_commit))frome
195195
# END handle exceptions
196196
# END handle non-bare working tree
197197

@@ -516,9 +516,9 @@ def update(self, recursive=False, init=True, to_latest_revision=False, progress=
516516
ifnotdry_runandosp.isdir(checkout_module_abspath):
517517
try:
518518
os.rmdir(checkout_module_abspath)
519-
exceptOSError:
519+
exceptOSErrorase:
520520
raiseOSError("Module directory at %r does already exist and is non-empty"
521-
%checkout_module_abspath)
521+
%checkout_module_abspath)frome
522522
# END handle OSError
523523
# END handle directory removal
524524

@@ -737,8 +737,8 @@ def move(self, module_path, configuration=True, module=True):
737737
del(index.entries[ekey])
738738
nentry=git.IndexEntry(entry[:3]+ (module_checkout_path,)+entry[4:])
739739
index.entries[tekey]=nentry
740-
exceptKeyError:
741-
raiseInvalidGitRepositoryError("Submodule's entry at %r did not exist"% (self.path))
740+
exceptKeyErrorase:
741+
raiseInvalidGitRepositoryError("Submodule's entry at %r did not exist"% (self.path))frome
742742
# END handle submodule doesn't exist
743743

744744
# update configuration
@@ -871,7 +871,7 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
871871
rmtree(wtd)
872872
exceptExceptionasex:
873873
ifHIDE_WINDOWS_KNOWN_ERRORS:
874-
raiseSkipTest("FIXME: fails with: PermissionError\n {}".format(ex))
874+
raiseSkipTest("FIXME: fails with: PermissionError\n {}".format(ex))fromex
875875
raise
876876
# END delete tree if possible
877877
# END handle force
@@ -882,7 +882,7 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
882882
rmtree(git_dir)
883883
exceptExceptionasex:
884884
ifHIDE_WINDOWS_KNOWN_ERRORS:
885-
raiseSkipTest("FIXME: fails with: PermissionError\n %s",ex)
885+
raiseSkipTest("FIXME: fails with: PermissionError\n %s",ex)fromex
886886
else:
887887
raise
888888
# end handle separate bare repository
@@ -1046,8 +1046,8 @@ def module(self):
10461046
ifrepo!=self.repo:
10471047
returnrepo
10481048
# END handle repo uninitialized
1049-
except (InvalidGitRepositoryError,NoSuchPathError):
1050-
raiseInvalidGitRepositoryError("No valid repository at %s"%module_checkout_abspath)
1049+
except (InvalidGitRepositoryError,NoSuchPathError)ase:
1050+
raiseInvalidGitRepositoryError("No valid repository at %s"%module_checkout_abspath)frome
10511051
else:
10521052
raiseInvalidGitRepositoryError("Repository at %r was not yet checked out"%module_checkout_abspath)
10531053
# END handle exceptions

‎git/objects/tree.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ def _iter_convert_to_object(self, iterable):
203203
path=join_path(self.path,name)
204204
try:
205205
yieldself._map_id_to_type[mode>>12](self.repo,binsha,mode,path)
206-
exceptKeyError:
207-
raiseTypeError("Unknown mode %o found in tree data for path '%s'"% (mode,path))
206+
exceptKeyErrorase:
207+
raiseTypeError("Unknown mode %o found in tree data for path '%s'"% (mode,path))frome
208208
# END for each item
209209

210210
defjoin(self,file):

‎git/objects/util.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ def parse_date(string_date):
203203
# still here ? fail
204204
raiseValueError("no format matched")
205205
# END handle format
206-
exceptException:
207-
raiseValueError("Unsupported date format: %s"%string_date)
206+
exceptExceptionase:
207+
raiseValueError("Unsupported date format: %s"%string_date)frome
208208
# END handle exceptions
209209

210210

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp