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

Commit95bb489

Browse files
committed
test_tree works
1 parent4cfc682 commit95bb489

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

‎doc/source/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changelog
77
* Internally, hexadecimal SHA1 are treated as ascii encoded strings. Binary SHA1 are treated as bytes.
88
* Id attribute of Commit objects is now `hexsha`, instead of `binsha`. The latter makes no sense in python 3 and I see no application of it anyway besides its artificial usage in test cases.
99
* **IMPORTANT**: If you were using the config_writer(), you implicitly relied on __del__ to work as expected to flush changes. To be sure changes are flushed under PY3, you will have to call the new `release()` method to trigger a flush. For some reason, __del__ is not called necessarily anymore when a symbol goes out of scope.
10+
* The `Tree` now has a `.join('name')` method which is equivalent to `tree / 'name'`
1011

1112
0.3.3
1213
=====

‎git/objects/tree.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def _iter_convert_to_object(self, iterable):
159159
raiseTypeError("Unknown mode %o found in tree data for path '%s'"% (mode,path))
160160
# END for each item
161161

162-
def__div__(self,file):
162+
defjoin(self,file):
163163
"""Find the named object in this tree's contents
164164
:return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule``
165165
@@ -192,6 +192,14 @@ def __div__(self, file):
192192
raiseKeyError(msg%file)
193193
# END handle long paths
194194

195+
def__div__(self,file):
196+
"""For PY2 only"""
197+
returnself.join(file)
198+
199+
def__truediv__(self,file):
200+
"""For PY3 only"""
201+
returnself.join(file)
202+
195203
@property
196204
deftrees(self):
197205
""":return: list(Tree, ...) list of trees directly below this tree"""
@@ -235,7 +243,7 @@ def __getitem__(self, item):
235243

236244
ifisinstance(item,string_types):
237245
# compatability
238-
returnself.__div__(item)
246+
returnself.join(item)
239247
# END index is basestring
240248

241249
raiseTypeError("Invalid index type: %r"%item)

‎git/test/test_tree.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def test_traverse(self):
138138
# END check for slash
139139

140140
# slashes in paths are supported as well
141+
# NOTE: on py3, / doesn't work with strings anymore ...
141142
assertroot[item.path]==item==root/item.path
142143
# END for each item
143144
assertfound_slash

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp