Mercurial > hg-stable
comparison mercurial/context.py @ 18464:a2e9fe93d9ea stable
changectx: fix the handling of `tip`
We can not use `len(repo,changelog)`, it may be a filtered revision. We now use
`repo,changelog.tip()` to fetch this information.
The `tip` command is also fixed and tested
Thanks goes to Idan Kamara for the initial report.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Tue, 22 Jan 2013 11:39:14 +0100 |
parents | 5d6ee2494f63 |
children | 3e92772d5383 50c922c1b514 |
comparison
equal
deleted
inserted
replaced
18463:07771e233cf1 | 18464:a2e9fe93d9ea |
---|---|
42 if changeid == 'null': | 42 if changeid == 'null': |
43 self._node = nullid | 43 self._node = nullid |
44 self._rev = nullrev | 44 self._rev = nullrev |
45 return | 45 return |
46 if changeid == 'tip': | 46 if changeid == 'tip': |
47 self._rev = len(repo.changelog) - 1 | 47 self._node = repo.changelog.tip() |
48 self._node = repo.changelog.node(self._rev) | 48 self._rev = repo.changelog.rev(self._node) |
49 return | 49 return |
50 if len(changeid) == 20: | 50 if len(changeid) == 20: |
51 try: | 51 try: |
52 self._node = changeid | 52 self._node = changeid |
53 self._rev = repo.changelog.rev(changeid) | 53 self._rev = repo.changelog.rev(changeid) |