/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: 2019-10-13 16:11:08 UTC
  • mfrom: (7397.2.4 ie-is-same)
  • Revision ID: breezy.the.bot@gmail.com-20191013161108-imzi2dmiz7g0jzha
Add a new ``TreeEntry.is_unmodified`` method, which allows
merge to check for unmodified files without relying
on the .revision attribute that is not available for Git trees.

This fixes LCA merges for Git repositories.

Merged from https://code.launchpad.net/~jelmer/brz/ie-is-same/+merge/373715

Show diffs side-by-side

added added

removed removed

Lines of Context:
488
488
                yield self._get_file_ie(store, child_path, name, mode, hexsha,
489
489
                                        file_id)
490
490
 
491
 
    def iter_entries_by_dir(self, specific_files=None, yield_parents=False):
 
491
    def iter_entries_by_dir(self, specific_files=None):
492
492
        if self.tree is None:
493
493
            return
494
 
        if yield_parents:
495
 
            # TODO(jelmer): Support yield parents
496
 
            raise NotImplementedError
497
494
        if specific_files is not None:
498
495
            if specific_files in ([""], []):
499
496
                specific_files = None
1148
1145
                if S_ISGITLINK(mode):
1149
1146
                    pass  # TODO(jelmer): dive into submodule
1150
1147
 
1151
 
    def iter_entries_by_dir(self, specific_files=None, yield_parents=False):
1152
 
        if yield_parents:
1153
 
            raise NotImplementedError(self.iter_entries_by_dir)
 
1148
    def iter_entries_by_dir(self, specific_files=None):
1154
1149
        with self.lock_read():
1155
1150
            if specific_files is not None:
1156
1151
                specific_files = set(specific_files)
1172
1167
                    file_ie = self._get_file_ie(name, path, value, None)
1173
1168
                except errors.NoSuchFile:
1174
1169
                    continue
1175
 
                if yield_parents or specific_files is None:
 
1170
                if specific_files is None:
1176
1171
                    for (dir_path, dir_ie) in self._add_missing_parent_ids(
1177
1172
                            parent, dir_ids):
1178
1173
                        ret[(posixpath.dirname(dir_path), dir_path)] = dir_ie
1179
1174
                file_ie.parent_id = self.path2id(parent)
1180
1175
                ret[(posixpath.dirname(path), path)] = file_ie
 
1176
            # Special casing for directories
 
1177
            if specific_files:
 
1178
                for path in specific_files:
 
1179
                    key = (posixpath.dirname(path), path)
 
1180
                    if key not in ret and self.is_versioned(path):
 
1181
                        ret[key] = self._get_dir_ie(path, self.path2id(key[0]))
1181
1182
            return ((path, ie) for ((_, path), ie) in sorted(viewitems(ret)))
1182
1183
 
1183
1184
    def iter_references(self):