Patchwork [1,of,3,STABLE] convert: fix argument mismatch at formatting the abort message

login
register
mail settings
Submitter Katsunori FUJIWARA
Date July 31, 2014, 5:19 p.m.
Message ID <761ea8ca9cb6c2be1ce7.1406827146@feefifofum>
Download mbox | patch
Permalink /patch/5212/
State Accepted
Commit 9663a7855798234e5c2606632f0cc5e17ffbcf8c
Headers show

Comments

Katsunori FUJIWARA - July 31, 2014, 5:19 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1406826864 -32400
#      Fri Aug 01 02:14:24 2014 +0900
# Branch stable
# Node ID 761ea8ca9cb6c2be1ce79dd906510cfd93c4e143
# Parent  838025b15925695bfcf15ad1c3e2b975c85d9aec
convert: fix argument mismatch at formatting the abort message

This patch fixes argument mismatch at formatting the abort message,
introduced by a204fd9b5ba9: the last '%s' doesn't have corresponded
argument.

This patch uses "unexpected size" in the abort message, to distinguish
the reason of failure from "unexpected type" failure checked in the
prior code path below:

        if info[1] != type:
            raise util.Abort(_('cannot read %r object at %s') % (type, rev))

Patch

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -127,7 +127,8 @@ 
         size = int(info[2])
         data = self.catfilepipe[1].read(size)
         if len(data) < size:
-            raise util.Abort(_('cannot read %r object at %s: %s') % (type, rev))
+            raise util.Abort(_('cannot read %r object at %s: unexpected size')
+                             % (type, rev))
         # read the trailing newline
         self.catfilepipe[1].read(1)
         return data