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

Commit636f77b

Browse files
committed
fix conflict
2 parents567c892 +b0f79c5 commit636f77b

File tree

13 files changed

+101
-19
lines changed

13 files changed

+101
-19
lines changed

‎.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# UNUSED, only for reference. If adjustments are needed, please see github actions
22
language:python
33
python:
4+
<<<<<<< HEAD
45
-"3.4"
6+
=======
7+
>>>>>>> b0f79c58ad919e90261d1e332df79a4ad0bc40de
58
-"3.6"
69
-"3.7"
710
-"3.8"

‎AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ Contributors are:
4343
-Liam Beguin <liambeguin _at_ gmail.com>
4444
-Ram Rachum <ram _at_ rachum.com>
4545
-Alba Mendez <me _at_ alba.sh>
46+
-Robert Westman <robert _at_ byteflux.io>
4647
Portions derived from other open source works and are clearly marked.

‎VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.17
1+
3.1.18

‎doc/source/changes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Changelog
33
=========
44

5+
3.1.18
6+
======
7+
8+
* drop support for python 3.5 to reduce maintenance burden on typing. Lower patch levels of python 3.5 would break, too.
9+
10+
See the following for details:
11+
https://github.com/gitpython-developers/gitpython/milestone/50?closed=1
12+
513
3.1.17
614
======
715

‎git/cmd.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
importsubprocess
1818
importsys
1919
importthreading
20-
fromcollectionsimportOrderedDict
2120
fromtextwrapimportdedent
22-
importwarnings
2321

