/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 bzrlib/repository.py

remove all trailing whitespace from bzr source

Show diffs side-by-side

added added

removed removed

Lines of Context:
199
199
 
200
200
    def _generate_revision_if_needed(self):
201
201
        """Create a revision id if None was supplied.
202
 
        
 
202
 
203
203
        If the repository can not support user-specified revision ids
204
204
        they should override this function and raise CannotSetRevisionId
205
205
        if _new_revision_id is not None.
301
301
        :param parent_invs: The inventories of the parent revisions of the
302
302
            commit.
303
303
        :param path: The path the entry is at in the tree.
304
 
        :param tree: The tree which contains this entry and should be used to 
 
304
        :param tree: The tree which contains this entry and should be used to
305
305
            obtain content.
306
306
        :param content_summary: Summary data from the tree about the paths
307
307
            content - stat, length, exec, sha/link target. This is only
514
514
 
515
515
class RootCommitBuilder(CommitBuilder):
516
516
    """This commitbuilder actually records the root id"""
517
 
    
 
517
 
518
518
    # the root entry gets versioned properly by this builder.
519
519
    _versioned_root = True
520
520
 
613
613
 
614
614
    def _abort_write_group(self):
615
615
        """Template method for per-repository write group cleanup.
616
 
        
617
 
        This is called during abort before the write group is considered to be 
 
616
 
 
617
        This is called during abort before the write group is considered to be
618
618
        finished and should cleanup any internal state accrued during the write
619
619
        group. There is no requirement that data handed to the repository be
620
620
        *not* made available - this is not a rollback - but neither should any
626
626
 
627
627
    def add_fallback_repository(self, repository):
628
628
        """Add a repository to use for looking up data not held locally.
629
 
        
 
629
 
630
630
        :param repository: A repository.
631
631
        """
632
632
        if not self._format.supports_external_lookups:
643
643
        """Check that this repository can fallback to repository safely.
644
644
 
645
645
        Raise an error if not.
646
 
        
 
646
 
647
647
        :param repository: A repository to fallback to.
648
648
        """
649
649
        return InterRepository._assert_same_model(self, repository)
650
650
 
651
651
    def add_inventory(self, revision_id, inv, parents):
652
652
        """Add the inventory inv to the repository as revision_id.
653
 
        
 
653
 
654
654
        :param parents: The revision ids of the parents that revision_id
655
655
                        is known to have and are in the repository already.
656
656
 
758
758
        self.revisions.add_lines(key, parents, osutils.split_lines(text))
759
759
 
760
760
    def all_revision_ids(self):
761
 
        """Returns a list of all the revision ids in the repository. 
 
761
        """Returns a list of all the revision ids in the repository.
762
762
 
763
763
        This is conceptually deprecated because code should generally work on
764
764
        the graph reachable from a particular revision, and ignore any other
770
770
        return self._all_revision_ids()
771
771
 
772
772
    def _all_revision_ids(self):
773
 
        """Returns a list of all the revision ids in the repository. 
 
773
        """Returns a list of all the revision ids in the repository.
774
774
 
775
 
        These are in as much topological order as the underlying store can 
 
775
        These are in as much topological order as the underlying store can
776
776
        present.
777
777
        """
778
778
        raise NotImplementedError(self._all_revision_ids)
823
823
        self._reconcile_does_inventory_gc = True
824
824
        self._reconcile_fixes_text_parents = False
825
825
        self._reconcile_backsup_inventory = True
826
 
        # not right yet - should be more semantically clear ? 
827
 
        # 
 
826
        # not right yet - should be more semantically clear ?
 
827
        #
828
828
        # TODO: make sure to construct the right store classes, etc, depending
829
829
        # on whether escaping is required.
830
830
        self._warn_if_deprecated()
881
881
        This causes caching within the repository obejct to start accumlating
882
882
        data during reads, and allows a 'write_group' to be obtained. Write
883
883
        groups must be used for actual data insertion.
