Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.1, 1.1.1, and 1.1.2

hglib: provide fallback for new post-1.5 cmdutil.export mercurial API

refs #1054

Changeset edff140c9cdb

Parent 2969e5a9ada6

by Adrian Buehlmann

Changes to 2 files · Browse files at edff140c9cdb Showing diff from parent 2969e5a9ada6 Diff from another changeset...

 
828
829
830
831
 
832
833
834
 
828
829
830
 
831
832
833
834
@@ -828,7 +828,7 @@
  revs = cmdutil.revrange(self.repo, ['tip'])   fp = cStringIO.StringIO()   opts = patch.diffopts(self.ui, self.opts) - cmdutil.export(self.repo, revs, fp=fp, opts=opts) + hglib.export(self.repo, revs, fp=fp, opts=opts)   text = fp.getvalue().splitlines(True)   buf = self.diff_highlight_buffer(text)   self.patch_text.set_buffer(buf)
 
11
12
13
14
 
15
16
17
 
452
453
454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
12
13
 
14
15
16
17
 
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
@@ -11,7 +11,7 @@
 import time  import inspect   -from mercurial import ui, util, extensions, match, bundlerepo, url +from mercurial import ui, util, extensions, match, bundlerepo, url, cmdutil  from mercurial import dispatch, encoding, templatefilters, filemerge    _encoding = encoding.encoding @@ -452,3 +452,17 @@
  return hasattr(cls.__dict__[attr], '__get__')   return None   +def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, + opts=None): + ''' + export changesets as hg patches. + + Mercurial moved patch.export to cmdutil.export after version 1.5 + (change e764f24a45ee in mercurial). + ''' + + try: + return cmdutil.export(repo, revs, template, fp, switch_parent, opts) + except AttributeError: + from mercurial import patch + return patch.export(repo, revs, template, fp, switch_parent, opts)