/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/filegraph.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-11 04:08:32 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181111040832-nsljjynzzwmznf3h
Run autopep8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
            raise TypeError(path)
45
45
        commit = self.store[commit_id]
46
46
        target_mode, target_sha = tree_lookup_path(self.store.__getitem__,
47
 
            commit.tree, path)
 
47
                                                   commit.tree, path)
48
48
        if path == b'':
49
49
            target_mode = stat.S_IFDIR
50
50
        if target_mode is None:
51
 
            raise AssertionError("sha %r for %r in %r" % (target_sha, path, commit_id))
 
51
            raise AssertionError("sha %r for %r in %r" %
 
52
                                 (target_sha, path, commit_id))
52
53
        while True:
53
54
            parent_commits = []
54
55
            for parent_commit in [self.store[c] for c in commit.parents]:
55
56
                try:
56
57
                    mode, sha = tree_lookup_path(self.store.__getitem__,
57
 
                        parent_commit.tree, path)
 
58
                                                 parent_commit.tree, path)
58
59
                except (NotTreeError, KeyError):
59
60
                    continue
60
61
                else:
64
65
                # Candidate found iff, mode or text changed,
65
66
                # or is a directory that didn't previously exist.
66
67
                if mode != target_mode or (
67
 
                    not stat.S_ISDIR(target_mode) and sha != target_sha):
68
 
                        return (path, commit.id)
 
68
                        not stat.S_ISDIR(target_mode) and sha != target_sha):
 
69
                    return (path, commit.id)
69
70
            if parent_commits == []:
70
71
                break
71
72
            commit = parent_commits[0]
88
89
        text_parents = []
89
90
        for commit_parent in self.store[commit_id].parents:
90
91
            try:
91
 
                (path, text_parent) = self.change_scanner.find_last_change_revision(path.encode('utf-8'), commit_parent)
 
92
                (path, text_parent) = self.change_scanner.find_last_change_revision(
 
93
                    path.encode('utf-8'), commit_parent)
92
94
            except KeyError:
93
95
                continue
94
96
            if text_parent not in text_parents:
95
97
                text_parents.append(text_parent)
96
98
        return tuple([(file_id,
97
 
            self.change_scanner.repository.lookup_foreign_revision_id(p)) for p
98
 
            in text_parents])
 
99
                       self.change_scanner.repository.lookup_foreign_revision_id(p)) for p
 
100
                      in text_parents])
99
101
 
100
102
    def get_parent_map(self, keys):
101
103
        ret = {}