diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -784,12 +784,11 @@ class queue(object): def check_localchanges(self, repo, force=False, refresh=True): m, a, r, d = repo.status()[:4] - if m or a or r or d: - if not force: - if refresh: - raise util.Abort(_("local changes found, refresh first")) - else: - raise util.Abort(_("local changes found")) + if (m or a or r or d) and not force: + if refresh: + raise util.Abort(_("local changes found, refresh first")) + else: + raise util.Abort(_("local changes found")) return m, a, r, d _reserved = ('series', 'status', 'guards') @@ -804,7 +803,6 @@ class queue(object): msg: a string or a no-argument function returning a string """ msg = opts.get('msg') - force = opts.get('force') user = opts.get('user') date = opts.get('date') if date: @@ -821,12 +819,10 @@ class queue(object): match.bad = badfn m, a, r, d = repo.status(match=match)[:4] else: - m, a, r, d = self.check_localchanges(repo, force) + m, a, r, d = self.check_localchanges(repo, force=True) match = cmdutil.matchfiles(repo, m + a + r) - if force: - p = repo[None].parents() - if len(p) > 1: - raise util.Abort(_('cannot manage merge changesets')) + if len(repo[None].parents()) > 1: + raise util.Abort(_('cannot manage merge changesets')) commitfiles = m + a + r self.check_toppatch(repo) insert = self.full_series_end() @@ -2682,7 +2678,7 @@ cmdtable = { "qnew": (new, [('e', 'edit', None, _('edit commit message')), - ('f', 'force', None, _('import uncommitted changes into patch')), + ('f', 'force', None, _('import uncommitted changes into patch (deprecated)')), ('g', 'git', None, _('use git extended diff format')), ('U', 'currentuser', None, _('add "From: " to patch')), ('u', 'user', '', _('add "From: " to patch')), diff --git a/tests/test-mq-qnew b/tests/test-mq-qnew --- a/tests/test-mq-qnew +++ b/tests/test-mq-qnew @@ -23,11 +23,8 @@ hg add somefile hg qnew uncommitted.patch hg st hg qseries -hg revert --no-backup somefile -rm somefile echo '% qnew implies add' -hg qnew test.patch hg -R .hg/patches st echo '% qnew missing' diff --git a/tests/test-mq-qnew.out b/tests/test-mq-qnew.out --- a/tests/test-mq-qnew.out +++ b/tests/test-mq-qnew.out @@ -5,12 +5,11 @@ abort: "status" cannot be used as the na abort: "guards" cannot be used as the name of a patch abort: ".hgignore" cannot be used as the name of a patch % qnew with uncommitted changes -abort: local changes found, refresh first -A somefile +uncommitted.patch % qnew implies add A .hgignore A series -A test.patch +A uncommitted.patch % qnew missing abort: missing: No such file or directory % qnew -m @@ -22,7 +21,7 @@ abort: patch "first.patch" already exist % qnew -f from a subdirectory popping first.patch popping mtest.patch -popping test.patch +popping uncommitted.patch patch queue now empty adding d/b M d/b