[IPython-dev] Mercurial queues
Stefan van der Walt
stefan at sun.ac.za
Mon Nov 27 03:08:03 EST 2006
Hi Ville
Please find a patch for bzr completion attached.
Regards
Stéfan
On Sun, Nov 26, 2006 at 07:41:07PM +0200, Ville M. Vainio wrote:
> On 11/26/06, Ville M. Vainio <vivainio at gmail.com> wrote:
>
> > All in all, Mercurial looks / feels very promising...
>
> And on that tangent, there's now a stock completer for "hg" which you
> can invoke by pressing tab after typing the hg command:
>
> [IPython]|8> hg q<TAB>
> qapplied qdiff qimport qpop qrename qseries
> qclone qfold qinit qprev qrestore qtop
> qcommit qguard qnew qpush qsave qunapplied
> qdelete qheader qnext qrefresh qselect
> [IPython]|8> hg q
-------------- next part --------------
Index: IPython/Extensions/ipy_stock_completers.py
===================================================================
--- IPython/Extensions/ipy_stock_completers.py (revision 1942)
+++ IPython/Extensions/ipy_stock_completers.py (working copy)
@@ -113,6 +113,42 @@
ip.set_hook('complete_command', hg_completer, str_key = 'hg')
+bzr_commands = """
+add annotate bind branch break-lock bundle-revisions cat check
+checkout commit conflicts deleted diff export gannotate gbranch
+gcommit gdiff help ignore ignored info init init-repository inventory
+log merge missing mkdir mv nick pull push reconcile register-branch
+remerge remove renames resolve revert revno root serve sign-my-commits
+status testament unbind uncommit unknowns update upgrade version
+version-info visualise whoami
+"""
+
+def bzr_completer(self,event):
+ """ Completer for bazaar commands """
+ cmd_param = event.line.split()
+ if event.line.endswith(' '):
+ cmd_param.append('')
+
+ if len(cmd_param) > 2:
+ cmd = cmd_param[1]
+ param = cmd_param[-1]
+ output_file = (param == '--output=')
+ if cmd == 'help':
+ return bzr_commands.split()
+ elif cmd in ['bundle-revisions','conflicts',
+ 'deleted','nick','register-branch',
+ 'serve','unbind','upgrade','version',
+ 'whoami'] and not output_file:
+ return []
+ else:
+ # the rest are probably file names
+ return ip.IP.Completer.file_matches(event.symbol)
+
+ return bzr_commands.split()
+
+ip.set_hook('complete_command', bzr_completer, str_key = 'bzr')
+
+
def runlistpy(self, event):
comps = shlex.split(event.line)
relpath = (len(comps) > 1 and comps[-1] or '')
More information about the IPython-dev
mailing list