hgext/mq.py
changeset 7621 6d891df43a5f
parent 7620 fbfd92d51540
child 7627 fb32ae9c76e7
--- a/hgext/mq.py	Mon Jan 12 09:53:55 2009 +0100
+++ b/hgext/mq.py	Mon Jan 12 09:07:02 2009 +0100
@@ -1011,6 +1011,14 @@
                     if p in rr:
                         self.ui.warn(_("qpop: forcing dirstate update\n"))
                         update = True
+            else:
+                parents = [p.hex() for p in repo[None].parents()]
+                needupdate = False
+                for entry in self.applied[start:]:
+                    if entry.rev in parents:
+                        needupdate = True
+                        break
+                update = needupdate
 
             if not force and update:
                 self.check_localchanges(repo)
@@ -1021,7 +1029,13 @@
             if update:
                 top = self.check_toppatch(repo)
 
-            if repo.changelog.heads(rev) != [revlog.bin(self.applied[-1].rev)]:
+            try:
+                heads = repo.changelog.heads(rev)
+            except revlog.LookupError:
+                node = short(rev)
+                raise util.Abort(_('trying to pop unknown node %s') % node)
+
+            if heads != [revlog.bin(self.applied[-1].rev)]:
                 raise util.Abort(_("popping would remove a revision not "
                                    "managed by this patch queue"))