comparison hgext/mq.py @ 14583:28f87e14d923

mq: rename check_localchanges to checklocalchanges
author Adrian Buehlmann <adrian@cadifra.com>
date Mon, 13 Jun 2011 12:06:32 +0200
parents a6467dfbe5dc
children 3343a74eea4e
comparison
equal deleted inserted replaced
14582:a6467dfbe5dc 14583:28f87e14d923
850 if refresh: 850 if refresh:
851 raise util.Abort(_("local changes found, refresh first")) 851 raise util.Abort(_("local changes found, refresh first"))
852 else: 852 else:
853 raise util.Abort(_("local changes found")) 853 raise util.Abort(_("local changes found"))
854 854
855 def check_localchanges(self, repo, force=False, refresh=True): 855 def checklocalchanges(self, repo, force=False, refresh=True):
856 m, a, r, d = repo.status()[:4] 856 m, a, r, d = repo.status()[:4]
857 if (m or a or r or d) and not force: 857 if (m or a or r or d) and not force:
858 self.localchangesfound(refresh) 858 self.localchangesfound(refresh)
859 return m, a, r, d 859 return m, a, r, d
860 860
905 if f != '.hgsubstate': # .hgsubstate is auto-created 905 if f != '.hgsubstate': # .hgsubstate is auto-created
906 raise util.Abort('%s: %s' % (f, msg)) 906 raise util.Abort('%s: %s' % (f, msg))
907 match.bad = badfn 907 match.bad = badfn
908 m, a, r, d = repo.status(match=match)[:4] 908 m, a, r, d = repo.status(match=match)[:4]
909 else: 909 else:
910 m, a, r, d = self.check_localchanges(repo, force=True) 910 m, a, r, d = self.checklocalchanges(repo, force=True)
911 match = scmutil.matchfiles(repo, m + a + r + inclsubs) 911 match = scmutil.matchfiles(repo, m + a + r + inclsubs)
912 if len(repo[None].parents()) > 1: 912 if len(repo[None].parents()) > 1:
913 raise util.Abort(_('cannot manage merge changesets')) 913 raise util.Abort(_('cannot manage merge changesets'))
914 commitfiles = m + a + r 914 commitfiles = m + a + r
915 self.checktoppatch(repo) 915 self.checktoppatch(repo)
984 try: 984 try:
985 wlock = repo.wlock() 985 wlock = repo.wlock()
986 lock = repo.lock() 986 lock = repo.lock()
987 987
988 if update: 988 if update:
989 self.check_localchanges(repo, force=force, refresh=False) 989 self.checklocalchanges(repo, force=force, refresh=False)
990 urev = self.qparents(repo, revs[0]) 990 urev = self.qparents(repo, revs[0])
991 hg.clean(repo, urev) 991 hg.clean(repo, urev)
992 repo.dirstate.write() 992 repo.dirstate.write()
993 993
994 self.removeundo(repo) 994 self.removeundo(repo)
1181 pf = os.path.join(self.path, patchname) 1181 pf = os.path.join(self.path, patchname)
1182 patchfiles = patchmod.changedfiles(self.ui, repo, pf) 1182 patchfiles = patchmod.changedfiles(self.ui, repo, pf)
1183 if wcfiles.intersection(patchfiles): 1183 if wcfiles.intersection(patchfiles):
1184 self.localchangesfound(self.applied) 1184 self.localchangesfound(self.applied)
1185 elif mergeq: 1185 elif mergeq:
1186 self.check_localchanges(refresh=self.applied) 1186 self.checklocalchanges(refresh=self.applied)
1187 1187
1188 all_files = set() 1188 all_files = set()
1189 try: 1189 try:
1190 if mergeq: 1190 if mergeq:
1191 ret = self.mergepatch(repo, mergeq, s, diffopts) 1191 ret = self.mergepatch(repo, mergeq, s, diffopts)
2324 2324
2325 if not files: 2325 if not files:
2326 raise util.Abort(_('qfold requires at least one patch name')) 2326 raise util.Abort(_('qfold requires at least one patch name'))
2327 if not q.checktoppatch(repo)[0]: 2327 if not q.checktoppatch(repo)[0]:
2328 raise util.Abort(_('no patches applied')) 2328 raise util.Abort(_('no patches applied'))
2329 q.check_localchanges(repo) 2329 q.checklocalchanges(repo)
2330 2330
2331 message = cmdutil.logmessage(opts) 2331 message = cmdutil.logmessage(opts)
2332 if opts.get('edit'): 2332 if opts.get('edit'):
2333 if message: 2333 if message:
2334 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) 2334 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))