/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/tree.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-12 01:45:56 UTC
  • mfrom: (7513.1.2 pypy3)
  • Revision ID: breezy.the.bot@gmail.com-20200612014556-tsc8assk3d0luziu
Avoid deprecated behaviour in ElementTree.

Merged from https://code.launchpad.net/~jelmer/brz/pypy3/+merge/385611

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Git Trees."""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
20
from collections import deque
23
21
import errno
24
22
from io import BytesIO
66
64
    CURRENT_REVISION,
67
65
    NULL_REVISION,
68
66
    )
69
 
from ..sixish import (
70
 
    text_type,
71
 
    viewitems,
72
 
    )
73
67
 
74
68
from .mapping import (
75
69
    mode_is_executable,
1310
1304
                    key = (posixpath.dirname(path), path)
1311
1305
                    if key not in ret and self.is_versioned(path):
1312
1306
                        ret[key] = self._get_dir_ie(path, self.path2id(key[0]))
1313
 
            return ((path, ie) for ((_, path), ie) in sorted(viewitems(ret)))
 
1307
            return ((path, ie) for ((_, path), ie) in sorted(ret.items()))
1314
1308
 
1315
1309
    def iter_references(self):
1316
1310
        if self.supports_tree_reference():
1325
1319
                                posixpath.basename(path).strip("/"), parent_id)
1326
1320
 
1327
1321
    def _get_file_ie(self, name, path, value, parent_id):
1328
 
        if not isinstance(name, text_type):
 
1322
        if not isinstance(name, str):
1329
1323
            raise TypeError(name)
1330
 
        if not isinstance(path, text_type):
 
1324
        if not isinstance(path, str):
1331
1325
            raise TypeError(path)
1332
1326
        if not isinstance(value, tuple) or len(value) != 10:
1333
1327
            raise TypeError(value)
1676
1670
                    e, osutils._fs_enc)
1677
1671
            if stat.S_ISDIR(st.st_mode):
1678
1672
                blob = Tree()
1679
 
            else:
 
1673
            elif stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode):
1680
1674
                blob = blob_from_path_and_stat(
1681
1675
                    target.abspath(e).encode(osutils._fs_enc), st)
 
1676
            else:
 
1677
                continue
1682
1678
            store.add_object(blob)
1683
1679
            np = np.encode('utf-8')
1684
1680
            blobs[np] = (blob.id, cleanup_mode(st.st_mode))