884
 
        
 
884
 
885
885
        :param token: if this is already locked, then lock_write will fail
886
886
            unless the token matches the existing lock.
887
887
        :returns: a token if this instance supports tokens, otherwise None.
916
916
    def leave_lock_in_place(self):
917
917
        """Tell this repository not to release the physical lock when this
918
918
        object is unlocked.
919
 
        
 
919
 
920
920
        If lock_write doesn't return a token, then this method is not supported.
921
921
        """
922
922
        self.control_files.leave_in_place()
1028
1028
    @needs_read_lock
1029
1029
    def search_missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
1030
1030
        """Return the revision ids that other has that this does not.
1031
 
        
 
1031
 
1032
1032
        These are returned in topological order.
1033
1033
 
1034
1034
        revision_id: only return revision ids included by revision_id.
1040
1040
    @needs_read_lock
1041
1041
    def missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
1042
1042
        """Return the revision ids that other has that this does not.
1043
 
        
 
1043
 
1044
1044
        These are returned in topological order.
1045
1045
 
1046
1046
        revision_id: only return revision ids included by revision_id.
1066
1066
 
1067
1067
    def copy_content_into(self, destination, revision_id=None):
1068
1068
        """Make a complete copy of the content in self into destination.
1069
 
        
1070
 
        This is a destructive operation! Do not use it on existing 
 
1069
 
 
1070
        This is a destructive operation! Do not use it on existing
1071
1071
        repositories.
1072
1072
        """
1073
1073
        return InterRepository.get(self, destination).copy_content(revision_id)
1087
1087
 
1088
1088
    def _commit_write_group(self):
1089
1089
        """Template method for per-repository write group cleanup.
1090
 
        
1091
 
        This is called before the write group is considered to be 
 
1090
 
 
1091
        This is called before the write group is considered to be
1092
1092
        finished and should ensure that all data handed to the repository
1093
 
        for writing during the write group is safely committed (to the 
 
1093
        for writing during the write group is safely committed (to the
1094
1094
        extent possible considering file system caching etc).
1095
1095
        """
1096
1096
 
1124
1124
                           timezone=None, committer=None, revprops=None,
1125
1125
                           revision_id=None):
1126
1126
        """Obtain a CommitBuilder for this repository.
1127
 
        
 
1127
 
1128
1128
        :param branch: Branch to commit to.
1129
1129
        :param parents: Revision ids of the parents of the new revision.
1130
1130
        :param config: Configuration to use.
1192
1192
 
1193
1193
    def _start_write_group(self):
1194
1194
        """Template method for per-repository write group startup.
1195
 
        
1196
 
        This is called before the write group is considered to be 
 
1195
 
 
1196
        This is called before the write group is considered to be
1197
1197
        entered.
1198
1198
        """
1199
1199
 
1248
1248
    @needs_read_lock
1249
1249
    def get_revision_reconcile(self, revision_id):
1250
1250
        """'reconcile' helper routine that allows access to a revision always.
1251
 
        
 
1251
 
1252
1252
        This variant of get_revision does not cross check the weave graph
1253
1253
        against the revision one as get_revision does: but it should only
1254
1254
        be used by reconcile, or reconcile-alike commands that are correcting
1292
1292
 
1293
1293
    def get_deltas_for_revisions(self, revisions):
