Mercurial > hg
changeset 2511:041d8f0a8437
mq: hg qnew -f should refresh the new patch
qnew -f was originally meant to just skip the localchanges check.
But, it currently discards the local changes, which is not at all what
people expect.
This patch changes qnew -f to create the new patch and then
run hg qrefresh on it. The local changes will be in the new
patch.
author | Chris Mason <mason@suse.com> |
---|---|
date | Tue, 27 Jun 2006 11:23:06 -0400 |
parents | cbff06469488 |
children | e4deeaac5e74 |
files | hgext/mq.py |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Jun 27 00:13:44 2006 -0700 +++ b/hgext/mq.py Tue Jun 27 11:23:06 2006 -0400 @@ -386,15 +386,21 @@ self.ui.write("Local changes found, refresh first\n") sys.exit(1) def new(self, repo, patch, msg=None, force=None): - if not force: - self.check_localchanges(repo) + commitfiles = [] + (c, a, r, d, u) = repo.changes(None, None) + if c or a or d or r: + if not force: + raise util.Abort(_("Local changes found, refresh first")) + else: + commitfiles = c + a + r self.check_toppatch(repo) wlock = repo.wlock() insert = self.series_end() if msg: - n = repo.commit([], "[mq]: %s" % msg, force=True, wlock=wlock) + n = repo.commit(commitfiles, "[mq]: %s" % msg, force=True, + wlock=wlock) else: - n = repo.commit([], + n = repo.commit(commitfiles, "New patch: %s" % patch, force=True, wlock=wlock) if n == None: self.ui.warn("repo commit failed\n") @@ -412,6 +418,8 @@ wlock = None r = self.qrepo() if r: r.add([patch]) + if commitfiles: + self.refresh(repo, short=True) def strip(self, repo, rev, update=True, backup="all", wlock=None): def limitheads(chlog, stop):