comparison mercurial/localrepo.py @ 8393:59160ca338f7

localrepo: use more direct vars in addchangegroup
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Thu, 14 May 2009 16:11:45 +0200
parents 7e5cbb09515b
children 475552c03496
comparison
equal deleted inserted replaced
8392:7e5cbb09515b 8393:59160ca338f7
2018 tr = self.transaction() 2018 tr = self.transaction()
2019 try: 2019 try:
2020 trp = weakref.proxy(tr) 2020 trp = weakref.proxy(tr)
2021 # pull off the changeset group 2021 # pull off the changeset group
2022 self.ui.status(_("adding changesets\n")) 2022 self.ui.status(_("adding changesets\n"))
2023 cor = len(cl) - 1 2023 clstart = len(cl)
2024 chunkiter = changegroup.chunkiter(source) 2024 chunkiter = changegroup.chunkiter(source)
2025 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok: 2025 if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
2026 raise util.Abort(_("received changelog group is empty")) 2026 raise util.Abort(_("received changelog group is empty"))
2027 cnr = len(cl) - 1 2027 clend = len(cl)
2028 changesets = cnr - cor 2028 changesets = clend - clstart
2029 2029
2030 # pull off the manifest group 2030 # pull off the manifest group
2031 self.ui.status(_("adding manifests\n")) 2031 self.ui.status(_("adding manifests\n"))
2032 chunkiter = changegroup.chunkiter(source) 2032 chunkiter = changegroup.chunkiter(source)
2033 # no need to check for empty manifest group here: 2033 # no need to check for empty manifest group here:
2061 % (changesets, revisions, files, heads)) 2061 % (changesets, revisions, files, heads))
2062 2062
2063 if changesets > 0: 2063 if changesets > 0:
2064 p = lambda: cl.writepending() and self.root or "" 2064 p = lambda: cl.writepending() and self.root or ""
2065 self.hook('pretxnchangegroup', throw=True, 2065 self.hook('pretxnchangegroup', throw=True,
2066 node=hex(cl.node(cor+1)), source=srctype, 2066 node=hex(cl.node(clstart)), source=srctype,
2067 url=url, pending=p) 2067 url=url, pending=p)
2068 2068
2069 # make changelog see real files again 2069 # make changelog see real files again
2070 cl.finalize(trp) 2070 cl.finalize(trp)
2071 2071
2075 2075
2076 if changesets > 0: 2076 if changesets > 0:
2077 # forcefully update the on-disk branch cache 2077 # forcefully update the on-disk branch cache
2078 self.ui.debug(_("updating the branch cache\n")) 2078 self.ui.debug(_("updating the branch cache\n"))
2079 self.branchtags() 2079 self.branchtags()
2080 self.hook("changegroup", node=hex(cl.node(cor+1)), 2080 self.hook("changegroup", node=hex(cl.node(clstart)),
2081 source=srctype, url=url) 2081 source=srctype, url=url)
2082 2082
2083 for i in xrange(cor + 1, cnr + 1): 2083 for i in xrange(clstart, clend):
2084 self.hook("incoming", node=hex(cl.node(i)), 2084 self.hook("incoming", node=hex(cl.node(i)),
2085 source=srctype, url=url) 2085 source=srctype, url=url)
2086 2086
2087 # never return 0 here: 2087 # never return 0 here:
2088 if newheads < oldheads: 2088 if newheads < oldheads: