Mercurial > hg
changeset 2682:4e2dc5c16e61
Add mq patch names to tagscache instead of overriding lookup.
This makes mq patch names visible in hg log and hg tags. It also
resolves the names only once, rather than on every lookup.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Wed, 26 Jul 2006 12:22:04 -0700 |
parents | 259acfb963d1 |
children | 2edfd6644a9f 2ab464771b7d f74077473b36 |
files | hgext/mq.py |
diffstat | 1 files changed, 20 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Jul 25 17:15:44 2006 -0700 +++ b/hgext/mq.py Wed Jul 26 12:22:04 2006 -0700 @@ -1280,28 +1280,30 @@ def reposetup(ui, repo): repomap[repo] = queue(ui, repo.join("")) - oldlookup = repo.lookup + oldtags = repo.tags + + def qtags(): + if repo.tagscache: + return repo.tagscache - def qlookup(key): - try: - return oldlookup(key) - except hg.RepoError: - q = repomap[repo] + tagscache = oldtags() + + q = repomap[repo] + if len(q.applied) == 0: + return tagscache - qpatchnames = { 'qtip': -1, 'qbase': 0 } - if key in qpatchnames: - if len(q.applied) == 0: - self.ui.warn('No patches applied\n') - raise - patch = q.applied[qpatchnames[key]].split(':')[0] - return revlog.bin(patch) + mqtags = [patch.split(':') for patch in q.applied] + mqtags.append((mqtags[-1][0], 'qtip')) + mqtags.append((mqtags[0][0], 'qbase')) + for patch in mqtags: + if patch[1] in tagscache: + repo.ui.warn('Tag %s overrides mq patch of the same name\n' % patch[1]) + else: + tagscache[patch[1]] = revlog.bin(patch[0]) - patch = q.isapplied(key) - if not patch: - raise - return revlog.bin(patch[1]) + return tagscache - repo.lookup = qlookup + repo.tags = qtags cmdtable = { "qapplied": (applied, [], 'hg qapplied [PATCH]'),