1005
1006
self._counters = {}
1006
1007
if 'config_stats' in selftest_debug_flags:
1007
1008
self._install_config_stats_hooks()
1009
# Do not use i18n for tests (unless the test reverses this)
1010
self.overrideAttr(i18n, 'installed', lambda: True)
1009
1012
def debug(self):
1010
1013
# debug a frame up.
2563
2566
root = TestCaseWithMemoryTransport.TEST_ROOT
2564
wt = bzrdir.BzrDir.create_standalone_workingtree(root)
2568
# Make sure we get a readable and accessible home for .bzr.log
2569
# and/or config files, and not fallback to weird defaults (see
2570
# http://pad.lv/825027).
2571
self.assertIs(None, os.environ.get('BZR_HOME', None))
2572
os.environ['BZR_HOME'] = root
2573
wt = bzrdir.BzrDir.create_standalone_workingtree(root)
2574
del os.environ['BZR_HOME']
2575
except Exception, e:
2576
self.fail("Fail to initialize the safety net: %r\nExiting\n" % (e,))
2565
2577
# Hack for speed: remember the raw bytes of the dirstate file so that
2566
2578
# we don't need to re-open the wt to check it hasn't changed.
2567
2579
TestCaseWithMemoryTransport._SAFETY_NET_PRISTINE_DIRSTATE = (
2618
2630
def make_branch(self, relpath, format=None):
2619
2631
"""Create a branch on the transport at relpath."""
2620
2632
repo = self.make_repository(relpath, format=format)
2621
return repo.bzrdir.create_branch()
2633
return repo.bzrdir.create_branch(append_revisions_only=False)
2635
def resolve_format(self, format):
2636
"""Resolve an object to a ControlDir format object.
2638
The initial format object can either already be
2639
a ControlDirFormat, None (for the default format),
2640
or a string with the name of the control dir format.
2642
:param format: Object to resolve
2643
:return A ControlDirFormat instance
2647
if isinstance(format, basestring):
2648
format = bzrdir.format_registry.make_bzrdir(format)
2651
def resolve_format(self, format):
2652
"""Resolve an object to a ControlDir format object.
2654
The initial format object can either already be
2655
a ControlDirFormat, None (for the default format),
2656
or a string with the name of the control dir format.
2658
:param format: Object to resolve
2659
:return A ControlDirFormat instance
2663
if isinstance(format, basestring):
2664
format = bzrdir.format_registry.make_bzrdir(format)
2623
2667
def make_bzrdir(self, relpath, format=None):
2628
2672
t = _mod_transport.get_transport(maybe_a_url)
2629
2673
if len(segments) > 1 and segments[-1] not in ('', '.'):
2630
2674
t.ensure_base()
2633
if isinstance(format, basestring):
2634
format = bzrdir.format_registry.make_bzrdir(format)
2675
format = self.resolve_format(format)
2635
2676
return format.initialize_on_transport(t)
2636
2677
except errors.UninitializableFormat:
2637
2678
raise TestSkipped("Format %s is not initializable." % format)