parent
35e4611dd0
commit
757d6e7dca
|
@ -98,7 +98,7 @@ class Application(object):
|
||||||
'method', 'method.svn', 'method.cvs', 'method.search',
|
'method', 'method.svn', 'method.cvs', 'method.search',
|
||||||
'method.buffers', 'method.move', 'method.shell',
|
'method.buffers', 'method.move', 'method.shell',
|
||||||
'method.introspect', 'method.help', 'method.numbers',
|
'method.introspect', 'method.help', 'method.numbers',
|
||||||
'method.spell',
|
'method.spell', 'method.hg',
|
||||||
)
|
)
|
||||||
for name in names:
|
for name in names:
|
||||||
exec("import %s" % name)
|
exec("import %s" % name)
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
try:
|
||||||
|
import mercurial
|
||||||
|
from mercurial import hg
|
||||||
|
from mercurial import ui
|
||||||
|
from mercurial import commands as hgc
|
||||||
|
has_hg = True
|
||||||
|
except ImportError:
|
||||||
|
has_hg = False
|
||||||
|
|
||||||
|
import buffer, default, dirutil, lex, regex, util, window
|
||||||
|
from point import Point
|
||||||
|
|
||||||
|
from method import Method, Argument
|
||||||
|
|
||||||
|
class HgDiff(Method):
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
if not has_hg:
|
||||||
|
w.set_error("Mecurial is not installed")
|
||||||
|
return
|
||||||
|
elif not hasattr(w.buffer, 'path'):
|
||||||
|
w.set_error("Buffer has no corresponding file")
|
||||||
|
return
|
||||||
|
ui_imp = ui.ui(verbose=True)
|
||||||
|
repo = hg.repository(ui=ui_imp, path='.')
|
||||||
|
ui_imp.pushbuffer()
|
||||||
|
hgc.diff(ui_imp, repo, w.buffer.path)
|
||||||
|
data = ui_imp.popbuffer()
|
||||||
|
w.application.data_buffer("*Diff*", "".join(data),
|
||||||
|
switch_to=True, modename='diff')
|
Loading…
Reference in New Issue