# HG changeset patch # User Patrick Mezard # Date 2012-02-08 16:45:10 # Node ID 4e4c416a0b1f3522b08932f3266130470144a634 # Parent 8dc573a9c5e513bd859b2f65d461b039aa505d1e convert/bzr: ignore nested repos when listing branches (issue3254) Reported by A.S. Budden diff --git a/hgext/convert/bzr.py b/hgext/convert/bzr.py --- a/hgext/convert/bzr.py +++ b/hgext/convert/bzr.py @@ -91,13 +91,16 @@ class bzr_source(converter_source): def after(self): self.sourcerepo.unlock() + def _bzrbranches(self): + return self.sourcerepo.find_branches(using=True) + def getheads(self): if not self.rev: - heads = sorted([b.last_revision() - for b in self.sourcerepo.find_branches()]) + # Set using=True to avoid nested repositories (see issue3254) + heads = sorted([b.last_revision() for b in self._bzrbranches()]) else: revid = None - for branch in self.sourcerepo.find_branches(): + for branch in self._bzrbranches(): try: r = RevisionSpec.from_string(self.rev) info = r.in_history(branch) @@ -164,7 +167,7 @@ class bzr_source(converter_source): def gettags(self): bytetags = {} - for branch in self.sourcerepo.find_branches(): + for branch in self._bzrbranches(): if not branch.supports_tags(): return {} tagdict = branch.tags.get_tag_dict() diff --git a/tests/test-convert-bzr.t b/tests/test-convert-bzr.t --- a/tests/test-convert-bzr.t +++ b/tests/test-convert-bzr.t @@ -261,3 +261,24 @@ not and get incorporated in extra fields tip 3:* (glob) branch-tag 1:* (glob) trunk-tag 0:* (glob) + +Nested repositories (issue3254) + + $ bzr init-repo -q --no-trees repo/inner + $ bzr init -q repo/inner/trunk + $ bzr co repo/inner/trunk inner-trunk + $ cd inner-trunk + $ echo b > b + $ bzr add b + adding b + $ bzr ci -qm addb + $ cd .. + $ hg convert --datesort repo noinner-bzr + initializing destination noinner-bzr repository + scanning source... + sorting... + converting... + 2 adda + 1 addb + 0 changea + updating tags