|
39 | 39 | ) |
40 | 40 |
|
41 | 41 | from git.objects.util import Serializable |
42 | | -from git.compat import izip |
| 42 | +from git.compat import ( |
| 43 | + izip, |
| 44 | + xrange, |
| 45 | + string_types, |
| 46 | +) |
43 | 47 |
|
44 | 48 | from git.util import ( |
45 | 49 | LazyMixin, |
@@ -541,7 +545,7 @@ def _preprocess_add_items(self, items): |
541 | 545 | entries = list() |
542 | 546 |
|
543 | 547 | for item in items: |
544 | | - if isinstance(item, basestring): |
| 548 | + if isinstance(item, string_types): |
545 | 549 | paths.append(self._to_relative_path(item)) |
546 | 550 | elif isinstance(item, (Blob, Submodule)): |
547 | 551 | entries.append(BaseIndexEntry.from_blob(item)) |
@@ -752,7 +756,7 @@ def _items_to_rela_paths(self, items): |
752 | 756 | for item in items: |
753 | 757 | if isinstance(item, (BaseIndexEntry, (Blob, Submodule))): |
754 | 758 | paths.append(self._to_relative_path(item.path)) |
755 | | - elif isinstance(item, basestring): |
| 759 | + elif isinstance(item, string_types): |
756 | 760 | paths.append(self._to_relative_path(item)) |
757 | 761 | else: |
758 | 762 | raise TypeError("Invalid item type: %r" % item) |
@@ -1004,7 +1008,7 @@ def handle_stderr(proc, iter_checked_out_files): |
1004 | 1008 | handle_stderr(proc, rval_iter) |
1005 | 1009 | return rval_iter |
1006 | 1010 | else: |
1007 | | - if isinstance(paths, basestring): |
| 1011 | + if isinstance(paths, string_types): |
1008 | 1012 | paths = [paths] |
1009 | 1013 |
|
1010 | 1014 | # make sure we have our entries loaded before we start checkout_index |
@@ -1140,7 +1144,7 @@ def diff(self, other=diff.Diffable.Index, paths=None, create_patch=False, **kwar |
1140 | 1144 | # index against anything but None is a reverse diff with the respective |
1141 | 1145 | # item. Handle existing -R flags properly. Transform strings to the object |
1142 | 1146 | # so that we can call diff on it |
1143 | | - if isinstance(other, basestring): |
| 1147 | + if isinstance(other, string_types): |
1144 | 1148 | other = self.repo.rev_parse(other) |
1145 | 1149 | # END object conversion |
1146 | 1150 |
|
|
0 commit comments