mercurial/mdiff.py
changeset 50937 e586a7eb380a
parent 50620 362d5a2ffd17
child 50951 d718eddf01d9
equal deleted inserted replaced
50936:93b0de7f13ca 50937:e586a7eb380a
    76         opts = pycompat.byteskwargs(opts)
    76         opts = pycompat.byteskwargs(opts)
    77         for k in self.defaults.keys():
    77         for k in self.defaults.keys():
    78             v = opts.get(k)
    78             v = opts.get(k)
    79             if v is None:
    79             if v is None:
    80                 v = self.defaults[k]
    80                 v = self.defaults[k]
    81             setattr(self, k, v)
    81             setattr(self, pycompat.sysstr(k), v)
    82 
    82 
    83         try:
    83         try:
    84             self.context = int(self.context)
    84             self.context = int(self.context)
    85         except ValueError:
    85         except ValueError:
    86             raise error.InputError(
    86             raise error.InputError(
    87                 _(b'diff context lines count must be an integer, not %r')
    87                 _(b'diff context lines count must be an integer, not %r')
    88                 % pycompat.bytestr(self.context)
    88                 % pycompat.bytestr(self.context)
    89             )
    89             )
    90 
    90 
    91     def copy(self, **kwargs):
    91     def copy(self, **kwargs):
    92         opts = {k: getattr(self, k) for k in self.defaults}
    92         opts = {k: getattr(self, pycompat.sysstr(k)) for k in self.defaults}
    93         opts = pycompat.strkwargs(opts)
    93         opts = pycompat.strkwargs(opts)
    94         opts.update(kwargs)
    94         opts.update(kwargs)
    95         return diffopts(**opts)
    95         return diffopts(**opts)
    96 
    96 
    97     def __bytes__(self):
    97     def __bytes__(self):
    98         return b", ".join(
    98         return b", ".join(
    99             b"%s: %r" % (k, getattr(self, k)) for k in self.defaults
    99             b"%s: %r" % (k, getattr(self, pycompat.sysstr(k)))
       
   100             for k in self.defaults
   100         )
   101         )
   101 
   102 
   102     __str__ = encoding.strmethod(__bytes__)
   103     __str__ = encoding.strmethod(__bytes__)
   103 
   104 
   104 
   105