Mercurial > kallithea
changeset 2234:ef35dce65557 beta
Added EmptyChangeset into VCS module
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 04 May 2012 00:26:16 +0200 |
parents | 07fce1930417 |
children | b6adef467e23 |
files | rhodecode/lib/vcs/backends/base.py rhodecode/lib/vcs/nodes.py |
diffstat | 2 files changed, 46 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/base.py Fri May 04 00:14:58 2012 +0200 +++ b/rhodecode/lib/vcs/backends/base.py Fri May 04 00:26:16 2012 +0200 @@ -909,3 +909,48 @@ :raises ``CommitError``: if any error occurs while committing """ raise NotImplementedError + + +class EmptyChangeset(BaseChangeset): + """ + An dummy empty changeset. It's possible to pass hash when creating + an EmptyChangeset + """ + + def __init__(self, cs='0' * 40, repo=None, requested_revision=None, + alias=None): + self._empty_cs = cs + self.revision = -1 + self.message = '' + self.author = '' + self.date = '' + self.repository = repo + self.requested_revision = requested_revision + self.alias = alias + + @LazyProperty + def raw_id(self): + """ + Returns raw string identifying this changeset, useful for web + representation. + """ + + return self._empty_cs + + @LazyProperty + def branch(self): + from rhodecode.lib.vcs.backends import get_backend + return get_backend(self.alias).DEFAULT_BRANCH_NAME + + @LazyProperty + def short_id(self): + return self.raw_id[:12] + + def get_file_changeset(self, path): + return self + + def get_file_content(self, path): + return u'' + + def get_file_size(self, path): + return 0 \ No newline at end of file
--- a/rhodecode/lib/vcs/nodes.py Fri May 04 00:14:58 2012 +0200 +++ b/rhodecode/lib/vcs/nodes.py Fri May 04 00:26:16 2012 +0200 @@ -19,7 +19,7 @@ from rhodecode.lib.vcs.utils import safe_unicode, safe_str from rhodecode.lib.vcs.exceptions import NodeError from rhodecode.lib.vcs.exceptions import RemovedFileNodeError -from rhodecode.lib.utils import EmptyChangeset +from rhodecode.lib.vcs.backends.base import EmptyChangeset class NodeKind: