branch : pmacs2
This commit is contained in:
moculus 2009-04-18 02:09:31 +00:00
parent 757d6e7dca
commit dd276afbbf
1 changed files with 10 additions and 21 deletions

View File

@ -1,32 +1,21 @@
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):
"""
"""
"""Diff the current file with the version in Mercurial"""
def _execute(self, w, **vargs):
if not has_hg:
try:
from mercurial import hg, ui
from mercurial import commands as hgc
except ImportError:
w.set_error("Mecurial is not installed")
return
elif not hasattr(w.buffer, 'path'):
if 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()
repo = hg.repository(ui=ui_imp, path='.')
hgc.diff(ui_imp, repo, w.buffer.path)
data = ui_imp.popbuffer()
w.application.data_buffer("*Diff*", "".join(data),
switch_to=True, modename='diff')
s = ''.join(ui_imp.popbuffer())
w.application.data_buffer("*Diff*", s, switch_to=True, modename='diff')