# HG changeset patch # User Augie Fackler # Date 1451581618 18000 # Node ID 89997a5fc18163c5f65b83272b4521cdbf29984e # Parent 460332aafe7d5e888c1af8e5343104ece3a504d2 stupid: self-disable if svn bindings are too new to work with stupid mode Subversion 1.9 enhanced the diff format slightly in a way that we can't parse. We're collectively weary in hgsubversion of parsing diffs to emulate replay given that ra_replay was new in Subversion 1.5, which is now 7.5 years old. Rather than try to adapt to the diff format changes, we'll disable stupid mode for 1.9 bindings and see if anyone actually bothers to email the list and tell us they saw the message. I figure if we don't see anything by mid 2016 or so we can rip out stupid mode entirely. Disable all tests that use stupid mode when 1.9 is in play. This should actually be a nice runtime win on the testsuite since we'll be running many hundreds fewer tests overall. diff --git a/hgsubversion/stupid.py b/hgsubversion/stupid.py --- a/hgsubversion/stupid.py +++ b/hgsubversion/stupid.py @@ -630,6 +630,11 @@ def branches_in_paths(meta, tbdelta, pat return branches def convert_rev(ui, meta, svn, r, tbdelta, firstrun): + if svnwrap.subversion_version >= (1, 9, 0): + raise hgutil.Abort( + "hgsubversion doesn't support stupid mode with Subversion 1.9." + ' Please email hgsubversion@googlegroups.com and let us know you' + ' saw this, otherwise we may remove stupid mode entirely.') # this server fails at replay if meta.filemap: diff --git a/tests/comprehensive/test_custom_layout.py b/tests/comprehensive/test_custom_layout.py --- a/tests/comprehensive/test_custom_layout.py +++ b/tests/comprehensive/test_custom_layout.py @@ -14,6 +14,7 @@ except ImportError: import test_util from hgsubversion import wrappers +from hgsubversion import svnwrap def _do_case(self, name, stupid): @@ -55,7 +56,8 @@ attrs = {'_do_case': _do_case, for case in test_util.custom: name = 'test_' + case[:-len('.svndump')].replace('-', '_') attrs[name] = buildmethod(case, name, stupid=False) - name += '_stupid' - attrs[name] = buildmethod(case, name, stupid=True) + if svnwrap.subversion_version < (1, 9, 0): + name += '_stupid' + attrs[name] = buildmethod(case, name, stupid=True) CustomPullTests = type('CustomPullTests', (test_util.TestBase,), attrs) diff --git a/tests/comprehensive/test_stupid_pull.py b/tests/comprehensive/test_stupid_pull.py --- a/tests/comprehensive/test_stupid_pull.py +++ b/tests/comprehensive/test_stupid_pull.py @@ -14,6 +14,7 @@ except ImportError: import test_util from hgsubversion import wrappers +from hgsubversion import svnwrap def _do_case(self, name, layout): @@ -48,18 +49,20 @@ def buildmethod(case, name, layout): m.__doc__ = 'Test stupid produces same as real on %s. (%s)' % (case, layout) return m -attrs = {'_do_case': _do_case, - } -for case in (f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')): - if case == 'corrupt.svndump': - continue - name = 'test_' + case[:-len('.svndump')].replace('-', '_') - # Automatic layout branchtag collision exposes a minor defect - # here, but since it isn't a regression we suppress the test case. - if case != 'branchtagcollision.svndump': - attrs[name] = buildmethod(case, name, 'auto') - attrs[name + '_single'] = buildmethod(case, name + '_single', 'single') - if case in test_util.custom: - attrs[name + '_custom'] = buildmethod(case, name + '_custom', 'custom') +if svnwrap.subversion_version < (1, 9, 0): + attrs = {'_do_case': _do_case, + } + for case in (f for f in os.listdir(test_util.FIXTURES) + if f.endswith('.svndump')): + if case == 'corrupt.svndump': + continue + name = 'test_' + case[:-len('.svndump')].replace('-', '_') + # Automatic layout branchtag collision exposes a minor defect + # here, but since it isn't a regression we suppress the test case. + if case != 'branchtagcollision.svndump': + attrs[name] = buildmethod(case, name, 'auto') + attrs[name + '_single'] = buildmethod(case, name + '_single', 'single') + if case in test_util.custom: + attrs[name + '_custom'] = buildmethod(case, name + '_custom', 'custom') -StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs) + StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs) diff --git a/tests/test_util.py b/tests/test_util.py --- a/tests/test_util.py +++ b/tests/test_util.py @@ -28,6 +28,7 @@ from mercurial import util as hgutil from mercurial import extensions from hgsubversion import compathacks +from hgsubversion import svnwrap try: from mercurial import obsolete @@ -435,7 +436,7 @@ class TestMeta(type): for origname in dir(cls): _obsolete_wrap(cls, origname) - if cls.stupid_mode_tests: + if cls.stupid_mode_tests and svnwrap.subversion_version < (1, 9, 0): for origname in dir(cls): _stupid_wrap(cls, origname) @@ -765,7 +766,11 @@ files: {files} """ _ui.pushbuffer() - graphlog.graphlog(_ui, repo, rev=None, template=templ) + try: + graphlog.graphlog(_ui, repo, rev=None, template=templ) + except AttributeError: + from mercurial import commands + commands.log(_ui, repo, rev=None, template=templ, graph=True) return _ui.popbuffer() def draw(self, repo):