tests/autodiff.py
changeset 26587 56b2bcea2529
parent 23692 f78192115229
child 27281 3b517f2a3989
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)