/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/plugins/git/workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2018-05-15 19:05:51 UTC
  • mfrom: (6968 work)
  • mto: (6973.5.1 python3-c)
  • mto: This revision was merged to the branch mainline in revision 6984.
  • Revision ID: jelmer@jelmer.uk-20180515190551-epr5abd0mtxmrehr
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from __future__ import absolute_import
21
21
 
22
22
import itertools
23
 
from cStringIO import (
24
 
    StringIO,
25
 
    )
26
23
from collections import defaultdict
27
24
import errno
28
25
from dulwich.ignore import (
621
618
        """See Tree.get_file_mtime."""
622
619
        try:
623
620
            return self._lstat(path).st_mtime
624
 
        except OSError, (num, msg):
 
621
        except OSError as e:
 
622
            (num, msg) = e
625
623
            if num == errno.ENOENT:
626
624
                raise errors.NoSuchFile(path)
627
625
            raise
703
701
            abspath = self.abspath(path)
704
702
            try:
705
703
                return osutils.sha_file_by_name(abspath)
706
 
            except OSError, (num, msg):
 
704
            except OSError as e:
 
705
                (num, msg) = e
707
706
                if num in (errno.EISDIR, errno.ENOENT):
708
707
                    return None
709
708
                raise
1053
1052
                if not path.startswith(prefix):
1054
1053
                    continue
1055
1054
                add_entry(path, mode_kind(value.mode))
1056
 
        return ((k, sorted(v)) for (k, v) in sorted(per_dir.iteritems()))
 
1055
        return ((k, sorted(v)) for (k, v) in sorted(per_dir.items()))
1057
1056
 
1058
1057
    def get_shelf_manager(self):
1059
1058
        raise workingtree.ShelvingUnsupported()
1167
1166
                        # Let's at least try to use the working tree file:
1168
1167
                        try:
1169
1168
                            st = self._lstat(self.abspath(entry.path))
1170
 
                        except OSError, (num, msg):
 
1169
                        except OSError:
1171
1170
                            # But if it doesn't exist, we'll make something up.
1172
1171
                            obj = self.store[entry.sha]
1173
1172
                            st = os.stat_result((entry.mode, 0, 0, 0,
1420
1419
            np = np.encode('utf-8')
1421
1420
            blobs[np] = (blob.id, cleanup_mode(st.st_mode))
1422
1421
            extras.add(np)
1423
 
    to_tree_sha = commit_tree(store, dirified + [(p, s, m) for (p, (s, m)) in blobs.iteritems()])
 
1422
    to_tree_sha = commit_tree(store, dirified + [(p, s, m) for (p, (s, m)) in blobs.items()])
1424
1423
    return store.tree_changes(
1425
1424
        from_tree_sha, to_tree_sha, include_trees=True,
1426
1425
        want_unchanged=want_unchanged, change_type_same=True), extras