mercurial/localrepo.py
changeset 3803 2aef481ac73c
parent 3801 bd7011246fab
child 3826 b3b868113d24
child 3850 a4457828ca1a
equal deleted inserted replaced
3802:a0d0d24c4e71 3803:2aef481ac73c
  1740 
  1740 
  1741         return util.chunkbuffer(gengroup())
  1741         return util.chunkbuffer(gengroup())
  1742 
  1742 
  1743     def addchangegroup(self, source, srctype, url):
  1743     def addchangegroup(self, source, srctype, url):
  1744         """add changegroup to repo.
  1744         """add changegroup to repo.
  1745         returns number of heads modified or added + 1."""
  1745 
  1746 
  1746         return values:
       
  1747         - nothing changed or no source: 0
       
  1748         - more heads than before: 1+added heads (2..n)
       
  1749         - less heads than before: -1-removed heads (-2..-n)
       
  1750         - number of heads stays the same: 1
       
  1751         """
  1747         def csmap(x):
  1752         def csmap(x):
  1748             self.ui.debug(_("add changeset %s\n") % short(x))
  1753             self.ui.debug(_("add changeset %s\n") % short(x))
  1749             return cl.count()
  1754             return cl.count()
  1750 
  1755 
  1751         def revmap(x):
  1756         def revmap(x):
  1834 
  1839 
  1835             for i in xrange(cor + 1, cnr + 1):
  1840             for i in xrange(cor + 1, cnr + 1):
  1836                 self.hook("incoming", node=hex(self.changelog.node(i)),
  1841                 self.hook("incoming", node=hex(self.changelog.node(i)),
  1837                           source=srctype, url=url)
  1842                           source=srctype, url=url)
  1838 
  1843 
  1839         return newheads - oldheads + 1
  1844         # never return 0 here:
       
  1845         if newheads < oldheads:
       
  1846             return newheads - oldheads - 1
       
  1847         else:
       
  1848             return newheads - oldheads + 1
  1840 
  1849 
  1841 
  1850 
  1842     def stream_in(self, remote):
  1851     def stream_in(self, remote):
  1843         fp = remote.stream_out()
  1852         fp = remote.stream_out()
  1844         l = fp.readline()
  1853         l = fp.readline()