From 39c63a32b6933bcde4c321fb07e75170ca95173b 2007-02-22 15:53:47 From: vivainio Date: 2007-02-22 15:53:47 Subject: [PATCH] New extensions ipy_p4 for %p4 magic (perforce) --- diff --git a/IPython/Extensions/ipy_p4.py b/IPython/Extensions/ipy_p4.py new file mode 100644 index 0000000..e6750a0 --- /dev/null +++ b/IPython/Extensions/ipy_p4.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +""" +Add %p4 magic for pythonic p4 (Perforce) usage. +""" + +import IPython.ipapi +ip = IPython.ipapi.get() + +import os,sys,marshal + +import ipy_stock_completers + +def p4_f(self, parameter_s=''): + cmd = 'p4 -G ' + parameter_s + return marshal.load(os.popen(cmd)) + +ip.expose_magic('p4', p4_f) + +p4_commands = """\ +add admin annotate branch branches change changes changelist +changelists client clients counter counters delete depot depots +describe diff diff2 dirs edit filelog files fix fixes flush fstat +group groups have help info integrate integrated job jobs jobspec +label labels labelsync lock logger login logout monitor obliterate +opened passwd print protect rename reopen resolve resolved revert +review reviews set submit sync tag tickets triggers typemap unlock +user users verify workspace workspaces where""" + +def p4_completer(self,event): + return ipy_stock_completers.vcs_completer(p4_commands, event) + +ip.set_hook('complete_command', p4_completer, str_key = '%p4') + + diff --git a/doc/ChangeLog b/doc/ChangeLog index 634b561..cb934f5 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2007-02-22 Ville Vainio + + * IPython/Extensions/ipy_p4.py: Extension for improved + p4 (perforce version control system) experience. + Adds %p4 magic with p4 command completion and + automatic -G argument (marshall output as python dict) + 2007-02-19 Fernando Perez * IPython/demo.py (Demo.re_stop): make dashes optional in demo