1294
1294
        """Produce a generator of revision deltas.
1295
 
        
 
1295
 
1296
1296
        Note that the input is a sequence of REVISIONS, not revision_ids.
1297
1297
        Trees will be held in memory until the generator exits.
1298
1298
        Each delta is relative to the revision's lefthand predecessor.
1301
1301
        for revision in revisions:
1302
1302
            required_trees.add(revision.revision_id)
1303
1303
            required_trees.update(revision.parent_ids[:1])
1304
 
        trees = dict((t.get_revision_id(), t) for 
 
1304
        trees = dict((t.get_revision_id(), t) for
1305
1305
                     t in self.revision_trees(required_trees))
1306
1306
        for revision in revisions:
1307
1307
            if not revision.parent_ids:
1372
1372
 
1373
1373
        # this code needs to read every new line in every inventory for the
1374
1374
        # inventories [revision_ids]. Seeing a line twice is ok. Seeing a line
1375
 
        # not present in one of those inventories is unnecessary but not 
 
1375
        # not present in one of those inventories is unnecessary but not
1376
1376
        # harmful because we are filtering by the revision id marker in the
1377
 
        # inventory lines : we only select file ids altered in one of those  
 
1377
        # inventory lines : we only select file ids altered in one of those
1378
1378
        # revisions. We don't need to see all lines in the inventory because
1379
1379
        # only those added in an inventory in rev X can contain a revision=X
1380
1380
        # line.
1695
1695
            yield ''.join(chunks), key[-1]
1696
1696
 
1697
1697
    def deserialise_inventory(self, revision_id, xml):
1698
 
        """Transform the xml into an inventory object. 
 
1698
        """Transform the xml into an inventory object.
1699
1699
 
1700
1700
        :param revision_id: The expected revision id of the inventory.
1701
1701
        :param xml: A serialised inventory.
1803
1803
        # TODO: refactor this to use an existing revision object
1804
1804
        # so we don't need to read it in twice.
1805
1805
        if revision_id == _mod_revision.NULL_REVISION:
1806
 
            return RevisionTree(self, Inventory(root_id=None), 
 
1806
            return RevisionTree(self, Inventory(root_id=None),
1807
1807
                                _mod_revision.NULL_REVISION)
1808
1808
        else:
1809
1809
            inv = self.get_revision_inventory(revision_id)
1821
1821
    def get_ancestry(self, revision_id, topo_sorted=True):
1822
1822
        """Return a list of revision-ids integrated by a revision.
1823
1823
 
1824
 
        The first element of the list is always None, indicating the origin 
1825
 
        revision.  This might change when we have history horizons, or 
 
1824
        The first element of the list is always None, indicating the origin
 
1825
        revision.  This might change when we have history horizons, or
1826
1826
        perhaps we should have a new API.
1827
 
        
 
1827
 
1828
1828
        This is topologically sorted.
1829
1829
        """
1830
1830
        if _mod_revision.is_null(revision_id):
1854
1854
        types it should be a no-op that just returns.
1855
1855
 
1856
1856
        This stub method does not require a lock, but subclasses should use
1857
 
        @needs_write_lock as this is a long running call its reasonable to 
 
1857
        @needs_write_lock as this is a long running call its reasonable to
1858
1858
        implicitly lock for the user.
1859
1859
        """
1860
1860
 
1862
1862
    @deprecated_method(one_six)
1863
1863
    def print_file(self, file, revision_id):
1864
1864
        """Print `file` to stdout.
1865
 
        
 
1865
 
1866
1866
        FIXME RBC 20060125 as John Meinel points out this is a bad api
1867
1867
        - it writes to stdout, it assumes that that is valid etc. Fix
1868
1868
        by creating a new more flexible convenience function.
1948
1948
                          working trees.
1949
1949
        """
1950
1950
        raise NotImplementedError(self.set_make_working_trees)
1951
 
    
 
1951
 
1952
1952
    def make_working_trees(self):
1953
1953
        """Returns the policy for making working trees on new branches."""
1954
1954
        raise NotImplementedError(self.make_working_trees)
2019
2019
                    revision_id.decode('ascii')
2020
2020
                except UnicodeDecodeError:
2021
2021
                    raise errors.NonAsciiRevisionId(method, self)
2022
 
    
 
2022
 
2023
2023
    def revision_graph_can_have_wrong_parents(self):
2024
2024
        """Is it possible for this repository to have a revision graph with
2025
2025
        incorrect parents?
2143
2143
 
2144
2144
class MetaDirRepository(Repository):
2145
2145
    """Repositories in the new meta-dir layout.
