[PATCH STABLE?] import: abort usefully if no patch name given
Kevin Bullock
kbullock+mercurial at ringworld.org
Fri Oct 21 20:08:48 UTC 2011
On 21 Oct 2011, at 12:32 PM, Matt Mackall wrote:
> On Fri, 2011-10-21 at 11:20 -0500, Kevin Bullock wrote:
>> Here's a quick fix for what's arguably a bug (hence I've flagged it for stable): `hg import` with no arguments aborts quite unhelpfully, as shown by timeless' paste here: <http://pastebin.mozilla.org/1361350>
>>
>> This patch makes it abort with a useful message when, say, you meant to say `hg import -` but forgot the '-'.
>>
>> It also quashes the usage text. Not sure if that's consistent with other commands. Bikeshedding and alternate approaches welcome.
>>
>> [Hopefully Apple Mail doesn't mangle this.]
>
> It did, by deleting a bunch of leading spaces:
>
>> @@ -3414,6 +3414,9 @@ def import_(ui, repo, patch1, *patches,
>>
>> Returns 0 on success.
>> """
>> + if not patch1:
>> + raise util.Abort(_('need at least one patch to import'))
>> +
>> patches = (patch1,) + patches
>>
>> date = opts.get('date')
>
> Why oh why would a mailer even do that?
*flail* Sorry about that. I have no idea what it thinks it's doing.
> Anyway, fixed, queued, and a trivial test added, thanks.
Thanks.
pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock
More information about the Mercurial-devel
mailing list