Mercurial > hgsubversion
view tests/run.py @ 1229:46523cdfd3b0 stable 1.6.3
pushmod: prepend "link " to base text for links
http://svn.apache.org/viewvc?view=revision&revision=1223036 exposes
what is arguably a bug in hgsubversion push code. Specifically, when
we are receiving text from the server in an editor, we prepend a "link
" to the text of symlinks when opening a file and strip it when
closing a file. We don't, however, prepend "link " to the base we use
when sending text changes to the server.
This was working before because prior to that revision, the first
thing subversion did was to check whether the entirety of the before
text or the entirety of the after text was less than 64 bytes. In
that case, it just sent the entirety of the after text as a single
insert operation. I'd expect most, but not all symlinks to fit under
the 64 byte limit, including the leading "link " text on the
subversion end.
After the change, the first thing subversion does is check for a
leading match that is more than 4 bytes long, or that is the full
length of the after text. In this case, it sends a copy operation for
the leading match, and then goes into the if < 64 bytes remaining send
the whole thing behavior. It also looks for trailing matches of more
than 4 bytes even in the <64 byte case, but that's not what breaks the
tests.
Incidentally, changing the destination of long symlinks was broken
even before this subversion change. This diff includes test additions
that cover that breakage.
author | David Schleimer <dschleimer@gmail.com> |
---|---|
date | Thu, 07 Aug 2014 19:30:26 -0700 |
parents | 025de18d652b |
children | 4217a050a088 |
line wrap: on
line source
#!/usr/bin/env python import optparse import os import sys import unittest import test_util test_util.SkipTest = None def tests(): import test_binaryfiles import test_diff import test_externals import test_fetch_branches import test_fetch_command import test_fetch_command_regexes import test_fetch_exec import test_fetch_mappings import test_fetch_renames import test_fetch_symlinks import test_fetch_truncated import test_hooks import test_svn_pre_commit_hooks import test_pull import test_pull_fallback import test_push_command import test_push_renames import test_push_dirs import test_push_eol import test_push_autoprops import test_single_dir_clone import test_single_dir_push import test_svnwrap import test_tags import test_template_keywords import test_utility_commands import test_unaffected_core import test_urls sys.path.append(os.path.dirname(__file__)) sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive')) import test_rebuildmeta import test_stupid_pull import test_updatemeta import test_verify_and_startrev return locals() def comprehensive(mod): dir = os.path.basename(os.path.dirname(mod.__file__)) return dir == 'comprehensive' if __name__ == '__main__': description = ("This script runs the hgsubversion tests. If no tests are " "specified, all known tests are implied.") parser = optparse.OptionParser(usage="%prog [options] [TESTS ...]", description=description) parser.add_option("-A", "--all", dest="comprehensive", action="store_true", default=False, help="include slow, but comprehensive tests") parser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False, help="enable verbose output") parser.add_option("", "--no-demandimport", dest="demandimport", action="store_false", default=True, help="disable Mercurial demandimport loading") parser.add_option("", "--bindings", dest="bindings", action="store", default=None, choices=["swig", "subvertpy"], help="test using the specified bindings (swig or " "subvertpy)") parser.add_option("", "--show-stdout", dest="showstdout", action="store_true", default=False, help="show stdout (hidden by default)") (options, args) = parser.parse_args() if options.verbose: testargs = { 'descriptions': 3, 'verbosity': 2 } else: testargs = {'descriptions': 2} sys.path.append(os.path.dirname(os.path.dirname(__file__))) if options.demandimport: from mercurial import demandimport demandimport.enable() if options.bindings: os.environ['HGSUBVERSION_BINDINGS'] = options.bindings # make sure our copy of hgsubversion gets imported by loading test_util import test_util test_util.TestBase # silence output when running outside nose if not options.showstdout: import tempfile sys.stdout = tempfile.TemporaryFile() all_tests = tests() args = [i.split('.py')[0].replace('-', '_') for i in args] loader = unittest.TestLoader() suite = unittest.TestSuite() if not args: check = lambda x: options.comprehensive or not comprehensive(x) suite.addTests(loader.loadTestsFromModule(m) for (n, m) in sorted(all_tests.iteritems()) if check(m)) else: for arg in args: if arg == 'test_util': continue elif arg not in all_tests: print >> sys.stderr, 'test module %s not available' % arg else: suite.addTest(loader.loadTestsFromModule(all_tests[arg])) runner = unittest.TextTestRunner(**testargs) result = runner.run(suite) if not result.wasSuccessful(): sys.exit(1)