comparison hgext/mq.py @ 10372:27d542bc0f5b

qnew: ignore force option This makes the default behavior the same as qnew --force, and deprecates the force option.
author Augie Fackler <durin42@gmail.com>
date Sun, 07 Feb 2010 07:37:05 -0600
parents c050b7e4e778
children e54e3f6e6789
comparison
equal deleted inserted replaced
10371:eacfff116e17 10372:27d542bc0f5b
782 return top, patch 782 return top, patch
783 return None, None 783 return None, None
784 784
785 def check_localchanges(self, repo, force=False, refresh=True): 785 def check_localchanges(self, repo, force=False, refresh=True):
786 m, a, r, d = repo.status()[:4] 786 m, a, r, d = repo.status()[:4]
787 if m or a or r or d: 787 if (m or a or r or d) and not force:
788 if not force: 788 if refresh:
789 if refresh: 789 raise util.Abort(_("local changes found, refresh first"))
790 raise util.Abort(_("local changes found, refresh first")) 790 else:
791 else: 791 raise util.Abort(_("local changes found"))
792 raise util.Abort(_("local changes found"))
793 return m, a, r, d 792 return m, a, r, d
794 793
795 _reserved = ('series', 'status', 'guards') 794 _reserved = ('series', 'status', 'guards')
796 def check_reserved_name(self, name): 795 def check_reserved_name(self, name):
797 if (name in self._reserved or name.startswith('.hg') 796 if (name in self._reserved or name.startswith('.hg')
802 def new(self, repo, patchfn, *pats, **opts): 801 def new(self, repo, patchfn, *pats, **opts):
803 """options: 802 """options:
804 msg: a string or a no-argument function returning a string 803 msg: a string or a no-argument function returning a string
805 """ 804 """
806 msg = opts.get('msg') 805 msg = opts.get('msg')
807 force = opts.get('force')
808 user = opts.get('user') 806 user = opts.get('user')
809 date = opts.get('date') 807 date = opts.get('date')
810 if date: 808 if date:
811 date = util.parsedate(date) 809 date = util.parsedate(date)
812 diffopts = self.diffopts({'git': opts.get('git')}) 810 diffopts = self.diffopts({'git': opts.get('git')})
819 def badfn(f, msg): 817 def badfn(f, msg):
820 raise util.Abort('%s: %s' % (f, msg)) 818 raise util.Abort('%s: %s' % (f, msg))
821 match.bad = badfn 819 match.bad = badfn
822 m, a, r, d = repo.status(match=match)[:4] 820 m, a, r, d = repo.status(match=match)[:4]
823 else: 821 else:
824 m, a, r, d = self.check_localchanges(repo, force) 822 m, a, r, d = self.check_localchanges(repo, force=True)
825 match = cmdutil.matchfiles(repo, m + a + r) 823 match = cmdutil.matchfiles(repo, m + a + r)
826 if force: 824 if len(repo[None].parents()) > 1:
827 p = repo[None].parents() 825 raise util.Abort(_('cannot manage merge changesets'))
828 if len(p) > 1:
829 raise util.Abort(_('cannot manage merge changesets'))
830 commitfiles = m + a + r 826 commitfiles = m + a + r
831 self.check_toppatch(repo) 827 self.check_toppatch(repo)
832 insert = self.full_series_end() 828 insert = self.full_series_end()
833 wlock = repo.wlock() 829 wlock = repo.wlock()
834 try: 830 try:
2680 [('c', 'create-repo', None, _('create queue repository'))], 2676 [('c', 'create-repo', None, _('create queue repository'))],
2681 _('hg qinit [-c]')), 2677 _('hg qinit [-c]')),
2682 "qnew": 2678 "qnew":
2683 (new, 2679 (new,
2684 [('e', 'edit', None, _('edit commit message')), 2680 [('e', 'edit', None, _('edit commit message')),
2685 ('f', 'force', None, _('import uncommitted changes into patch')), 2681 ('f', 'force', None, _('import uncommitted changes into patch (deprecated)')),
2686 ('g', 'git', None, _('use git extended diff format')), 2682 ('g', 'git', None, _('use git extended diff format')),
2687 ('U', 'currentuser', None, _('add "From: <current user>" to patch')), 2683 ('U', 'currentuser', None, _('add "From: <current user>" to patch')),
2688 ('u', 'user', '', _('add "From: <given user>" to patch')), 2684 ('u', 'user', '', _('add "From: <given user>" to patch')),
2689 ('D', 'currentdate', None, _('add "Date: <current date>" to patch')), 2685 ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
2690 ('d', 'date', '', _('add "Date: <given date>" to patch')) 2686 ('d', 'date', '', _('add "Date: <given date>" to patch'))