2146
 
    
 
2146
 
2147
2147
    :ivar _transport: Transport for access to repository control files,
2148
2148
        typically pointing to .bzr/repository.
2149
2149
    """
2174
2174
        else:
2175
2175
            self._transport.put_bytes('no-working-trees', '',
2176
2176
                mode=self.bzrdir._get_file_mode())
2177
 
    
 
2177
 
2178
2178
    def make_working_trees(self):
2179
2179
        """Returns the policy for making working trees on new branches."""
2180
2180
        return not self._transport.has('no-working-trees')
2196
2196
        if callable(r):
2197
2197
            r = r()
2198
2198
        return r
2199
 
    
 
2199
 
2200
2200
 
2201
2201
format_registry = RepositoryFormatRegistry()
2202
2202
"""Registry of formats, indexed by their identifying format string.
2223
2223
    formats. The _format attribute on a Repository instance can be used to
2224
2224
    determine the disk format.
2225
2225
 
2226
 
    Formats are placed in an dict by their format string for reference 
 
2226
    Formats are placed in an dict by their format string for reference
2227
2227
    during opening. These should be subclasses of RepositoryFormat
2228
2228
    for consistency.
2229
2229
 
2230
2230
    Once a format is deprecated, just deprecate the initialize and open
2231
 
    methods on the format class. Do not deprecate the object, as the 
 
2231
    methods on the format class. Do not deprecate the object, as the
2232
2232
    object will be created every system load.
2233
2233
 
2234
2234
    Common instance attributes:
2258
2258
    @classmethod
2259
2259
    def find_format(klass, a_bzrdir):
2260
2260
        """Return the format for the repository object in a_bzrdir.
2261
 
        
 
2261
 
2262
2262
        This is used by bzr native formats that have a "format" file in
2263
 
        the repository.  Other methods may be used by different types of 
 
2263
        the repository.  Other methods may be used by different types of
2264
2264
        control directory.
2265
2265
        """
2266
2266
        try:
2280
2280
    @classmethod
2281
2281
    def unregister_format(klass, format):
2282
2282
        format_registry.remove(format.get_format_string())
2283
 
    
 
2283
 
2284
2284
    @classmethod
2285
2285
    def get_default_format(klass):
2286
2286
        """Return the current default format."""
2289
2289
 
2290
2290
    def get_format_string(self):
2291
2291
        """Return the ASCII format string that identifies this format.
2292
 
        
2293
 
        Note that in pre format ?? repositories the format string is 
 
2292
 
 
2293
        Note that in pre format ?? repositories the format string is
2294
2294
        not permitted nor written to disk.
2295
2295
        """
2296
2296
        raise NotImplementedError(self.get_format_string)
2327
2327
        :param a_bzrdir: The bzrdir to put the new repository in it.
2328
2328
        :param shared: The repository should be initialized as a sharable one.
2329
2329
        :returns: The new repository object.
2330
 
        
 
2330
 
2331
2331
        This may raise UninitializableFormat if shared repository are not
2332
2332
        compatible the a_bzrdir.
2333
2333
        """
2337
2337
        """Is this format supported?
2338
2338
 
2339
2339
        Supported formats must be initializable and openable.
2340
 
        Unsupported formats may not support initialization or committing or 
 
2340
        Unsupported formats may not support initialization or committing or
2341
2341
        some other features depending on the reason for not being supported.
2342
2342
        """
2343
2343
        return True
2347
2347
 
2348
2348
    def open(self, a_bzrdir, _found=False):
2349
2349
        """Return an instance of this format for the bzrdir a_bzrdir.
2350
 
        
 
2350
 
2351
2351
        _found is a private parameter, do not use it.
