mq: eliminate warning on qpush with empty series
authorAdrian Buehlmann <adrian@cadifra.com>
Mon, 08 Jun 2009 20:02:44 +0200
changeset 8795 51c29aec0b75
parent 8794 1c610db4a897
child 8796 2bcef677a6c3
mq: eliminate warning on qpush with empty series Warning was "DeprecationWarning: use lock.release instead of del lock"
hgext/mq.py
tests/test-mq-qpush-fail
tests/test-mq-qpush-fail.out
--- a/hgext/mq.py	Sat May 23 20:38:08 2009 +0900
+++ b/hgext/mq.py	Mon Jun 08 20:02:44 2009 +0200
@@ -902,14 +902,14 @@
     def push(self, repo, patch=None, force=False, list=False,
              mergeq=None, all=False):
         wlock = repo.wlock()
-        if repo.dirstate.parents()[0] not in repo.heads():
-            self.ui.status(_("(working directory not at a head)\n"))
+        try:
+            if repo.dirstate.parents()[0] not in repo.heads():
+                self.ui.status(_("(working directory not at a head)\n"))
 
-        if not self.series:
-            self.ui.warn(_('no patches in series\n'))
-            return 0
+            if not self.series:
+                self.ui.warn(_('no patches in series\n'))
+                return 0
 
-        try:
             patch = self.lookup(patch)
             # Suppose our series file is: A B C and the current 'top'
             # patch is B. qpush C should be performed (moving forward)
--- a/tests/test-mq-qpush-fail	Sat May 23 20:38:08 2009 +0900
+++ b/tests/test-mq-qpush-fail	Mon Jun 08 20:02:44 2009 +0200
@@ -16,6 +16,10 @@
 echo '.hgignore' >> .hgignore
 
 hg qinit
+
+echo '% test qpush on empty series'
+hg qpush
+
 hg qnew patch1
 echo >> foo
 hg qrefresh -m 'patch 1'
--- a/tests/test-mq-qpush-fail.out	Sat May 23 20:38:08 2009 +0900
+++ b/tests/test-mq-qpush-fail.out	Mon Jun 08 20:02:44 2009 +0200
@@ -1,4 +1,6 @@
 adding foo
+% test qpush on empty series
+no patches in series
 patch queue now empty
 applying patch1
 applying patch2