diff --git a/kallithea/lib/annotate.py b/kallithea/lib/annotate.py --- a/kallithea/lib/annotate.py +++ b/kallithea/lib/annotate.py @@ -69,7 +69,7 @@ class AnnotateHtmlFormatter(HtmlFormatte def changeset_to_anchor(changeset): return '%s\n' % \ - (changeset.id, changeset.id) + (changeset.raw_id, changeset.raw_id) :param annotate_from_changeset_func: see above :param order: (default: ``['ls', 'annotate', 'code']``); order of diff --git a/kallithea/lib/vcs/backends/base.py b/kallithea/lib/vcs/backends/base.py --- a/kallithea/lib/vcs/backends/base.py +++ b/kallithea/lib/vcs/backends/base.py @@ -320,9 +320,6 @@ class BaseChangeset(object): ``repository`` repository object within which changeset exists - ``id`` - may be ``raw_id`` or i.e. for mercurial's tip just ``tip`` - ``raw_id`` raw changeset representation (i.e. full 40 length sha for git backend) @@ -414,13 +411,6 @@ class BaseChangeset(object): raise NotImplementedError @LazyProperty - def id(self): - """ - Returns string identifying this changeset. - """ - raise NotImplementedError - - @LazyProperty def raw_id(self): """ Returns raw string identifying this changeset. @@ -650,7 +640,7 @@ class BaseChangeset(object): """ Returns dictionary with changeset's attributes and their values. """ - data = get_dict_for_attrs(self, ['id', 'raw_id', 'short_id', + data = get_dict_for_attrs(self, ['raw_id', 'short_id', 'revision', 'date', 'message']) data['author'] = {'name': self.author_name, 'email': self.author_email} data['added'] = [safe_unicode(node.path) for node in self.added] diff --git a/kallithea/lib/vcs/backends/git/changeset.py b/kallithea/lib/vcs/backends/git/changeset.py --- a/kallithea/lib/vcs/backends/git/changeset.py +++ b/kallithea/lib/vcs/backends/git/changeset.py @@ -32,7 +32,6 @@ class GitChangeset(BaseChangeset): except KeyError: raise RepositoryError("Cannot get object with id %s" % revision) self.raw_id = ascii_str(commit.id) - self.id = self.raw_id self.short_id = self.raw_id[:12] self._commit = commit # a Dulwich Commmit with .id self._tree_id = commit.tree @@ -289,16 +288,15 @@ class GitChangeset(BaseChangeset): iterating commits. """ self._get_filectx(path) - cs_id = safe_str(self.id) f_path = safe_str(path) if limit is not None: cmd = ['log', '-n', str(safe_int(limit, 0)), - '--pretty=format:%H', '-s', cs_id, '--', f_path] + '--pretty=format:%H', '-s', self.raw_id, '--', f_path] else: cmd = ['log', - '--pretty=format:%H', '-s', cs_id, '--', f_path] + '--pretty=format:%H', '-s', self.raw_id, '--', f_path] so = self.repository.run_git_command(cmd) ids = re.findall(r'[0-9a-fA-F]{40}', so) return [self.repository.get_changeset(sha) for sha in ids] @@ -311,7 +309,7 @@ class GitChangeset(BaseChangeset): """ self._get_filectx(path) from dulwich.walk import Walker - include = [self.id] + include = [self.raw_id] walker = Walker(self.repository._repo.object_store, include, paths=[path], max_entries=1) return [self.repository.get_changeset(ascii_str(x.commit.id.decode)) @@ -325,7 +323,7 @@ class GitChangeset(BaseChangeset): # TODO: This function now uses os underlying 'git' command which is # generally not good. Should be replaced with algorithm iterating # commits. - cmd = ['blame', '-l', '--root', '-r', self.id, '--', path] + cmd = ['blame', '-l', '--root', '-r', self.raw_id, '--', path] # -l ==> outputs long shas (and we need all 40 characters) # --root ==> doesn't put '^' character for boundaries # -r sha ==> blames for the given revision diff --git a/kallithea/lib/vcs/backends/hg/changeset.py b/kallithea/lib/vcs/backends/hg/changeset.py --- a/kallithea/lib/vcs/backends/hg/changeset.py +++ b/kallithea/lib/vcs/backends/hg/changeset.py @@ -134,12 +134,6 @@ class MercurialChangeset(BaseChangeset): return self._dir_paths + self._file_paths @LazyProperty - def id(self): - if self.last: - return u'tip' - return self.short_id - - @LazyProperty def short_id(self): return self.raw_id[:12] diff --git a/kallithea/tests/vcs/test_changesets.py b/kallithea/tests/vcs/test_changesets.py --- a/kallithea/tests/vcs/test_changesets.py +++ b/kallithea/tests/vcs/test_changesets.py @@ -15,7 +15,6 @@ class TestBaseChangeset(object): def test_as_dict(self): changeset = BaseChangeset() - changeset.id = 'ID' changeset.raw_id = 'RAW_ID' changeset.short_id = 'SHORT_ID' changeset.revision = 1009 @@ -26,7 +25,6 @@ class TestBaseChangeset(object): changeset.changed = [] changeset.removed = [] assert changeset.as_dict() == { - 'id': 'ID', 'raw_id': 'RAW_ID', 'short_id': 'SHORT_ID', 'revision': 1009, diff --git a/kallithea/tests/vcs/test_inmemchangesets.py b/kallithea/tests/vcs/test_inmemchangesets.py --- a/kallithea/tests/vcs/test_inmemchangesets.py +++ b/kallithea/tests/vcs/test_inmemchangesets.py @@ -153,7 +153,7 @@ class InMemoryChangesetTestMixin(_Backen newtip = self.repo.get_changeset() assert tip != newtip - assert tip.id != newtip.id + assert tip.raw_id != newtip.raw_id assert newtip.get_node('foo/bar/baz').content == b'My **changed** content' def test_change_non_ascii(self): @@ -179,7 +179,7 @@ class InMemoryChangesetTestMixin(_Backen newtip = self.repo.get_changeset() assert tip != newtip - assert tip.id != newtip.id + assert tip.raw_id != newtip.raw_id assert newtip.get_node('żółwik/zwierzątko').content == b'My **changed** content' assert newtip.get_node('żółwik/zwierzątko_uni').content == b'My **changed** content' @@ -237,7 +237,7 @@ class InMemoryChangesetTestMixin(_Backen newtip = self.repo.get_changeset() assert tip != newtip - assert tip.id != newtip.id + assert tip.raw_id != newtip.raw_id with pytest.raises(NodeDoesNotExistError): newtip.get_node(node.path)