2352
2352
        """
2353
2353
        raise NotImplementedError(self.open)
2399
2399
 
2400
2400
 
2401
2401
# formats which have no format string are not discoverable
2402
 
# and not independently creatable, so are not registered.  They're 
 
2402
# and not independently creatable, so are not registered.  They're
2403
2403
# all in bzrlib.repofmt.weaverepo now.  When an instance of one of these is
2404
2404
# needed, it's constructed directly by the BzrDir.  Non-native formats where
2405
2405
# the repository is not separately opened are similar.
2472
2472
    'RepositoryFormatKnitPack6RichRoot',
2473
2473
    )
2474
2474
 
2475
 
# Development formats. 
 
2475
# Development formats.
2476
2476
# 1.7->1.8 go below here
2477
2477
format_registry.register_lazy(
2478
2478
    "Bazaar development format 2 (needs bzr.dev from before 1.8)\n",
2491
2491
    """This class represents operations taking place between two repositories.
2492
2492
 
2493
2493
    Its instances have methods like copy_content and fetch, and contain
2494
 
    references to the source and target repositories these operations can be 
 
2494
    references to the source and target repositories these operations can be
2495
2495
    carried out on.
2496
2496
 
2497
2497
    Often we will provide convenience methods on 'repository' which carry out
2597
2597
    @needs_read_lock
2598
2598
    def missing_revision_ids(self, revision_id=None, find_ghosts=True):
2599
2599
        """Return the revision ids that source has that target does not.
2600
 
        
 
2600
 
2601
2601
        These are returned in topological order.
2602
2602
 
2603
2603
        :param revision_id: only return revision ids included by this
2611
2611
    @needs_read_lock
2612
2612
    def search_missing_revision_ids(self, revision_id=None, find_ghosts=True):
2613
2613
        """Return the revision ids that source has that target does not.
2614
 
        
 
2614
 
2615
2615
        :param revision_id: only return revision ids included by this
2616
2616
                            revision_id.
2617
2617
        :param find_ghosts: If True find missing revisions in deep history
2636
2636
    @staticmethod
2637
2637
    def _same_model(source, target):
2638
2638
        """True if source and target have the same data representation.
2639
 
        
 
2639
 
2640
2640
        Note: this is always called on the base class; overriding it in a
2641
2641
        subclass will have no effect.
2642
2642
        """
2660
2660
 
2661
2661
class InterSameDataRepository(InterRepository):
2662
2662
    """Code for converting between repositories that represent the same data.
2663
 
    
 
2663
 
2664
2664
    Data format and model must match for this to work.
2665
2665
    """
2666
2666
 
2667
2667
    @classmethod
2668
2668
    def _get_repo_format_to_test(self):
2669
2669
        """Repository format for testing with.
2670
 
        
 
2670
 
2671
2671
        InterSameData can pull from subtree to subtree and from non-subtree to
2672
2672
        non-subtree, so we test this with the richest repository format.
2673
2673
        """
2684
2684
 
2685
2685
        This copies both the repository's revision data, and configuration information
2686
2686
        such as the make_working_trees setting.
2687
 
        
2688
 
        This is a destructive operation! Do not use it on existing 
 
2687
 
 
2688
        This is a destructive operation! Do not use it on existing
2689
2689
        repositories.
2690
2690
 
2691
2691
        :param revision_id: Only copy the content needed to construct
2696
2696
        except NotImplementedError:
2697
2697
            pass
2698
2698
        # but don't bother fetching if we have the needed data now.
2699
 
        if (revision_id not in (None, _mod_revision.NULL_REVISION) and 
 
2699
        if (revision_id not in (None, _mod_revision.NULL_REVISION) and
2700
2700
            self.target.has_revision(revision_id)):
2701
2701
            return
2702
2702
        self.target.fetch(self.source, revision_id=revision_id)
2717
2717
 
2718
2718
class InterWeaveRepo(InterSameDataRepository):
2719
2719
    """Optimised code paths between Weave based repositories.
2720
 
    
 
2720
 
2721
2721
    This should be in bzrlib/repofmt/weaverepo.py but we have not yet
2722
2722
    implemented lazy inter-object optimisation.
2723
2723
    """
2730
2730
    @staticmethod
2731
2731
    def is_compatible(source, target):
2732
2732
        """Be compatible with known Weave formats.
2733
 
        
 
2733
 
2734
2734
        We don't test for the stores being of specific types because that
2735
 
        could lead to confusing results, and there is no need to be 
 
2735
        could lead to confusing results, and there is no need to be
2736
2736
        overly general.
2737
2737
        """
2738
2738
        from bzrlib.repofmt.weaverepo import (
2749
2749
                                                RepositoryFormat7)))
