[PATCH 2 of 6] mq: code simplification/beautification in updateheader
Yann E. MORIN
yann.morin.1998 at anciens.enib.fr
Mon Aug 10 16:52:32 CDT 2009
# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1249940354 -7200
# Node ID 2241e777298ae3e7b9cc84096229ae75a4d6c233
# Parent 2ba25ea4240e6c8916e35c4f09ba766b179efcdc
mq: code simplification/beautification in updateheader
Remove the not-so-usefull temporary variable, and return as soon
as we know the result.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -160,14 +160,12 @@
def updateheader(self, prefixes, new):
'''Update all references to a field in the patch header.
Return whether the field is present.'''
- res = False
for prefix in prefixes:
for i in xrange(len(self.comments)):
if self.comments[i].startswith(prefix):
self.comments[i] = prefix + new
- res = True
- break
- return res
+ return True
+ return False
def __str__(self):
if not self.comments:
More information about the Mercurial-devel
mailing list