# HG changeset patch # User Patrick Mezard # Date 1328719510 -3600 # Node ID 4e4c416a0b1f3522b08932f3266130470144a634 # Parent 8dc573a9c5e513bd859b2f65d461b039aa505d1e convert/bzr: ignore nested repos when listing branches (issue3254) Reported by A.S. Budden diff -r 8dc573a9c5e5 -r 4e4c416a0b1f hgext/convert/bzr.py --- a/hgext/convert/bzr.py Wed Feb 08 20:00:52 2012 +0100 +++ b/hgext/convert/bzr.py Wed Feb 08 17:45:10 2012 +0100 @@ -91,13 +91,16 @@ 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 @@ 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 -r 8dc573a9c5e5 -r 4e4c416a0b1f tests/test-convert-bzr.t --- a/tests/test-convert-bzr.t Wed Feb 08 20:00:52 2012 +0100 +++ b/tests/test-convert-bzr.t Wed Feb 08 17:45:10 2012 +0100 @@ -261,3 +261,24 @@ 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