mq: cleanup of lookup - handling of None is not relevant
Patch specifications in mq is passed around as a string or None. None is
generally used when no patch has been specified and there thus is nothing to
lookup and the calling code should do something else. One code path did however
pass None all the way to lookup. That case was handled in lookup, but there was
really need for that, it was undocumented, and it used to cause trouble back
when patches was specified as integers.
--- a/hgext/mq.py Sun Oct 31 18:29:56 2010 +0100
+++ b/hgext/mq.py Fri Oct 14 02:50:06 2011 +0200
@@ -1034,8 +1034,6 @@
return self.series[0]
return None
- if patch is None:
- return None
if patch in self.series:
return patch
@@ -1095,12 +1093,12 @@
self.ui.warn(_('no patches in series\n'))
return 0
- 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)
# qpush B is a NOP (no change) qpush A is an error (can't
# go backwards with qpush)
if patch:
+ patch = self.lookup(patch)
info = self.isapplied(patch)
if info and info[0] >= len(self.applied) - 1:
self.ui.warn(