Mercurial > hgsubversion
diff tests/test_push_command.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 | afd047a7df45 |
children | 5c2917375961 |
line wrap: on
line diff
--- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -445,13 +445,69 @@ class PushTests(test_util.TestBase): new_hash = repo.commitctx(ctx) hg.update(repo, repo['tip'].node()) self.pushrevisions() - tip = self.repo['tip'] + # grab a new repo instance (self.repo is an @property functions) + repo = self.repo + tip = repo['tip'] self.assertNotEqual(tip.node(), new_hash) self.assertEqual(tip['gamma'].flags(), 'l') self.assertEqual(tip['gamma'].data(), 'foo') self.assertEqual([x for x in tip.manifest().keys() if 'l' not in tip[x].flags()], ['alpha', 'beta', 'adding_file', ]) + def file_callback2(repo, memctx, path): + if path == 'gamma': + return compathacks.makememfilectx(repo, + path=path, + data='a' * 129, + islink=True, + isexec=False, + copied=False) + raise IOError(errno.EINVAL, 'Invalid operation: ' + path) + + ctx = context.memctx(repo, + (repo['tip'].node(), node.nullid), + 'message', + ['gamma', ], + file_callback2, + 'author', + '2014-08-08 20:11:41 -0700', + {'branch': 'default', }) + repo.commitctx(ctx) + hg.update(repo, repo['tip'].node()) + self.pushrevisions() + # grab a new repo instance (self.repo is an @property functions) + repo = self.repo + tip = repo['tip'] + self.assertEqual(tip['gamma'].flags(), 'l') + self.assertEqual(tip['gamma'].data(), 'a'*129) + + def file_callback3(repo, memctx, path): + if path == 'gamma': + return compathacks.makememfilectx(repo, + path=path, + data='a' * 64 + 'b' * 65, + islink=True, + isexec=False, + copied=False) + raise IOError(errno.EINVAL, 'Invalid operation: ' + path) + + ctx = context.memctx(repo, + (repo['tip'].node(), node.nullid), + 'message', + ['gamma', ], + file_callback3, + 'author', + '2014-08-08 20:16:25 -0700', + {'branch': 'default', }) + repo.commitctx(ctx) + hg.update(repo, repo['tip'].node()) + self.pushrevisions() + repo = self.repo + tip = repo['tip'] + self.assertEqual(tip['gamma'].flags(), 'l') + self.assertEqual(tip['gamma'].data(), 'a' * 64 + 'b' * 65) + + def test_push_existing_file_newly_symlink(self): self.test_push_existing_file_newly_execute(execute=False, link=True,