comparison mercurial/localrepo.py @ 8715:8c667f4c482e

commit: move some setup outside the lock
author Matt Mackall <mpm@selenic.com>
date Thu, 04 Jun 2009 16:21:03 -0500
parents dd3ebf81af43
children f037187a6f68
comparison
equal deleted inserted replaced
8714:505a96cbc923 8715:8c667f4c482e
780 Revision information is gathered from the working directory, 780 Revision information is gathered from the working directory,
781 match can be used to filter the committed files. If editor is 781 match can be used to filter the committed files. If editor is
782 supplied, it is called to get a commit message. 782 supplied, it is called to get a commit message.
783 """ 783 """
784 784
785 def fail(f, msg):
786 raise util.Abort('%s: %s' % (f, msg))
787
788 if not match:
789 match = match_.always(self.root, '')
790
791 if not force:
792 vdirs = []
793 match.dir = vdirs.append
794 match.bad = fail
795
785 wlock = self.wlock() 796 wlock = self.wlock()
786 try: 797 try:
787 p1, p2 = self.dirstate.parents() 798 p1, p2 = self.dirstate.parents()
788 799
789 if (not force and p2 != nullid and match and 800 if (not force and p2 != nullid and match and
790 (match.files() or match.anypats())): 801 (match.files() or match.anypats())):
791 raise util.Abort(_('cannot partially commit a merge ' 802 raise util.Abort(_('cannot partially commit a merge '
792 '(do not specify files or patterns)')) 803 '(do not specify files or patterns)'))
793
794 def fail(f, msg):
795 raise util.Abort('%s: %s' % (f, msg))
796
797 if not match:
798 match = match_.always(self.root, '')
799
800 if not force:
801 vdirs = []
802 match.dir = vdirs.append
803 match.bad = fail
804 804
805 changes = self.status(match=match, clean=force) 805 changes = self.status(match=match, clean=force)
806 if force: 806 if force:
807 changes[0].extend(changes[6]) # mq may commit unchanged files 807 changes[0].extend(changes[6]) # mq may commit unchanged files
808 808