On Wed, Sep 9, 2009 at 6:03 PM, Steve Borho<st...@borho.org> wrote:
> On Wed, Sep 9, 2009 at 7:50 PM, Kyle Altendorf <kyle.altend...@gmail.com> 
> wrote:
>> Heres my first attempt at patch submission to any project...  with a
>> little luck it might actually be a useful addition.  :]
>>
>> # HG changeset patch
>> # User Kyle Altendorf <kyle.altend...@gmail.com>
>> # Date 1252543105 25200
>> # Node ID 668a02f11149018f8fe808afaa342c72245d54b1
>> # Parent  4324c75d205323cd1454abe17462684d76b5c081
>> commit: convert advanced committer box to MRU list
>>
>> diff -r 4324c75d2053 -r 668a02f11149 hggtk/commit.py
>> --- a/hggtk/commit.py   Wed Sep 09 13:29:29 2009 -0500
>> +++ b/hggtk/commit.py   Wed Sep 09 17:38:25 2009 -0700
>> @@ -237,9 +237,10 @@
>>         self.check_undo()
>>         self.refresh_branchop()
>>         self.update_parent_labels()
>> -        if not self.comitter_entry.get_text():
>> +        if not self.committer_cbbox.get_active_text():
>>             user = self.opts['user'] or self.repo.ui.config('ui', 'username')
>> -            self.comitter_entry.set_text(hglib.toutf(user or ''))
>> +            if user:
>> +                update_recent_committers(hglib.toutf(user))
>>         if not self.autoinc_entry.get_text():
>>             autoinc = self.repo.ui.config('tortoisehg', 'autoinc', '')
>>             self.autoinc_entry.set_text(hglib.toutf(autoinc))
>> @@ -301,9 +302,21 @@
>>
>>         self.advanced_frame = gtk.Frame(_('Advanced'))
>>         adv_hbox = gtk.HBox(spacing=2)
>> -        adv_hbox.pack_start(gtk.Label(_('Comitter:')), False, False, 2)
>> -        self.comitter_entry = gtk.Entry()
>> -        adv_hbox.pack_start(self.comitter_entry, True, True, 2)
>> +        adv_hbox.pack_start(gtk.Label(_('Committer:')), False, False, 2)
>> +
>> +        liststore = gtk.ListStore(str)
>> +        self.committer_cbbox = gtk.ComboBoxEntry(liststore)
>> +        cell = gtk.CellRendererText()
>> +        self.committer_cbbox.pack_start(cell, True)
>> +        adv_hbox.pack_start(self.committer_cbbox, True, True, 2)
>> +        self._mru_committers = self.settings.mrul('recent_committers')
>> +        self.update_recent_committers()
>> +        committer = self.repo.ui.config('ui', 'username')
>> +        if committer:
>> +            self.update_recent_committers(committer)
>> +        self.committer_cbbox.set_active(0)
>> +        
>> self.committer_cbbox.child.set_text(self.committer_cbbox.get_active_text()
>> or '')
>
> The above line looks redundant.  You mind if I remove it?

I certainly do not...

>
>>         adv_hbox.pack_start(gtk.Label(_('Auto-includes:')), False, False, 2)
>>         self.autoinc_entry = gtk.Entry()
>>         adv_hbox.pack_start(self.autoinc_entry, False, False, 2)
>> @@ -369,6 +382,16 @@
>>                 frame.hide()
>>             setattr(self, statename, show)
>>
>> +    def update_recent_committers(self, name=None):
>> +        if name is not None:
>> +            self._mru_committers.add(name)
>> +            self._mru_committers.compact()
>> +            self.settings.write()
>> +        liststore = self.committer_cbbox.get_model()
>> +        liststore.clear()
>> +        for name in self._mru_committers:
>> +            liststore.append([name])
>> +
>>     def changed_cb(self, combobox):
>>         model = combobox.get_model()
>>         index = combobox.get_active()
>> @@ -551,7 +574,7 @@
>>         if self.mqmode:
>>             qtipctx = self.repo['qtip']
>>             self.qheader = qtipctx.description()
>> -            self.comitter_entry.set_text(hglib.toutf(qtipctx.user()))
>> +            self.committer_cbbox.set_text(hglib.toutf(qtipctx.user()))
>>             buf = self.text.get_buffer()
>>             if buf.get_char_count() == 0 or not buf.get_modified():
>>                 if self.qnew:
>> @@ -829,15 +852,9 @@
>>         self.opts['message'] = buf.get_text(begin, end)
>>         return True
>>
>> -
>>     def hg_commit(self, files):
>>         # get advanced options
>> -        user = hglib.fromutf(self.comitter_entry.get_text())
>> -        self.opts['user'] = user
>> -        incs = hglib.fromutf(self.autoinc_entry.get_text())
>> -        self.opts['include'] = [i.strip() for i in incs.split(',') if
>> i.strip()]
>> -        autopush = self.autopush.get_active()
>> -
>> +        user = hglib.fromutf(self.committer_cbbox.get_active_text())
>>         if not user:
>>             gdialog.Prompt(_('Commit: Invalid username'),
>>                    _('Your username has not been configured.\n\n'
>> @@ -856,6 +873,12 @@
>>             self.refresh_complete()
>>             return
>>
>> +        self.update_recent_committers(user)
>> +        self.opts['user'] = user
>> +        incs = hglib.fromutf(self.autoinc_entry.get_text())
>> +        self.opts['include'] = [i.strip() for i in incs.split(',') if
>> i.strip()]
>> +        autopush = self.autopush.get_active()
>> +
>>         cmdline  = ['hg', 'commit', '--verbose']
>>
>>         if self.nextbranch:
>
> Otherwise it looks good.  It's fortunate that you attached the patch
> because the inline version has a few wrapped lines.
>
> Thanks.

Should I try to avoid the wrapped lines in the email or just be sure
to also attach the patch in the future?  I tried to follow the wiki
guidelines and they said to attach it.

-kyle

>
> --
> Steve Borho
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to