comparison mercurial/localrepo.py @ 36009:55e8efa2451a

subrepo: split non-core functions to new module Resolves import cycle caused by subrepo -> cmdutil. Still we have another cycle, cmdutil -> context -> subrepo, but where I think importing context is wrong. Perhaps we'll need repo.makememctx().
author Yuya Nishihara <yuya@tcha.org>
date Tue, 06 Feb 2018 22:36:38 +0900
parents ed3a7300b7b5
children 646002338365
comparison
equal deleted inserted replaced
36008:006ff7268c5c 36009:55e8efa2451a
55 revset, 55 revset,
56 revsetlang, 56 revsetlang,
57 scmutil, 57 scmutil,
58 sparse, 58 sparse,
59 store, 59 store,
60 subrepo, 60 subrepoutil,
61 tags as tagsmod, 61 tags as tagsmod,
62 transaction, 62 transaction,
63 txnutil, 63 txnutil,
64 util, 64 util,
65 vfs as vfsmod, 65 vfs as vfsmod,
1831 status = self.status(match=match, clean=force) 1831 status = self.status(match=match, clean=force)
1832 if force: 1832 if force:
1833 status.modified.extend(status.clean) # mq may commit clean files 1833 status.modified.extend(status.clean) # mq may commit clean files
1834 1834
1835 # check subrepos 1835 # check subrepos
1836 subs, commitsubs, newstate = subrepo.precommit( 1836 subs, commitsubs, newstate = subrepoutil.precommit(
1837 self.ui, wctx, status, match, force=force) 1837 self.ui, wctx, status, match, force=force)
1838 1838
1839 # make sure all explicit patterns are matched 1839 # make sure all explicit patterns are matched
1840 if not force: 1840 if not force:
1841 self.checkcommitpatterns(wctx, vdirs, match, status, fail) 1841 self.checkcommitpatterns(wctx, vdirs, match, status, fail)
1868 # commit subs and write new state 1868 # commit subs and write new state
1869 if subs: 1869 if subs:
1870 for s in sorted(commitsubs): 1870 for s in sorted(commitsubs):
1871 sub = wctx.sub(s) 1871 sub = wctx.sub(s)
1872 self.ui.status(_('committing subrepository %s\n') % 1872 self.ui.status(_('committing subrepository %s\n') %
1873 subrepo.subrelpath(sub)) 1873 subrepoutil.subrelpath(sub))
1874 sr = sub.commit(cctx._text, user, date) 1874 sr = sub.commit(cctx._text, user, date)
1875 newstate[s] = (newstate[s][0], sr) 1875 newstate[s] = (newstate[s][0], sr)
1876 subrepo.writestate(self, newstate) 1876 subrepoutil.writestate(self, newstate)
1877 1877
1878 p1, p2 = self.dirstate.parents() 1878 p1, p2 = self.dirstate.parents()
1879 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') 1879 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
1880 try: 1880 try:
1881 self.hook("precommit", throw=True, parent1=hookp1, 1881 self.hook("precommit", throw=True, parent1=hookp1,
1981 user, ctx.date(), ctx.extra().copy()) 1981 user, ctx.date(), ctx.extra().copy())
1982 xp1, xp2 = p1.hex(), p2 and p2.hex() or '' 1982 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
1983 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, 1983 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
1984 parent2=xp2) 1984 parent2=xp2)
1985 # set the new commit is proper phase 1985 # set the new commit is proper phase
1986 targetphase = subrepo.newcommitphase(self.ui, ctx) 1986 targetphase = subrepoutil.newcommitphase(self.ui, ctx)
1987 if targetphase: 1987 if targetphase:
1988 # retract boundary do not alter parent changeset. 1988 # retract boundary do not alter parent changeset.
1989 # if a parent have higher the resulting phase will 1989 # if a parent have higher the resulting phase will
1990 # be compliant anyway 1990 # be compliant anyway
1991 # 1991 #