# HG changeset patch # User Augie Fackler # Date 1265549825 21600 # Node ID 27d542bc0f5bf9bae749430313cb15b4fd29f824 # Parent eacfff116e175435c97934dce4b105462f3a23a0 qnew: ignore force option This makes the default behavior the same as qnew --force, and deprecates the force option. diff -r eacfff116e17 -r 27d542bc0f5b hgext/mq.py --- a/hgext/mq.py Sun Feb 07 15:09:02 2010 +0100 +++ b/hgext/mq.py Sun Feb 07 07:37:05 2010 -0600 @@ -784,12 +784,11 @@ 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 @@ 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 @@ 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 @@ "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 -r eacfff116e17 -r 27d542bc0f5b tests/test-mq-qnew --- a/tests/test-mq-qnew Sun Feb 07 15:09:02 2010 +0100 +++ b/tests/test-mq-qnew Sun Feb 07 07:37:05 2010 -0600 @@ -23,11 +23,8 @@ 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 -r eacfff116e17 -r 27d542bc0f5b tests/test-mq-qnew.out --- a/tests/test-mq-qnew.out Sun Feb 07 15:09:02 2010 +0100 +++ b/tests/test-mq-qnew.out Sun Feb 07 07:37:05 2010 -0600 @@ -5,12 +5,11 @@ 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 @@ % 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