comparison tests/autodiff.py @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents f78192115229
children 3b517f2a3989
comparison
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
1 # Extension dedicated to test patch.diff() upgrade modes 1 # Extension dedicated to test patch.diff() upgrade modes
2 # 2 #
3 # 3 #
4 from mercurial import cmdutil, scmutil, patch, util 4 from mercurial import cmdutil, scmutil, patch, error
5 5
6 cmdtable = {} 6 cmdtable = {}
7 command = cmdutil.command(cmdtable) 7 command = cmdutil.command(cmdtable)
8 8
9 @command('autodiff', 9 @command('autodiff',
28 return True 28 return True
29 elif git == 'abort': 29 elif git == 'abort':
30 diffopts.git = False 30 diffopts.git = False
31 diffopts.upgrade = True 31 diffopts.upgrade = True
32 def losedatafn(fn=None, **kwargs): 32 def losedatafn(fn=None, **kwargs):
33 raise util.Abort('losing data for %s' % fn) 33 raise error.Abort('losing data for %s' % fn)
34 else: 34 else:
35 raise util.Abort('--git must be yes, no or auto') 35 raise error.Abort('--git must be yes, no or auto')
36 36
37 node1, node2 = scmutil.revpair(repo, []) 37 node1, node2 = scmutil.revpair(repo, [])
38 m = scmutil.match(repo[node2], pats, opts) 38 m = scmutil.match(repo[node2], pats, opts)
39 it = patch.diff(repo, node1, node2, match=m, opts=diffopts, 39 it = patch.diff(repo, node1, node2, match=m, opts=diffopts,
40 losedatafn=losedatafn) 40 losedatafn=losedatafn)