2750
2750
        except AttributeError:
2751
2751
            return False
2752
 
    
 
2752
 
2753
2753
    @needs_write_lock
2754
2754
    def copy_content(self, revision_id=None):
2755
2755
        """See InterRepository.copy_content()."""
2799
2799
        """See InterRepository.missing_revision_ids()."""
2800
2800
        # we want all revisions to satisfy revision_id in source.
2801
2801
        # but we don't want to stat every file here and there.
2802
 
        # we want then, all revisions other needs to satisfy revision_id 
 
2802
        # we want then, all revisions other needs to satisfy revision_id
2803
2803
        # checked, but not those that we have locally.
2804
 
        # so the first thing is to get a subset of the revisions to 
 
2804
        # so the first thing is to get a subset of the revisions to
2805
2805
        # satisfy revision_id in source, and then eliminate those that
2806
 
        # we do already have. 
 
2806
        # we do already have.
2807
2807
        # this is slow on high latency connection to self, but as as this
2808
 
        # disk format scales terribly for push anyway due to rewriting 
 
2808
        # disk format scales terribly for push anyway due to rewriting
2809
2809
        # inventory.weave, this is considered acceptable.
2810
2810
        # - RBC 20060209
2811
2811
        if revision_id is not None:
2831
2831
            # and the tip revision was validated by get_ancestry.
2832
2832
            result_set = required_revisions
2833
2833
        else:
2834
 
            # if we just grabbed the possibly available ids, then 
 
2834
            # if we just grabbed the possibly available ids, then
2835
2835
            # we only have an estimate of whats available and need to validate
2836
2836
            # that against the revision records.
