[PATCH RFC] mq: add --fill option to qqueue command

Martin Geisler mg at aragost.com
Thu May 3 04:29:04 CDT 2012


Takumi IINO <trot.thunder at gmail.com> writes:

Sending this back to the mercurial-devel list, please keep the list
Cc'ed.

> Thank you for your comment.
>
> 2012/5/3 Martin Geisler <mg at aragost.com>:
>> Takumi IINO <trot.thunder at gmail.com> writes:
>>
>>> # HG changeset patch
>>> # User Takumi IINO <trot.thunder at gmail.com>
>>> # Date 1335848882 -32400
>>> # Node ID aa0abd1cc4e15c4832fa441d5ea171d3420779b1
>>> # Parent  55982f62651f1974fcd91197f1c4801cc98a48f2
>>> mq: add --fill option to qqueue command
>>>
>>> Useful information is filled patch queues rather than available
>>> patch queues.
>>
>> I've never had to use more than one patch queue, so I don't see why
>> this is terribly useful -- can you not just run 'ls .hg/patches-*' to
>> see the queues?
>
> That's right, but I do not want to look at the .hg directory.

Okay. You could hide this with a shell alias:

  [alias]
  non-empty-mqs = !ls $(hg root)/.hg/patches-*

>>> diff --git a/hgext/mq.py b/hgext/mq.py
>>> --- a/hgext/mq.py
>>> +++ b/hgext/mq.py
>>> @@ -3021,6 +3021,7 @@
>>>  @command("qqueue",
>>>           [('l', 'list', False, _('list all available queues')),
>>>            ('', 'active', False, _('print name of active queue')),
>>> +          ('', 'fill', False, _('print name of filled queue')),
>>
>> I'm sorry, but I don't understand what this should do from the help
>> text. From looking at the code below, it seems that this only prints the
>> names of the non-empty queues? If so, then I think --non-empty would be
>> a better name.
>
> Yes, --fill option prints name of non-empyt queues.
> --non-empty better than --fill. --fill is bad name...

No problem, I see others was confused too :)

>>>            ('c', 'create', False, _('create new queue')),
>>>            ('', 'rename', False, _('rename active queue')),
>>>            ('', 'delete', False, _('delete reference to queue')),
>>> @@ -3127,11 +3128,20 @@
>>>          fh.close()
>>>          util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
>>>
>>> -    if not name or opts.get('list') or opts.get('active'):
>>> +    if not name or opts.get('list') or opts.get('active') or opts.get('fill'):
>>>          current = _getcurrent()
>>>          if opts.get('active'):
>>>              ui.write('%s\n' % (current,))
>>>              return
>>> +        if opts.get('fill'):
>>> +            for queue in _getqueues():
>>> +                if len(repo.othermq(_queuedir(queue)).fullseries) > 0:
>>> +                    ui.write('%s' % (queue,))
>>> +                    if queue == current and not ui.quiet:
>>> +                        ui.write(_(' (active)\n'))
>>> +                    else:
>>> +                        ui.write('\n')
>>> +            return
>>>          for queue in _getqueues():
>>>              ui.write('%s' % (queue,))
>>
>> I guess the new code could be put into this loop instead? Add a
>>
>>  if (not opts.get('fill')
>>      or len(repo.othermq(_queuedir(queue)).fullseries) > 0):
>>
>> test before printing the queue name.
>
> Your guess is right. I fix it.
>
> Regards

-- 
Martin Geisler

aragost Trifork
Commercial Mercurial support
http://aragost.com/mercurial/


More information about the Mercurial-devel mailing list