Commit 6e1b099d authored by Javier Merino Cacho's avatar Javier Merino Cacho

Upstream version 1.6.3

parent f57bc4ab
repo: f2636cfed11500fdc47d1e3822d8e4a2bd636bf7
node: 7d47a0f731354505ed9ae8d60d2a6996e8c3294f
branch: default
tag: 1.6
node: 46523cdfd3b0cee0bf1366ab587686bb65211747
branch: stable
tag: 1.6.3
41ff2014d125cfe6eda39a79dc1c7ca9c99bf785 0 iQIcBAABAgAGBQJTY6GOAAoJELnJ3IJKpb3VrTcP/iIvysZP7BMyBW6QfAZMl9vRz06BlOgGIapNFcI2E12yC6j8oADymz2QZCtj21YyyuxIeuPLya5LQ1OoGHsZk/iW700UxUdrUzW3QbKiTfKrNXN915aRE1rYznzetgQc+xqGV4Hk7P5GarAfBcZtCVtc7/Gmo9AMkU1QbLzhwDGMLLUDt1Gsu9Vn3JugVN6O10NqxxGvU18ahVMsy+qyaJBZ5fJUKnBAmwHa3DCP5DRfDNKUaAl7xOK09gvRi6h6dPl8HPrx6tN3wkQ0QRB6kD06yrJejnQ7eM/1fxLNovZ0MZe2+bHMeXWnzGseQsrlvZSi3GWch4xSW+Tqa/pRo0qbbQ8Tq3Hj7J2Ip482nEwzEZZiWcw/1vAIraYkinGuTcw0Kq+IsKh8zBRN5jiyq3NNQYXraC93KL9/raVbssPG6KAP7LBiN0cYM51T3lL1ER1/oMJJfdX4OWn6dCRptlqfwhW9hxK/R+dbm2lOcT6EENtYp4nq5amqym0i4zx/bAJmw4mpNMEmZdAIBCgjxxb01ez1IQFzvg+/+DIr62n+YGlhsYVJTDRVAdwaLXQKnSo7gIowpsWU9WRejxaISuVr6aQbuMtbtZIjqUFSIC6UR1d9GQdkiXWv+tCP29UHqTV+81BaFAyTe6s4zc5IhEZudwdN6f1bBtYD3BN3vX9M
5cdc58c1c9a7ed24a7e206150032a9443a59c569 0 iQIcBAABAgAGBQJT25kVAAoJELnJ3IJKpb3Vxm0QAMQApF/pARrrb3k1ZholO0o4y1AU9551r3yeFRS9U6kqofqspSOKx0rrzw2RraSuMP++eznjfpbv1njM/Zd+oEFgCEHxq6lrkafxxq8oKj07IVqjaRshleBiVbr9/Hrko7W4zjhV6ROIpM2g1o6Sx8qXqRkzAB3YbDppxnI5lVOVZGnKDTcInw+eaDRX5S8clXdd+xbRBSRd+gM6VFsUrP9963S7siZU/u8Lmo5fUZdKFC5iNLPjTuhEhw7FWg4TzeAyWedvv0WFl14TJpdJRlmdwptVlR48PkjFZUhwcYZJ4LE2HUclpDmNRpR1PMrZK5FdH42vM9OQfB2c+0whDWUo0UaM1QnEc1NKj5828FmknfwrwwNrcanHl+Ig4ccmVJeDZDtZDg0TyUBPfnUVBvNFTpJqPo7MlAeQD1e5YflHSZR+CBzG8UTQssJbfiwO2o+bKVrqjHxjvsIqjdvi2Ueeh0fZw09l/zzz17I4RymwQTD+laEXQ7Xk+0VwQyYBfeR/nwYORcWDVVrATxROvG3lqKqGbU0VnzUoGF7P+bRbWEX8Y+noSKPYiqoDunIv4su9IOMBG0Y672X+ETta8ALKWKAx8cSD/kVzyLqQPWryvgUv6eG6iJpDN/uw7F23gRkKdBhOH9N9TSBCfA6ZUvTTgsDz5HLsEiOMCDQKXzv5
......@@ -9,3 +9,5 @@
07234759a3f750029ccaa001837d42fa12dd33ee 1.4
77b22e5b4ea6c248e079afd0f1e544cb5690ce20 1.5
d0f3a5c2cb56ce65d9ef1c611c8bfbebdc3bef34 1.5.1
8caf1226adecb322e90ddb3817c604fa2fe8a66d 1.6.1
36f6d51b4edc31f1f9ce2d0d02965a85dd26a455 1.6.2
"""Functions to work around API changes inside Mercurial."""
def branchset(repo):
"""Return the set of branches present in a repo.
Works around branchtags() vanishing between 2.8 and 2.9.
"""
try:
return set(repo.branchmap())
except AttributeError:
return set(repo.branchtags())
"""Return the set of branches present in a repo.
Works around branchtags() vanishing between 2.8 and 2.9.
"""
try:
return set(repo.branchmap())
except AttributeError:
return set(repo.branchtags())
def pickle_load(f):
import cPickle as pickle
f.seek(0)
return pickle.load(f)
def makememfilectx(repo, path, data, islink, isexec, copied):
"""Return a memfilectx
Works around memfilectx() adding a repo argument between 3.0 and 3.1.
"""
from mercurial import context
try:
return context.memfilectx(repo, path, data, islink, isexec, copied)
except TypeError:
return context.memfilectx(path, data, islink, isexec, copied)
......@@ -57,7 +57,12 @@ class StandardLayout(base.BaseLayout):
def taglocations(self, meta_data_dir):
# import late to avoid trouble when running the test suite
from hgext_hgsubversion import util
try:
# newer versions of mercurial >= 2.8 will import this because the
# hgext_ logic is already being done in core
from hgsubversion import util
except ImportError:
from hgext_hgsubversion import util
if self._tag_locations is None:
......
......@@ -133,6 +133,8 @@ def commit(ui, repo, rev_ctx, meta, base_revision, svn):
# 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_revision, svn):
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'
......
......@@ -164,10 +164,12 @@ def _convert_rev(ui, meta, svn, r, tbdelta, firstrun):
'%s\n' % current_file)
else:
data = parentctx.filectx(path).data()
return context.memfilectx(path=path,
data=data,
islink=islink, isexec=isexec,
copied=copied)
return compathacks.makememfilectx(repo,
path=path,
data=data,
islink=islink,
isexec=isexec,
copied=copied)
meta.mapbranch(extra)
current_ctx = context.memctx(meta.repo,
......
......@@ -386,8 +386,12 @@ def diff_branchrev(ui, svn, meta, branch, branchpath, r, parentctx):
# and this may actually imply a bug in getcopies
if copied not in parentctx.manifest():
copied = None
return context.memfilectx(path=path, data=data, islink=islink,
isexec=isexe, copied=copied)
return compathacks.makememfilectx(repo,
path=path,
data=data,
islink=islink,
isexec=isexe,
copied=copied)
return list(touched_files), filectxfn
......@@ -591,8 +595,12 @@ def fetch_branchrev(svn, meta, branch, branchpath, r, parentctx):
# and this may actually imply a bug in getcopies
if copied not in parentctx.manifest():
copied = None
return context.memfilectx(path=path, data=data, islink=islink,
isexec=isexec, copied=copied)
return compathacks.makememfilectx(repo,
path=path,
data=data,
islink=islink,
isexec=isexec,
copied=copied)
return files, filectxfn
......@@ -755,9 +763,12 @@ def convert_rev(ui, meta, svn, r, tbdelta, firstrun):
if path in externals:
if externals[path] is None:
raise IOError(errno.ENOENT, 'no externals')
return context.memfilectx(path=path, data=externals[path],
islink=False, isexec=False,
copied=None)
return compathacks.makememfilectx(repo,
path=path,
data=externals[path],
islink=False,
isexec=False,
copied=None)
for bad in bad_branch_paths[b]:
if path.startswith(bad):
raise IOError(errno.ENOENT, 'Path %s is bad' % path)
......
......@@ -8,6 +8,7 @@ from mercurial import util as hgutil
from mercurial import revlog
from mercurial import node
import compathacks
import util
import maps
import layouts
......@@ -571,11 +572,12 @@ class SVNMeta(object):
tagdata += '%s %s\n' % (node.hex(hash), self.tagmap.get(tag, tag))
def hgtagsfn(repo, memctx, path):
assert path == '.hgtags'
return context.memfilectx(path=path,
data=tagdata,
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data=tagdata,
islink=False,
isexec=False,
copied=False)
revnum, branch = self.get_source_rev(ctx=parentctx)[:2]
newparent = None
for child in parentctx.children():
......@@ -641,9 +643,12 @@ class SVNMeta(object):
# add new changeset containing updated .hgtags
def fctxfun(repo, memctx, path):
return context.memfilectx(path='.hgtags', data=src,
islink=False, isexec=False,
copied=None)
return compathacks.makememfilectx(repo,
path='.hgtags',
data=src,
islink=False,
isexec=False,
copied=None)
extra = self.genextra(rev.revnum, b)
if fromtag:
......
......@@ -88,7 +88,12 @@ def generate_repo_class(ui, repo):
class svnlocalrepo(superclass):
def svn_commitctx(self, ctx):
"""Commits a ctx, but defeats manifest recycling introduced in hg 1.9."""
hash = self.commitctx(ctxctx(ctx))
ncbackup = self.ui.backupconfig('phases', 'new-commit')
try:
self.ui.setconfig('phases', 'new-commit', 'public')
hash = self.commitctx(ctxctx(ctx))
finally:
self.ui.restoreconfig(ncbackup)
if phases is not None and getattr(self, 'pushkey', False):
# set phase to be public
self.pushkey('phases', self[hash].hex(), str(phases.draft), str(phases.public))
......@@ -286,7 +291,15 @@ class SubversionPrompt(object):
else:
msg += '(R)eject or accept (t)emporarily? '
choices = (('&Reject'), ('&Temporarily'))
choice = self.ui.promptchoice(msg, choices, default=0)
try:
choice = self.ui.promptchoice(msg, choices, default=0)
except TypeError:
# mercurial version >2.6 use a different syntax and method signature
msg += '$$ &Reject $$ &Temporarily '
if may_save:
msg += '$$ &Permanently '
choice = self.ui.promptchoice(msg, default=0)
if choice == 1:
creds = (failures, False)
elif may_save and choice == 2:
......
......@@ -180,11 +180,21 @@ def push(repo, dest, force, revs):
cmdutil.bailifchanged(repo)
checkpush = getattr(repo, 'checkpush', None)
if checkpush:
checkpush(force, revs)
try:
# The checkpush function changed as of e10000369b47 in mercurial
from mercurial.exchange import pushoperation
pushop = pushoperation(repo, dest, force, revs, False)
checkpush(pushop)
except (ImportError, TypeError):
checkpush(force, revs)
ui = repo.ui
old_encoding = util.swap_out_encoding()
hasobsolete = obsolete and obsolete._enabled
try:
hasobsolete = obsolete._enabled
except:
hasobsolete = False
temporary_commits = []
try:
......
......@@ -60,6 +60,13 @@ class TestPull(test_util.TestBase):
commands.pull(repo.ui, repo)
self.assertEqual(oldheads, map(node.hex, repo.heads()))
def test_pull_with_secret_default(self):
repo = self._loadupdate('branchtagcollision.svndump',
config={'phases.new-commit': 'secret'})[0]
oldheads = map(node.hex, repo.heads())
commands.pull(repo.ui, repo)
self.assertEqual(oldheads, map(node.hex, repo.heads()))
def test_skip_basic(self):
repo, repo_path = self._loadupdate('single_rev.svndump')
self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
......
This diff is collapsed.
......@@ -23,17 +23,19 @@ class TestSingleDirPush(test_util.TestBase):
subdir='')
def file_callback(repo, memctx, path):
if path == 'adding_file':
return context.memfilectx(path=path,
data='foo',
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='foo',
islink=False,
isexec=False,
copied=False)
elif path == 'adding_binary':
return context.memfilectx(path=path,
data='\0binary',
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='\0binary',
islink=False,
isexec=False,
copied=False)
raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
ctx = context.memctx(repo,
(repo['tip'].node(), node.nullid),
......@@ -62,11 +64,12 @@ class TestSingleDirPush(test_util.TestBase):
layout='single',
subdir='trunk')
def filectxfn(repo, memctx, path):
return context.memfilectx(path=path,
data='contents of %s' % path,
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='contents of %s' % path,
islink=False,
isexec=False,
copied=False)
ctx = context.memctx(repo,
(repo['tip'].node(), node.nullid),
'automated test',
......@@ -95,11 +98,12 @@ class TestSingleDirPush(test_util.TestBase):
subdir='trunk')
self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
def file_callback(repo, memctx, path):
return context.memfilectx(path=path,
data='data of %s' % path,
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='data of %s' % path,
islink=False,
isexec=False,
copied=False)
for fn in ['one', 'two']:
ctx = context.memctx(repo,
(repo['tip'].node(), node.nullid),
......@@ -126,11 +130,12 @@ class TestSingleDirPush(test_util.TestBase):
def file_callback(data):
def cb(repo, memctx, path):
if path == data:
return context.memfilectx(path=path,
data=data,
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data=data,
islink=False,
isexec=False,
copied=False)
raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
return cb
......@@ -174,11 +179,12 @@ class TestSingleDirPush(test_util.TestBase):
def file_callback(repo, memctx, path):
if path == 'adding_file':
return context.memfilectx(path=path,
data='foo',
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='foo',
islink=False,
isexec=False,
copied=False)
raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
ctx = context.memctx(self.repo,
(self.repo['tip'].node(), node.nullid),
......
......@@ -30,24 +30,27 @@ class CapturingUI(ui.ui):
class TestLogKeywords(test_util.TestBase):
@test_util.requiresmodule(templatekw)
def test_svn_keywords(self):
defaults = {'date': None, 'rev': None, 'user': None}
defaults = {'date': None, 'rev': None, 'user': None, 'graph': True}
repo = self._load_fixture_and_fetch('two_revs.svndump')
# we want one commit that isn't from Subversion
self.commitchanges([('foo', 'foo', 'frobnicate\n')])
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
self.assertEqual(ui._output, '0:2 1:3 2: ')
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnpath} ', **defaults)
self.assertEqual(ui._output, '0:/trunk 1:/trunk 2: ')
ui = CapturingUI()
commands.log(ui, repo, template='{rev}:{svnuuid} ', **defaults)
self.assertEqual(ui._output,
('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
'1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
'2: '))
commands.log(ui, repo, template=(' rev: {rev} svnrev:{svnrev} '
'svnpath:{svnpath} svnuuid:{svnuuid}\n'),
**defaults)
print ui._output
self.assertEqual(ui._output.strip(), '''
rev: 2 svnrev: svnpath: svnuuid:
@
|
rev: 1 svnrev:3 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
o
|
rev: 0 svnrev:2 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
o
'''.strip())
@test_util.requiresmodule(revset)
@test_util.requiresmodule(templatekw)
......
......@@ -27,8 +27,11 @@ from mercurial import ui
from mercurial import util
from mercurial import extensions
from hgsubversion import compathacks
try:
from mercurial import obsolete
obsolete._enabled
except ImportError:
obsolete = None
......@@ -664,11 +667,12 @@ class TestBase(unittest.TestCase):
copied = None
if source != dest:
copied = source
return context.memfilectx(path=dest,
data=newdata,
islink=False,
isexec=False,
copied=copied)
return compathacks.makememfilectx(repo,
path=dest,
data=newdata,
islink=False,
isexec=False,
copied=copied)
ctx = context.memctx(repo,
(parentctx.node(), node.nullid),
......
......@@ -16,6 +16,7 @@ from hgsubversion import util
from hgsubversion import svncommands
from hgsubversion import verify
from hgsubversion import wrappers
from hgsubversion import compathacks
expected_info_output = '''URL: %(repourl)s/%(branch)s
Repository Root: %(repourl)s
......@@ -160,11 +161,12 @@ class UtilityTests(test_util.TestBase):
u.pushbuffer()
parents = (self.repo['the_branch'].node(), revlog.nullid,)
def filectxfn(repo, memctx, path):
return context.memfilectx(path=path,
data='added',
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='added',
islink=False,
isexec=False,
copied=False)
ctx = context.memctx(self.repo,
parents,
'automated test',
......@@ -203,11 +205,12 @@ class UtilityTests(test_util.TestBase):
u = self.ui()
parents = (self.repo['the_branch'].node(), revlog.nullid,)
def filectxfn(repo, memctx, path):
return context.memfilectx(path=path,
data='added',
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='added',
islink=False,
isexec=False,
copied=False)
ctx = context.memctx(self.repo,
parents,
'automated test',
......@@ -233,11 +236,12 @@ class UtilityTests(test_util.TestBase):
self._load_fixture_and_fetch('two_revs.svndump')
parents = (self.repo[0].node(), revlog.nullid,)
def filectxfn(repo, memctx, path):
return context.memfilectx(path=path,
data='added',
islink=False,
isexec=False,
copied=False)
return compathacks.makememfilectx(repo,
path=path,
data='added',
islink=False,
isexec=False,
copied=False)
ctx = context.memctx(self.repo,
parents,
'automated test',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment