hg-diff2 and hg-diff3 added

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-05-18 00:12:10 -04:00
parent b16714a5cc
commit bf8beb2c12
1 changed files with 21 additions and 1 deletions

View File

@ -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']]