# HG changeset patch # User Adrian Buehlmann # Date 1244484164 -7200 # Node ID 51c29aec0b75f0c81453fb9ce457cfdec749d22f # Parent 1c610db4a8970fc36d1c1a414aeaf3e8e6d2a5f9 mq: eliminate warning on qpush with empty series Warning was "DeprecationWarning: use lock.release instead of del lock" diff -r 1c610db4a897 -r 51c29aec0b75 hgext/mq.py --- 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) diff -r 1c610db4a897 -r 51c29aec0b75 tests/test-mq-qpush-fail --- 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' diff -r 1c610db4a897 -r 51c29aec0b75 tests/test-mq-qpush-fail.out --- 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