# HG changeset patch # User Augie Fackler # Date 1407856121 14400 # Node ID 5c29173759610c399c6982b7fb6645931aa50b5d # Parent 9490a30529358456e47cf7c3e1f0322ecf93724e# Parent 807c443928d4b033eb7254100de1f48a47e93e4a Merge with stable. diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -12,3 +12,4 @@ d0f3a5c2cb56ce65d9ef1c611c8bfbebdc3bef34 7d47a0f731354505ed9ae8d60d2a6996e8c3294f 1.6 8caf1226adecb322e90ddb3817c604fa2fe8a66d 1.6.1 36f6d51b4edc31f1f9ce2d0d02965a85dd26a455 1.6.2 +46523cdfd3b0cee0bf1366ab587686bb65211747 1.6.3 diff --git a/hgsubversion/pushmod.py b/hgsubversion/pushmod.py --- a/hgsubversion/pushmod.py +++ b/hgsubversion/pushmod.py @@ -133,6 +133,8 @@ def commit(ui, repo, rev_ctx, meta, base # this kind of renames: a -> b, b -> c copies[file] = renamed[0] base_data = parent[renamed[0]].data() + if 'l' in parent[renamed[0]].flags(): + base_data = 'link ' + base_data else: autoprops = svn.autoprops_config.properties(file) if autoprops: @@ -145,9 +147,10 @@ def commit(ui, repo, rev_ctx, meta, base if ('x' in parent.filectx(file).flags() and 'x' not in rev_ctx.filectx(file).flags()): props.setdefault(file, {})['svn:executable'] = None - if ('l' in parent.filectx(file).flags() - and 'l' not in rev_ctx.filectx(file).flags()): - props.setdefault(file, {})['svn:special'] = None + if 'l' in parent.filectx(file).flags(): + base_data = 'link ' + base_data + if 'l' not in rev_ctx.filectx(file).flags(): + props.setdefault(file, {})['svn:special'] = None if hgutil.binary(base_data) and not isbinary: props.setdefault(file, {})['svn:mime-type'] = None action = 'modify' diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- 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,