[PATCH] Re: 2 bugs in tag removal

Osku Salerma osku at iki.fi
Sun Dec 9 00:50:31 CST 2007


On Sun, 9 Dec 2007, Matt Mackall wrote:

> On Sun, Dec 09, 2007 at 10:24:31AM +0900, Osku Salerma wrote:

>> +        found = ((opts['local'] and tagtype == 'local') or
>> +                 (not opts['local'] and tagtype == 'global'))
>> +
>> +        if not found:
>> +            raise util.Abort(_('%s tag %s does not exist')
>> +                             % (opts['local'] and 'local' or 'global',
>> name))
>
> How about:
>
> if opts['local'] and tagtype == 'global':
>   raise util.Abort(_('%s tag is global) % name)
> if not opts['local'] and tagtype == 'local':
>   raise util.Abort(_('%s tag is local) % name)
>
> ..which is a better message and less code.

That doesn't handle the case where the tag doesn't exist at all. You'd
need to add a third case for that, at which point it's not really any less
code. Do you still want me to implement it that way?

--
Osku Salerma


More information about the Mercurial-devel mailing list