/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: Jelmer Vernooij
  • Date: 2020-08-14 20:01:27 UTC
  • mto: (7490.40.101 work)
  • mto: This revision was merged to the branch mainline in revision 7521.
  • Revision ID: jelmer@jelmer.uk-20200814200127-7ez9gzxtxqna02bo
Some formatting fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
278
278
        """
279
279
        raise NotImplementedError(self.snapshot)
280
280
 
 
281
    def _submodule_info(self):
 
282
        if self._submodules is None:
 
283
            try:
 
284
                with self.get_file('.gitmodules') as f:
 
285
                    config = GitConfigFile.from_file(f)
 
286
                    self._submodules = {
 
287
                        path: (url, section)
 
288
                        for path, url, section in parse_submodules(config)}
 
289
            except errors.NoSuchFile:
 
290
                self._submodules = {}
 
291
        return self._submodules
 
292
 
281
293
 
282
294
class GitRevisionTree(revisiontree.RevisionTree, GitTree):
283
295
    """Revision tree implementation based on Git objects."""
304
316
    def git_snapshot(self, want_unversioned=False):
305
317
        return self.tree, set()
306
318
 
307
 
    def _submodule_info(self):
308
 
        if self._submodules is None:
309
 
            try:
310
 
                with self.get_file('.gitmodules') as f:
311
 
                    config = GitConfigFile.from_file(f)
312
 
                    self._submodules = {
313
 
                        path: (url, section)
314
 
                        for path, url, section in parse_submodules(config)}
315
 
            except errors.NoSuchFile:
316
 
                self._submodules = {}
317
 
        return self._submodules
318
 
 
319
319
    def _get_submodule_repository(self, relpath):
320
320
        if not isinstance(relpath, bytes):
321
321
            raise TypeError(relpath)
446
446
        else:
447
447
            return True
448
448
 
449
 
    def _submodule_info(self):
450
 
        if self._submodules is None:
451
 
            try:
452
 
                with self.get_file('.gitmodules') as f:
453
 
                    config = GitConfigFile.from_file(f)
454
 
                    self._submodules = {
455
 
                        path: (url, section)
456
 
                        for path, url, section in parse_submodules(config)}
457
 
            except errors.NoSuchFile:
458
 
                self._submodules = {}
459
 
        return self._submodules
460
 
 
461
449
    def list_files(self, include_root=False, from_dir=None, recursive=True,
462
450
                   recurse_nested=False):
463
451
        if self.tree is None:
1199
1187
    def _read_submodule_head(self, path):
1200
1188
        raise NotImplementedError(self._read_submodule_head)
1201
1189
 
1202
 
    def _submodule_info(self):
1203
 
        if self._submodules is None:
1204
 
            try:
1205
 
                with self.get_file('.gitmodules') as f:
1206
 
                    config = GitConfigFile.from_file(f)
1207
 
                    self._submodules = {
1208
 
                        path: (url, section)
1209
 
                        for path, url, section in parse_submodules(config)}
1210
 
            except errors.NoSuchFile:
1211
 
                self._submodules = {}
1212
 
        return self._submodules
1213
 
 
1214
1190
    def _lookup_index(self, encoded_path):
1215
1191
        if not isinstance(encoded_path, bytes):
1216
1192
            raise TypeError(encoded_path)