comparison mercurial/merge.py @ 35284:1b03407e808d

merge: skip subrepo state, update hooks, and updating the dirstate in IMM Differential Revision: https://phab.mercurial-scm.org/D1215
author Phil Cohen <phillco@fb.com>
date Fri, 01 Dec 2017 00:07:23 -0800
parents 46510597d266
children 5db3c748ce8f
comparison
equal deleted inserted replaced
35283:46510597d266 35284:1b03407e808d
1837 hint=_("use 'hg update' " 1837 hint=_("use 'hg update' "
1838 "or check 'hg heads'")) 1838 "or check 'hg heads'"))
1839 if not force and (wc.files() or wc.deleted()): 1839 if not force and (wc.files() or wc.deleted()):
1840 raise error.Abort(_("uncommitted changes"), 1840 raise error.Abort(_("uncommitted changes"),
1841 hint=_("use 'hg status' to list changes")) 1841 hint=_("use 'hg status' to list changes"))
1842 for s in sorted(wc.substate): 1842 if not wc.isinmemory():
1843 wc.sub(s).bailifchanged() 1843 for s in sorted(wc.substate):
1844 wc.sub(s).bailifchanged()
1844 1845
1845 elif not overwrite: 1846 elif not overwrite:
1846 if p1 == p2: # no-op update 1847 if p1 == p2: # no-op update
1847 # call the hooks and exit early 1848 # call the hooks and exit early
1848 repo.hook('preupdate', throw=True, parent1=xp2, parent2='') 1849 repo.hook('preupdate', throw=True, parent1=xp2, parent2='')
1953 repo.ui.warn(" %s\n" % nf) 1954 repo.ui.warn(" %s\n" % nf)
1954 1955
1955 ### apply phase 1956 ### apply phase
1956 if not branchmerge: # just jump to the new rev 1957 if not branchmerge: # just jump to the new rev
1957 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' 1958 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
1958 if not partial: 1959 if not partial and not wc.isinmemory():
1959 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) 1960 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
1960 # note that we're in the middle of an update 1961 # note that we're in the middle of an update
1961 repo.vfs.write('updatestate', p2.hex()) 1962 repo.vfs.write('updatestate', p2.hex())
1962 1963
1963 # Advertise fsmonitor when its presence could be useful. 1964 # Advertise fsmonitor when its presence could be useful.
1992 'fsmonitor enabled; enable fsmonitor to improve performance; ' 1993 'fsmonitor enabled; enable fsmonitor to improve performance; '
1993 'see "hg help -e fsmonitor")\n')) 1994 'see "hg help -e fsmonitor")\n'))
1994 1995
1995 stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels) 1996 stats = applyupdates(repo, actions, wc, p2, overwrite, labels=labels)
1996 1997
1997 if not partial: 1998 if not partial and not wc.isinmemory():
1998 with repo.dirstate.parentchange(): 1999 with repo.dirstate.parentchange():
1999 repo.setparents(fp1, fp2) 2000 repo.setparents(fp1, fp2)
2000 recordupdates(repo, actions, branchmerge) 2001 recordupdates(repo, actions, branchmerge)
2001 # update completed, clear state 2002 # update completed, clear state
2002 util.unlink(repo.vfs.join('updatestate')) 2003 util.unlink(repo.vfs.join('updatestate'))