##// END OF EJS Templates
Migrate to Mergely 3.3.4....
Migrate to Mergely 3.3.4. RhodeCode 2.2.5 distributed Mergely 3.3.4 with some of the changes that Mergely 3.3.3 in RhodeCode 1.7.2 also had. That do however not seem to be changes we want for Kallithea this way and we take the 3.3.4 files as they are. I've also included the Mergely license file, as downloaded from: http://www.mergely.com/license.php That LICENSE file is kept in HTML just as it was downloaded from their website. While it's a bit annoying to keep the license file in HTML, this is the way it came from upstream so we'll leave it that way. Since the Javascript code is used with other GPLv3 Javascript, we are using the GPL option of Mergely's tri-license. Finally, note that previously, this was incorrectly called "mergerly", so the opportunity is taken here to correct the name. That required changes to diff_2way.html. As commands:: $ wget -N --output-document LICENSE-MERGELY.html http://www.mergely.com/license.php $ hg add LICENSE-MERGELY.html $ hg mv rhodecode/public/css/mergerly.css rhodecode/public/css/mergely.css $ hg mv rhodecode/public/js/mergerly.js rhodecode/public/js/mergely.js $ sed -i 's,mergerly\.,mergely,g' rhodecode/templates/files/diff_2way.html $ ( cd /tmp; \ wget -N http://www.mergely.com/releases/mergely-3.3.4.zip; \ unzip mergely-3.3.4.zip ) $ sha256sum /tmp/mergely-3.3.4.zip 87415d30494bbe829c248881aa7cdc0303f7e70b458a5f687615564d4498cc82 mergely-3.3.4.zip $ cp /tmp/mergely-3.3.4/lib/mergely.js rhodecode/public/js/mergely.js $ cp /tmp/mergely-3.3.4/lib/mergely.css rhodecode/public/css/mergely.css $ sed -i -e '/^ \* Version/a\ *\n * NOTE by bkuhn@sfconservancy.org for Kallithea:\n * Mergely license appears at http://www.mergely.com/license.php and in LICENSE-MERGELY.html' rhodecode/public/js/mergely.js rhodecode/public/css/mergely.css

File last commit:

r2543:03a77098 beta
r4125:aa3b5594 rhodecode-2.2.5-gpl
Show More
inmemory.py
113 lines | 4.3 KiB | text/x-python | PythonLexer
import datetime
import errno
from rhodecode.lib.vcs.backends.base import BaseInMemoryChangeset
from rhodecode.lib.vcs.exceptions import RepositoryError
from rhodecode.lib.vcs.utils.hgcompat import memfilectx, memctx, hex, tolocal
class MercurialInMemoryChangeset(BaseInMemoryChangeset):
def commit(self, message, author, parents=None, branch=None, date=None,
**kwargs):
"""
Performs in-memory commit (doesn't check workdir in any way) and
returns newly created ``Changeset``. Updates repository's
``revisions``.
:param message: message of the commit
:param author: full username, i.e. "Joe Doe <joe.doe@example.com>"
:param parents: single parent or sequence of parents from which commit
would be derieved
:param date: ``datetime.datetime`` instance. Defaults to
``datetime.datetime.now()``.
:param branch: branch name, as string. If none given, default backend's
branch would be used.
:raises ``CommitError``: if any error occurs while committing
"""
self.check_integrity(parents)
from .repository import MercurialRepository
if not isinstance(message, unicode) or not isinstance(author, unicode):
raise RepositoryError('Given message and author needs to be '
'an <unicode> instance got %r & %r instead'
% (type(message), type(author)))
if branch is None:
branch = MercurialRepository.DEFAULT_BRANCH_NAME
kwargs['branch'] = branch
def filectxfn(_repo, memctx, path):
"""
Marks given path as added/changed/removed in a given _repo. This is
for internal mercurial commit function.
"""
# check if this path is removed
if path in (node.path for node in self.removed):
# Raising exception is a way to mark node for removal
raise IOError(errno.ENOENT, '%s is deleted' % path)
# check if this path is added
for node in self.added:
if node.path == path:
return memfilectx(path=node.path,
data=(node.content.encode('utf8')
if not node.is_binary else node.content),
islink=False,
isexec=node.is_executable,
copied=False)
# or changed
for node in self.changed:
if node.path == path:
return memfilectx(path=node.path,
data=(node.content.encode('utf8')
if not node.is_binary else node.content),
islink=False,
isexec=node.is_executable,
copied=False)
raise RepositoryError("Given path haven't been marked as added,"
"changed or removed (%s)" % path)
parents = [None, None]
for i, parent in enumerate(self.parents):
if parent is not None:
parents[i] = parent._ctx.node()
if date and isinstance(date, datetime.datetime):
date = date.ctime()
commit_ctx = memctx(repo=self.repository._repo,
parents=parents,
text='',
files=self.get_paths(),
filectxfn=filectxfn,
user=author,
date=date,
extra=kwargs)
loc = lambda u: tolocal(u.encode('utf-8'))
# injecting given _repo params
commit_ctx._text = loc(message)
commit_ctx._user = loc(author)
commit_ctx._date = date
# TODO: Catch exceptions!
n = self.repository._repo.commitctx(commit_ctx)
# Returns mercurial node
self._commit_ctx = commit_ctx # For reference
# Update vcs repository object & recreate mercurial _repo
# new_ctx = self.repository._repo[node]
# new_tip = self.repository.get_changeset(new_ctx.hex())
new_id = hex(n)
self.repository.revisions.append(new_id)
self._repo = self.repository._get_repo(create=False)
self.repository.branches = self.repository._get_branches()
tip = self.repository.get_changeset()
self.reset()
return tip