parent
b16714a5cc
commit
bf8beb2c12
22
method/hg.py
22
method/hg.py
|
@ -51,10 +51,30 @@ class HgLog(Method, HgBase):
|
|||
|
||||
class HgDiff(Method, HgBase):
|
||||
"""Diff the current file with the version in Mercurial"""
|
||||
def _get_revs(self, w, **vargs):
|
||||
return []
|
||||
def _execute(self, w, **vargs):
|
||||
if not self._hg_check(w):
|
||||
return
|
||||
ui_imp, repo = self._hg_init()
|
||||
hgc.diff(ui_imp, repo, w.buffer.path)
|
||||
revs = self._get_revs(w, **vargs)
|
||||
try:
|
||||
hgc.diff(ui_imp, repo, w.buffer.path, rev=revs)
|
||||
except Exception, e:
|
||||
w.set_error(str(e))
|
||||
return
|
||||
s = ''.join(ui_imp.popbuffer())
|
||||
w.application.data_buffer("*Diff*", s, switch_to=True, modename='diff')
|
||||
|
||||
class HgDiff2(HgDiff):
|
||||
"""Diff the current file with a specific revision in Mercurial"""
|
||||
args = [Argument("revision", type=type(""), prompt="Revision: ")]
|
||||
def _get_revs(self, w, **vargs):
|
||||
return [vargs['revision']]
|
||||
|
||||
class HgDiff3(HgDiff):
|
||||
"""Diff the current file with a specific revision in Mercurial"""
|
||||
args = [Argument("revision1", type=type(""), prompt="First Revision: "),
|
||||
Argument("revision2", type=type(""), prompt="Second Revision: ")]
|
||||
def _get_revs(self, w, **vargs):
|
||||
return [vargs['revision1'], vargs['revision2']]
|
||||
|
|
Loading…
Reference in New Issue