##// END OF EJS Templates
diff-option: move attributes handling to sysstr...
marmoute -
r51807:e586a7eb default
parent child Browse files
Show More
@@ -151,7 +151,10 b' def encodedir(path):'
151
151
152 def hashdiffopts(diffopts):
152 def hashdiffopts(diffopts):
153 diffoptstr = stringutil.pprint(
153 diffoptstr = stringutil.pprint(
154 sorted((k, getattr(diffopts, k)) for k in mdiff.diffopts.defaults)
154 sorted(
155 (k, getattr(diffopts, pycompat.sysstr(k)))
156 for k in mdiff.diffopts.defaults
157 )
155 )
158 )
156 return hex(hashutil.sha1(diffoptstr).digest())[:6]
159 return hex(hashutil.sha1(diffoptstr).digest())[:6]
157
160
@@ -78,7 +78,7 b' class diffopts:'
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)
@@ -89,14 +89,15 b' class diffopts:'
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__)
General Comments 0
You need to be logged in to leave comments. Login now