2837
2837
            result_set = set(
2850
2850
    @staticmethod
2851
2851
    def is_compatible(source, target):
2852
2852
        """Be compatible with known Knit formats.
2853
 
        
 
2853
 
2854
2854
        We don't test for the stores being of specific types because that
2855
 
        could lead to confusing results, and there is no need to be 
 
2855
        could lead to confusing results, and there is no need to be
2856
2856
        overly general.
2857
2857
        """
2858
2858
        from bzrlib.repofmt.knitrepo import RepositoryFormatKnit
2901
2901
            # and the tip revision was validated by get_ancestry.
2902
2902
            result_set = required_revisions
2903
2903
        else:
2904
 
            # if we just grabbed the possibly available ids, then 
 
2904
            # if we just grabbed the possibly available ids, then
2905
2905
            # we only have an estimate of whats available and need to validate
2906
2906
            # that against the revision records.
2907
2907
            result_set = set(
2920
2920
    @staticmethod
2921
2921
    def is_compatible(source, target):
2922
2922
        """Be compatible with known Pack formats.
2923
 
        
 
2923
 
2924
2924
        We don't test for the stores being of specific types because that
2925
 
        could lead to confusing results, and there is no need to be 
 
2925
        could lead to confusing results, and there is no need to be
2926
2926
        overly general.
2927
2927
        """
2928
2928
        from bzrlib.repofmt.pack_repo import RepositoryFormatPack
3003
3003
 
3004
3004
    def _autopack(self):
3005
3005
        self.target._pack_collection.autopack()
3006
 
        
 
3006
 
3007
3007
    def _get_target_pack_collection(self):
3008
3008
        return self.target._pack_collection
3009
3009
 
3010
3010
    @needs_read_lock
3011
3011
    def search_missing_revision_ids(self, revision_id=None, find_ghosts=True):
3012
3012
        """See InterRepository.missing_revision_ids().
3013
 
        
 
3013
 
3014
3014
        :param find_ghosts: Find ghosts throughout the ancestry of
3015
3015
            revision_id.
3016
3016
        """
3073
3073
    @needs_write_lock
3074
3074
    def copy_content(self, revision_id=None):
3075
3075
        """Make a complete copy of the content in self into destination.
3076
 
        
3077
 
        This is a destructive operation! Do not use it on existing 
 
3076
 
 
3077
        This is a destructive operation! Do not use it on existing
3078
3078
        repositories.
3079
3079
 
3080
3080
        :param revision_id: Only copy the content needed to construct
3085
3085
        except NotImplementedError:
3086
3086
            pass
3087
3087
        # but don't bother fetching if we have the needed data now.
3088
 
        if (revision_id not in (None, _mod_revision.NULL_REVISION) and 
 
3088
        if (revision_id not in (None, _mod_revision.NULL_REVISION) and
3089
3089
            self.target.has_revision(revision_id)):
3090
3090
            return
3091
3091
        self.target.fetch(self.source, revision_id=revision_id)
3155
3155
        """See InterRepository.fetch()."""
3156
3156
        from bzrlib.fetch import Knit1to2Fetcher
3157
3157
        mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
3158
 
               self.source, self.source._format, self.target, 
 
3158
               self.source, self.source._format, self.target,
3159
3159
               self.target._format)
3160
3160
        f = Knit1to2Fetcher(to_repository=self.target,
3161
3161
                            from_repository=self.source,
3334
3334
            # Make _real_inter use the RemoteRepository for get_parent_map
3335
3335
            self._real_inter.target_get_graph = self.target.get_graph
3336
3336
            self._real_inter.target_get_parent_map = self.target.get_parent_map
3337
 
    
 
3337
 
3338
3338
    def copy_content(self, revision_id=None):
3339
3339
        self._ensure_real_inter()
3340
3340
        self._real_inter.copy_content(revision_id=revision_id)
3372
3372
            self.source._ensure_real()
3373
3373
            real_source = self.source._real_repository
3374
3374
            self._real_inter = InterRepository.get(real_source, self.target)
3375
 
    
 
3375
 
3376
3376
    def fetch(self, revision_id=None, pb=None, find_ghosts=False):
3377
3377
        self._ensure_real_inter()
3378
3378
        return self._real_inter.fetch(revision_id=revision_id, pb=pb,
3409
3409
                    if InterRepository._same_model(source, target):
3410
3410
                        return True
3411
3411
        return False
3412
 
    
 
3412
 
3413
3413
    def _autopack(self):
3414
3414
        self.target.autopack()
3415
 
        
 
3415
 
3416
3416
    def _get_target_pack_collection(self):
3417
3417
        return self.target._real_repository._pack_collection
3418
3418
 
3435
3435
 
3436
3436
class CopyConverter(object):
3437
3437
    """A repository conversion tool which just performs a copy of the content.
3438
 
    
 
3438
 
3439
3439
    This is slow but quite reliable.
3440
3440
    """
3441
3441
 
3445
3445
        :param target_format: The format the resulting repository should be.
3446
3446
        """
3447
3447
        self.target_format = target_format
3448
 
        
 
3448
 
3449
3449
    def convert(self, repo, pb):
3450
3450
        """Perform the conversion of to_convert, giving feedback via pb.
3451
3451
 
3520
3520
    def __init__(self, repository):
3521
3521
        self.repository = repository
3522
3522
        self.text_index = self.repository._generate_text_key_index()
3523
 
    
 
3523
 
3524
3524
    def calculate_file_version_parents(self, text_key):
3525
3525
        """Calculate the correct parents for a file version according to
3526
3526
        the inventories.