changeset 13773:e5390a8b56db

record: replace poor man's if-statement with real if-statement
author Martin Geisler <mg@lazybytes.net>
date Sun, 27 Mar 2011 12:41:55 +0200
parents 463aca32a937
children 1ce0e80799c0
files hgext/record.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/record.py	Fri Mar 25 22:59:09 2011 -0700
+++ b/hgext/record.py	Sun Mar 27 12:41:55 2011 +0200
@@ -324,10 +324,12 @@
         for i, chunk in enumerate(h.hunks):
             if skipfile is None and skipall is None:
                 chunk.pretty(ui)
-            msg = (total == 1
-                   and (_('record this change to %r?') % chunk.filename())
-                   or (_('record change %d/%d to %r?') %
-                       (pos - len(h.hunks) + i, total, chunk.filename())))
+            if total == 1:
+                msg = _('record this change to %r?') % chunk.filename()
+            else:
+                idx = pos - len(h.hunks) + i
+                msg = _('record change %d/%d to %r?') % (idx, total,
+                                                         chunk.filename())
             r, skipfile, skipall = prompt(skipfile, skipall, msg)
             if r:
                 if fixoffset: