# HG changeset patch # User Mads Kiilerich # Date 2011-10-14 00:50:06 # Node ID a8555f9908d1df1e9fe25deb739fddb9095e9ae7 # Parent 8caf7a757afa6a204e6fa15c6d603a53ffaf522e 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. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1034,8 +1034,6 @@ class queue(object): return self.series[0] return None - if patch is None: - return None if patch in self.series: return patch @@ -1095,12 +1093,12 @@ class queue(object): 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(