| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ Changelog | |||
| 7 | 7 | * Internally, hexadecimal SHA1 are treated as ascii encoded strings. Binary SHA1 are treated as bytes. | |
| 8 | 8 | * 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. | |
| 9 | 9 | * **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'` | ||
| 10 | 11 | ||
| 11 | 12 | 0.3.3 | |
| 12 | 13 | ===== | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,7 +159,7 @@ def _iter_convert_to_object(self, iterable): | |||
| 159 | 159 | raise TypeError("Unknown mode %o found in tree data for path '%s'" % (mode, path)) | |
| 160 | 160 | # END for each item | |
| 161 | 161 | ||
| 162 | - def __div__(self, file): | ||
| 162 | + def join(self, file): | ||
| 163 | 163 | """Find the named object in this tree's contents | |
| 164 | 164 | :return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule`` | |
| 165 | 165 | ||
@@ -192,6 +192,14 @@ def __div__(self, file): | |||
| 192 | 192 | raise KeyError(msg % file) | |
| 193 | 193 | # END handle long paths | |
| 194 | 194 | ||
| 195 | + def __div__(self, file): | ||
| 196 | + """For PY2 only""" | ||
| 197 | + return self.join(file) | ||
| 198 | + | ||
| 199 | + def __truediv__(self, file): | ||
| 200 | + """For PY3 only""" | ||
| 201 | + return self.join(file) | ||
| 202 | + | ||
| 195 | 203 | @property | |
| 196 | 204 | def trees(self): | |
| 197 | 205 | """:return: list(Tree, ...) list of trees directly below this tree""" | |
@@ -235,7 +243,7 @@ def __getitem__(self, item): | |||
| 235 | 243 | ||
| 236 | 244 | if isinstance(item, string_types): | |
| 237 | 245 | # compatability | |
| 238 | - return self.__div__(item) | ||
| 246 | + return self.join(item) | ||
| 239 | 247 | # END index is basestring | |
| 240 | 248 | ||
| 241 | 249 | raise TypeError("Invalid index type: %r" % item) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,6 +138,7 @@ def test_traverse(self): | |||
| 138 | 138 | # END check for slash | |
| 139 | 139 | ||
| 140 | 140 | # slashes in paths are supported as well | |
| 141 | + # NOTE: on py3, / doesn't work with strings anymore ... | ||
| 141 | 142 | assert root[item.path] == item == root / item.path | |
| 142 | 143 | # END for each item | |
| 143 | 144 | assert found_slash | |
| Back | FazBrowse Home | New Git URL |
0 commit comments