comparison mercurial/localrepo.py @ 18007:2e30972d859d

clfilter: unfilter some parts of the push logic Computation of common changesets during push needs to be done on the widest set possible. An unfiltered version of the repo is kept for discovery and various revset calls. The discovery code itself enforces the filtering of unserved outgoing changeset.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 08 Oct 2012 17:41:07 +0200
parents f9459bcd25fc
children 67c874d14c2c
comparison
equal deleted inserted replaced
18005:aba3c161bcc6 18007:2e30972d859d
1867 lock = None 1867 lock = None
1868 unbundle = remote.capable('unbundle') 1868 unbundle = remote.capable('unbundle')
1869 if not unbundle: 1869 if not unbundle:
1870 lock = remote.lock() 1870 lock = remote.lock()
1871 try: 1871 try:
1872 unfi = self.unfiltered()
1872 # discovery 1873 # discovery
1873 fci = discovery.findcommonincoming 1874 fci = discovery.findcommonincoming
1874 commoninc = fci(self, remote, force=force) 1875 commoninc = fci(unfi, remote, force=force)
1875 common, inc, remoteheads = commoninc 1876 common, inc, remoteheads = commoninc
1876 fco = discovery.findcommonoutgoing 1877 fco = discovery.findcommonoutgoing
1877 outgoing = fco(self, remote, onlyheads=revs, 1878 outgoing = fco(unfi, remote, onlyheads=revs,
1878 commoninc=commoninc, force=force) 1879 commoninc=commoninc, force=force)
1879 1880
1880 1881
1881 if not outgoing.missing: 1882 if not outgoing.missing:
1882 # nothing to push 1883 # nothing to push
1883 scmutil.nochangesfound(self.ui, self, outgoing.excluded) 1884 scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
1884 ret = None 1885 ret = None
1885 else: 1886 else:
1886 # something to push 1887 # something to push
1887 if not force: 1888 if not force:
1888 # if self.obsstore == False --> no obsolete 1889 # if self.obsstore == False --> no obsolete
1889 # then, save the iteration 1890 # then, save the iteration
1890 if self.obsstore: 1891 if unfi.obsstore:
1891 # this message are here for 80 char limit reason 1892 # this message are here for 80 char limit reason
1892 mso = _("push includes obsolete changeset: %s!") 1893 mso = _("push includes obsolete changeset: %s!")
1893 msu = _("push includes unstable changeset: %s!") 1894 msu = _("push includes unstable changeset: %s!")
1894 msb = _("push includes bumped changeset: %s!") 1895 msb = _("push includes bumped changeset: %s!")
1895 # If we are to push if there is at least one 1896 # If we are to push if there is at least one
1896 # obsolete or unstable changeset in missing, at 1897 # obsolete or unstable changeset in missing, at
1897 # least one of the missinghead will be obsolete or 1898 # least one of the missinghead will be obsolete or
1898 # unstable. So checking heads only is ok 1899 # unstable. So checking heads only is ok
1899 for node in outgoing.missingheads: 1900 for node in outgoing.missingheads:
1900 ctx = self[node] 1901 ctx = unfi[node]
1901 if ctx.obsolete(): 1902 if ctx.obsolete():
1902 raise util.Abort(mso % ctx) 1903 raise util.Abort(mso % ctx)
1903 elif ctx.unstable(): 1904 elif ctx.unstable():
1904 raise util.Abort(msu % ctx) 1905 raise util.Abort(msu % ctx)
1905 elif ctx.bumped(): 1906 elif ctx.bumped():
1906 raise util.Abort(msb % ctx) 1907 raise util.Abort(msb % ctx)
1907 discovery.checkheads(self, remote, outgoing, 1908 discovery.checkheads(unfi, remote, outgoing,
1908 remoteheads, newbranch, 1909 remoteheads, newbranch,
1909 bool(inc)) 1910 bool(inc))
1910 1911
1911 # create a changegroup from local 1912 # create a changegroup from local
1912 if revs is None and not outgoing.excluded: 1913 if revs is None and not outgoing.excluded:
1955 # * missingheads part of common (::commonheads) 1956 # * missingheads part of common (::commonheads)
1956 common = set(outgoing.common) 1957 common = set(outgoing.common)
1957 cheads = [node for node in revs if node in common] 1958 cheads = [node for node in revs if node in common]
1958 # and 1959 # and
1959 # * commonheads parents on missing 1960 # * commonheads parents on missing
1960 revset = self.set('%ln and parents(roots(%ln))', 1961 revset = unfi.set('%ln and parents(roots(%ln))',
1961 outgoing.commonheads, 1962 outgoing.commonheads,
1962 outgoing.missing) 1963 outgoing.missing)
1963 cheads.extend(c.node() for c in revset) 1964 cheads.extend(c.node() for c in revset)
1964 # even when we don't push, exchanging phase data is useful 1965 # even when we don't push, exchanging phase data is useful
1965 remotephases = remote.listkeys('phases') 1966 remotephases = remote.listkeys('phases')
1978 ### Apply local phase on remote 1979 ### Apply local phase on remote
1979 1980
1980 # Get the list of all revs draft on remote by public here. 1981 # Get the list of all revs draft on remote by public here.
1981 # XXX Beware that revset break if droots is not strictly 1982 # XXX Beware that revset break if droots is not strictly
1982 # XXX root we may want to ensure it is but it is costly 1983 # XXX root we may want to ensure it is but it is costly
1983 outdated = self.set('heads((%ln::%ln) and public())', 1984 outdated = unfi.set('heads((%ln::%ln) and public())',
1984 droots, cheads) 1985 droots, cheads)
1985 for newremotehead in outdated: 1986 for newremotehead in outdated:
1986 r = remote.pushkey('phases', 1987 r = remote.pushkey('phases',
1987 newremotehead.hex(), 1988 newremotehead.hex(),
1988 str(phases.draft), 1989 str(phases.draft),