Show More
@@ -909,3 +909,48 b' class BaseInMemoryChangeset(object):' | |||||
909 | :raises ``CommitError``: if any error occurs while committing |
|
909 | :raises ``CommitError``: if any error occurs while committing | |
910 | """ |
|
910 | """ | |
911 | raise NotImplementedError |
|
911 | raise NotImplementedError | |
|
912 | ||||
|
913 | ||||
|
914 | class EmptyChangeset(BaseChangeset): | |||
|
915 | """ | |||
|
916 | An dummy empty changeset. It's possible to pass hash when creating | |||
|
917 | an EmptyChangeset | |||
|
918 | """ | |||
|
919 | ||||
|
920 | def __init__(self, cs='0' * 40, repo=None, requested_revision=None, | |||
|
921 | alias=None): | |||
|
922 | self._empty_cs = cs | |||
|
923 | self.revision = -1 | |||
|
924 | self.message = '' | |||
|
925 | self.author = '' | |||
|
926 | self.date = '' | |||
|
927 | self.repository = repo | |||
|
928 | self.requested_revision = requested_revision | |||
|
929 | self.alias = alias | |||
|
930 | ||||
|
931 | @LazyProperty | |||
|
932 | def raw_id(self): | |||
|
933 | """ | |||
|
934 | Returns raw string identifying this changeset, useful for web | |||
|
935 | representation. | |||
|
936 | """ | |||
|
937 | ||||
|
938 | return self._empty_cs | |||
|
939 | ||||
|
940 | @LazyProperty | |||
|
941 | def branch(self): | |||
|
942 | from rhodecode.lib.vcs.backends import get_backend | |||
|
943 | return get_backend(self.alias).DEFAULT_BRANCH_NAME | |||
|
944 | ||||
|
945 | @LazyProperty | |||
|
946 | def short_id(self): | |||
|
947 | return self.raw_id[:12] | |||
|
948 | ||||
|
949 | def get_file_changeset(self, path): | |||
|
950 | return self | |||
|
951 | ||||
|
952 | def get_file_content(self, path): | |||
|
953 | return u'' | |||
|
954 | ||||
|
955 | def get_file_size(self, path): | |||
|
956 | return 0 No newline at end of file |
@@ -19,7 +19,7 b' from rhodecode.lib.vcs.utils.lazy import' | |||||
19 | from rhodecode.lib.vcs.utils import safe_unicode, safe_str |
|
19 | from rhodecode.lib.vcs.utils import safe_unicode, safe_str | |
20 | from rhodecode.lib.vcs.exceptions import NodeError |
|
20 | from rhodecode.lib.vcs.exceptions import NodeError | |
21 | from rhodecode.lib.vcs.exceptions import RemovedFileNodeError |
|
21 | from rhodecode.lib.vcs.exceptions import RemovedFileNodeError | |
22 |
from rhodecode.lib. |
|
22 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
23 |
|
23 | |||
24 |
|
24 | |||
25 | class NodeKind: |
|
25 | class NodeKind: |
General Comments 0
You need to be logged in to leave comments.
Login now