hgext/mq.py
changeset 2511 041d8f0a8437
parent 2488 2785aeb51be4
child 2512 e4deeaac5e74
--- 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):