Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 15584:9df9444e96ec
addchangegroup: use a postrelease callback to call changegroup hook
This is will allow addchangegroup to drop lock related code.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 28 Nov 2011 01:18:15 +0100 |
parents | 926a06f7a353 |
children | a348739da8f0 |
comparison
equal
deleted
inserted
replaced
15583:926a06f7a353 | 15584:9df9444e96ec |
---|---|
2001 phases.advanceboundary(self, 0, added) | 2001 phases.advanceboundary(self, 0, added) |
2002 # make changelog see real files again | 2002 # make changelog see real files again |
2003 cl.finalize(trp) | 2003 cl.finalize(trp) |
2004 | 2004 |
2005 tr.close() | 2005 tr.close() |
2006 | |
2007 def postaddchangegroup(): | |
2008 if changesets > 0: | |
2009 # forcefully update the on-disk branch cache | |
2010 self.ui.debug("updating the branch cache\n") | |
2011 self.updatebranchcache() | |
2012 self.hook("changegroup", node=hex(cl.node(clstart)), | |
2013 source=srctype, url=url) | |
2014 | |
2015 for n in added: | |
2016 self.hook("incoming", node=hex(n), source=srctype, | |
2017 url=url) | |
2018 self._postrelease(postaddchangegroup) | |
2019 | |
2006 finally: | 2020 finally: |
2007 tr.release() | 2021 tr.release() |
2008 if lock: | 2022 if lock: |
2009 lock.release() | 2023 lock.release() |
2010 | |
2011 if changesets > 0: | |
2012 # forcefully update the on-disk branch cache | |
2013 self.ui.debug("updating the branch cache\n") | |
2014 self.updatebranchcache() | |
2015 self.hook("changegroup", node=hex(cl.node(clstart)), | |
2016 source=srctype, url=url) | |
2017 | |
2018 for n in added: | |
2019 self.hook("incoming", node=hex(n), source=srctype, url=url) | |
2020 | |
2021 # never return 0 here: | 2024 # never return 0 here: |
2022 if dh < 0: | 2025 if dh < 0: |
2023 return dh - 1 | 2026 return dh - 1 |
2024 else: | 2027 else: |
2025 return dh + 1 | 2028 return dh + 1 |