[PATCH 3 of 6] mq: make pop work with all integers - also if they are zero

Mads Kiilerich mads at kiilerich.com
Mon Jul 12 16:05:47 CDT 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1278968554 -7200
# Node ID 1934a00e55fd707d0ccf0c65d3ae544a22241df7
# Parent  246c6a7829cc010784fa946d468d97d6ea25e6f4
mq: make pop work with all integers - also if they are zero

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -924,10 +924,9 @@
     # 2) a unique substring of the patch name was given
     # 3) patchname[-+]num to indicate an offset in the series file
     def lookup(self, patch, strict=False):
-        patch = patch and str(patch)
-
         if patch is None:
             return None
+        patch = str(patch)
         if patch in self.series:
             return patch
 
@@ -1112,7 +1111,7 @@
 
             if all:
                 start = 0
-            elif patch:
+            elif patch is not None:
                 # index, rev, patch
                 info = self.isapplied(patch)
                 if not info:
diff --git a/tests/test-mq-guards.out b/tests/test-mq-guards.out
--- a/tests/test-mq-guards.out
+++ b/tests/test-mq-guards.out
@@ -250,18 +250,18 @@
 % select not-c
 popping guarded patches
 popping d.patch
-now at: c.patch
+popping c.patch
+now at: new.patch
 reapplying unguarded patches
 applying d.patch
 patch d.patch is empty
 now at: d.patch
 0 A new.patch
-1 A c.patch
+1 G c.patch
 2 A d.patch
 % select not-new
 popping guarded patches
 popping d.patch
-popping c.patch
 popping new.patch
 patch queue now empty
 reapplying unguarded patches


More information about the Mercurial-devel mailing list