comparison hgext/mq.py @ 3486:fbf8320f25c8

make mq play nicely with the branch cache - if no patches are applied, don't do anything different - if the cache includes valid data from one of the patch revisions, use the cache, but don't save anything new - if the cache has data from before the patch revisions only, save what the list of branches would be without the patch revisions
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 23 Oct 2006 23:32:56 -0300
parents 0e68608bd11d
children 891c8d20f80f 68341c06bc61
comparison
equal deleted inserted replaced
3485:23cffef5d424 3486:fbf8320f25c8
2000 self.ui.warn('Tag %s overrides mq patch of the same name\n' % patch[1]) 2000 self.ui.warn('Tag %s overrides mq patch of the same name\n' % patch[1])
2001 else: 2001 else:
2002 tagscache[patch[1]] = revlog.bin(patch[0]) 2002 tagscache[patch[1]] = revlog.bin(patch[0])
2003 2003
2004 return tagscache 2004 return tagscache
2005
2006 def branchtags(self):
2007 if self.branchcache != None:
2008 return self.branchcache
2009
2010 q = self.mq
2011 if not q.applied:
2012 return super(mqrepo, self).branchtags()
2013
2014 self.branchcache = {} # avoid recursion in changectx
2015 cl = self.changelog
2016 partial, last, lrev = self._readbranchcache()
2017
2018 qbase = cl.rev(revlog.bin(q.applied[0].rev))
2019 start = lrev + 1
2020 if start < qbase:
2021 # update the cache (excluding the patches) and save it
2022 self._updatebranchcache(partial, lrev+1, qbase)
2023 self._writebranchcache(partial, cl.node(qbase-1), qbase-1)
2024 start = qbase
2025 # if start = qbase, the cache is as updated as it should be.
2026 # if start > qbase, the cache includes (part of) the patches.
2027 # we might as well use it, but we won't save it.
2028
2029 # update the cache up to the tip
2030 self._updatebranchcache(partial, start, cl.count())
2031
2032 self.branchcache = partial
2033 return self.branchcache
2005 2034
2006 if repo.local(): 2035 if repo.local():
2007 repo.__class__ = mqrepo 2036 repo.__class__ = mqrepo
2008 repo.mq = queue(ui, repo.join("")) 2037 repo.mq = queue(ui, repo.join(""))
2009 2038