2422
fromgit.compatimport (
2523
defenc,
@@ -1004,13 +1002,6 @@ def transform_kwarg(self, name: str, value: Any, split_single_char_options: bool
10041002

10051003
deftransform_kwargs(self,split_single_char_options:bool=True,**kwargs:Any)->List[str]:
10061004
"""Transforms Python style kwargs into git command line options."""
1007-
# Python 3.6 preserves the order of kwargs and thus has a stable
1008-
# order. For older versions sort the kwargs by the key to get a stable
1009-
# order.
1010-
ifsys.version_info[:2]< (3,6):
1011-
kwargs=OrderedDict(sorted(kwargs.items(),key=lambdax:x[0]))
1012-
warnings.warn("Python 3.5 support is deprecated and will be removed 2021-09-05.\n"+
1013-
"It does not preserve the order for key-word arguments and enforce lexical sorting instead.")
10141005
args= []
10151006
fork,vinkwargs.items():
10161007
ifisinstance(v, (list,tuple)):

‎git/index/fun.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
S_ISDIR,
1212
S_IFMT,
1313
S_IFREG,
14+
S_IXUSR,
1415
)
1516
importsubprocess
1617

@@ -115,7 +116,7 @@ def stat_mode_to_index_mode(mode: int) -> int:
115116
returnS_IFLNK
116117
ifS_ISDIR(mode)orS_IFMT(mode)==S_IFGITLINK:# submodules
117118
returnS_IFGITLINK
118-
returnS_IFREG|0o644|(mode&0o111)# blobs with or without executable bit
119+
returnS_IFREG| (mode&S_IXUSRand0o755or0o644)# blobs with or without executable bit
119120

120121

121122
defwrite_cache(entries:Sequence[Union[BaseIndexEntry,'IndexEntry']],stream:IO[bytes],

‎git/refs/tag.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class TagReference(Reference):
1818
print(tagref.tag.message)"""
1919

2020
__slots__= ()
21-
_common_path_default="refs/tags"
21+
_common_default="tags"
22+
_common_path_default=Reference._common_path_default+"/"+_common_default
2223

2324
@property
2425
defcommit(self):

‎git/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ def stale_refs(self) -> IterableList:
612612
# * [would prune] origin/new_branch
613613
token=" * [would prune] "
614614
ifnotline.startswith(token):
615-
raiseValueError("Could not parse git-remote prune result: %r"%line)
615+
continue
616616
ref_name=line.replace(token,"")
617617
# sometimes, paths start with a full ref name, like refs/tags/foo, see #260
618618
ifref_name.startswith(Reference._common_path_default+'/'):

‎git/repo/base.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
6-
76
importlogging
87
importos
98
importre
109
importwarnings
1110

11+
fromgitdb.excimportBadObject
12+
1213
fromgit.cmdimport (
1314
Git,
1415
handle_process_output
@@ -402,7 +403,17 @@ def tags(self) -> 'IterableList':
402403
deftag(self,path:PathLike)->TagReference:
403404
""":return: TagReference Object, reference pointing to a Commit or Tag
404405
:param path: path to the tag reference, i.e. 0.1.5 or tags/0.1.5 """
405-
returnTagReference(self,path)
406+
full_path=self._to_full_tag_path(path)
407+
returnTagReference(self,full_path)
408+
409+
@staticmethod
410+
def_to_full_tag_path(path):
411+
ifpath.startswith(TagReference._common_path_default+'/'):
412+
returnpath
413+
ifpath.startswith(TagReference._common_default+'/'):
414+
returnReference._common_path_default+'/'+path
415+
else:
416+
returnTagReference._common_path_default+'/'+path
406417

407418
defcreate_head(self,path:PathLike,commit:str='HEAD',
408419
force:bool=False,logmsg:Optional[str]=None
@@ -608,6 +619,23 @@ def is_ancestor(self, ancestor_rev: 'Commit', rev: 'Commit') -> bool:
608619
raise
609620
returnTrue
610621

622+
defis_valid_object(self,sha:str,object_type:str=None)->bool:
623+
try:
624+
complete_sha=self.odb.partial_to_complete_sha_hex(sha)
625+
object_info=self.odb.info(complete_sha)
626+
ifobject_type:
627+
ifobject_info.type==object_type.encode():
628+
returnTrue
629+
else:
630+
log.debug("Commit hash points to an object of type '%s'. Requested were objects of type '%s'",
631+
object_info.type.decode(),object_type)
632+
returnFalse
633+
else:
634+
returnTrue
635+
exceptBadObject:
636+
log.debug("Commit hash is invalid.")
637+
returnFalse
638+
611639
def_get_daemon_export(self)->bool:
612640
ifself.git_dir:
613641
filename=osp.join(self.git_dir,self.DAEMON_EXPORT_FILE)

‎git/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def _parse_progress_line(self, line: AnyStr) -> None:
470470
line_str=line
471471
self._cur_line=line_str
472472

473-
ifself.error_linesorself._cur_line.startswith(('error:','fatal:')):
473+
ifself._cur_line.startswith(('error:','fatal:')):
474474
self.error_lines.append(self._cur_line)
475475
return
476476

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,6 @@ def build_py_modules(basedir, excludes=[]):
126126
"Programming Language :: Python :: 3.6",
127127
"Programming Language :: Python :: 3.7",
128128
"Programming Language :: Python :: 3.8",
129-
"Programming Language :: Python :: 3.9"
129+
"Programming Language :: Python :: 3.9"
130130
]
131131
)

‎test/test_fun.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
fromioimportBytesIO
2-
fromstatimportS_IFDIR,S_IFREG,S_IFLNK
2+
fromstatimportS_IFDIR,S_IFREG,S_IFLNK,S_IXUSR
33
fromosimportstat
44
importos.pathasosp
55
fromunittestimportSkipTest
66

77
fromgitimportGit
88
fromgit.indeximportIndexFile
99
fromgit.index.funimport (
10-
aggressive_tree_merge
10+
aggressive_tree_merge,
11+
stat_mode_to_index_mode,
1112
)
1213
fromgit.objects.funimport (
1314
traverse_tree_recursive,
@@ -206,6 +207,16 @@ def assert_entries(entries, num_entries, has_conflict=False):
206207
assert_entries(aggressive_tree_merge(odb,trees),2,True)
207208
# END handle ours, theirs
208209

210+
deftest_stat_mode_to_index_mode(self):
211+
modes= (
212+
0o600,0o611,0o640,0o641,0o644,0o650,0o651,
213+
0o700,0o711,0o740,0o744,0o750,0o751,0o755,
214+
)
215+
formodeinmodes:
216+
expected_mode=S_IFREG| (mode&S_IXUSRand0o755or0o644)
217+
assertstat_mode_to_index_mode(mode)==expected_mode
218+
# END for each mode
219+
209220
def_assert_tree_entries(self,entries,num_trees):
210221
forentryinentries:
211222
assertlen(entry)==num_trees

‎test/test_repo.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,16 @@ def test_index(self):
414414
deftest_tag(self):
415415
assertself.rorepo.tag('refs/tags/0.1.5').commit
416416

417+
deftest_tag_to_full_tag_path(self):
418+
tags= ['0.1.5','tags/0.1.5','refs/tags/0.1.5']
419+
value_errors= []
420+
fortagintags:
421+
try:
422+
self.rorepo.tag(tag)
423+
exceptValueErrorasvalueError:
424+
value_errors.append(valueError.args[0])
425+
self.assertEqual(value_errors, [])
426+
417427
deftest_archive(self):
418428
tmpfile=tempfile.mktemp(suffix='archive-test')
419429
withopen(tmpfile,'wb')asstream:
@@ -979,6 +989,34 @@ def test_is_ancestor(self):
979989
fori,jinitertools.permutations([c1,'ffffff',''],r=2):
980990
self.assertRaises(GitCommandError,repo.is_ancestor,i,j)
981991

992+
deftest_is_valid_object(self):
993+
repo=self.rorepo
994+
commit_sha='f6aa8d1'
995+
blob_sha='1fbe3e4375'
996+
tree_sha='960b40fe36'
997+
tag_sha='42c2f60c43'
998+
999+
# Check for valid objects
1000+
self.assertTrue(repo.is_valid_object(commit_sha))
1001+
self.assertTrue(repo.is_valid_object(blob_sha))
1002+
self.assertTrue(repo.is_valid_object(tree_sha))
1003+
self.assertTrue(repo.is_valid_object(tag_sha))
1004+
1005+
# Check for valid objects of specific type
1006+
self.assertTrue(repo.is_valid_object(commit_sha,'commit'))
1007+
self.assertTrue(repo.is_valid_object(blob_sha,'blob'))
1008+
self.assertTrue(repo.is_valid_object(tree_sha,'tree'))
1009+
self.assertTrue(repo.is_valid_object(tag_sha,'tag'))
1010+
1011+
# Check for invalid objects
1012+
self.assertFalse(repo.is_valid_object(b'1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a','blob'))
1013+
1014+
# Check for invalid objects of specific type
1015+
self.assertFalse(repo.is_valid_object(commit_sha,'blob'))
1016+
self.assertFalse(repo.is_valid_object(blob_sha,'commit'))
1017+
self.assertFalse(repo.is_valid_object(tree_sha,'commit'))
1018+
self.assertFalse(repo.is_valid_object(tag_sha,'commit'))
1019+
9821020
@with_rw_directory
9831021
deftest_git_work_tree_dotgit(self,rw_dir):
9841022
"""Check that we find .git as a worktree file and find the worktree

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp