Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/mq.py @ 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 | ec05ce9cbf47 |
children | 0fb28dbf0dc7 |
comparison
equal
deleted
inserted
replaced
2681:259acfb963d1 | 2682:4e2dc5c16e61 |
---|---|
1278 ui.write("mq version %s\n" % versionstr) | 1278 ui.write("mq version %s\n" % versionstr) |
1279 return 0 | 1279 return 0 |
1280 | 1280 |
1281 def reposetup(ui, repo): | 1281 def reposetup(ui, repo): |
1282 repomap[repo] = queue(ui, repo.join("")) | 1282 repomap[repo] = queue(ui, repo.join("")) |
1283 oldlookup = repo.lookup | 1283 oldtags = repo.tags |
1284 | 1284 |
1285 def qlookup(key): | 1285 def qtags(): |
1286 try: | 1286 if repo.tagscache: |
1287 return oldlookup(key) | 1287 return repo.tagscache |
1288 except hg.RepoError: | 1288 |
1289 q = repomap[repo] | 1289 tagscache = oldtags() |
1290 | 1290 |
1291 qpatchnames = { 'qtip': -1, 'qbase': 0 } | 1291 q = repomap[repo] |
1292 if key in qpatchnames: | 1292 if len(q.applied) == 0: |
1293 if len(q.applied) == 0: | 1293 return tagscache |
1294 self.ui.warn('No patches applied\n') | 1294 |
1295 raise | 1295 mqtags = [patch.split(':') for patch in q.applied] |
1296 patch = q.applied[qpatchnames[key]].split(':')[0] | 1296 mqtags.append((mqtags[-1][0], 'qtip')) |
1297 return revlog.bin(patch) | 1297 mqtags.append((mqtags[0][0], 'qbase')) |
1298 | 1298 for patch in mqtags: |
1299 patch = q.isapplied(key) | 1299 if patch[1] in tagscache: |
1300 if not patch: | 1300 repo.ui.warn('Tag %s overrides mq patch of the same name\n' % patch[1]) |
1301 raise | 1301 else: |
1302 return revlog.bin(patch[1]) | 1302 tagscache[patch[1]] = revlog.bin(patch[0]) |
1303 | 1303 |
1304 repo.lookup = qlookup | 1304 return tagscache |
1305 | |
1306 repo.tags = qtags | |
1305 | 1307 |
1306 cmdtable = { | 1308 cmdtable = { |
1307 "qapplied": (applied, [], 'hg qapplied [PATCH]'), | 1309 "qapplied": (applied, [], 'hg qapplied [PATCH]'), |
1308 "qcommit|qci": | 1310 "qcommit|qci": |
1309 (commit, | 1311 (commit, |